Skip to content

Segmentation fault on macos when installing a new package #293

Description

@gaultier
sudo pkgin -y install mysql-client
reading local summary...
processing local summary...
calculating dependencies...done.
zsh: segmentation fault  sudo pkgin -y install mysql-client

sudo su

lldb pkgin -y install mysql-client
warning: ignoring unknown option: -y
(lldb) target create "pkgin"
Current executable set to 'pkgin' (x86_64).
(lldb) settings set -- target.run-args  "install" "mysql-client"
(lldb) r
Process 67927 launched: '/opt/pkg/bin/pkgin' (x86_64)
calculating dependencies...done.
Process 67927 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00007fff6bb96e52 libsystem_platform.dylib`_platform_strlen + 18
libsystem_platform.dylib`_platform_strlen:
->  0x7fff6bb96e52 <+18>: pcmpeqb (%rdi), %xmm0
    0x7fff6bb96e56 <+22>: pmovmskb %xmm0, %esi
    0x7fff6bb96e5a <+26>: andq   $0xf, %rcx
    0x7fff6bb96e5e <+30>: orq    $-0x1, %rax
Target 0: (pkgin) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00007fff6bb96e52 libsystem_platform.dylib`_platform_strlen + 18
    frame #1: 0x00007fff6ba46cd8 libsystem_c.dylib`strdup + 18
    frame #2: 0x000000010000ba65 pkgin`xstrdup + 9
    frame #3: 0x000000010000574c pkgin`order_install + 191
    frame #4: 0x0000000100002248 pkgin`pkgin_install + 1320
    frame #5: 0x0000000100005120 pkgin`main + 1060
    frame #6: 0x00007fff6b9a0cc9 libdyld.dylib`start + 1
    frame #7: 0x00007fff6b9a0cc9 libdyld.dylib`start + 1

Indeed when using dtrace we see that strdup and hence strlen are called on a NULL address:

sudo dtrace -n 'pid$target::_platform_strlen:entry { printf("%p", arg0) }' -c 'pkgin install mysql-client'
... [elided]
 6   5382           _platform_strlen:entry 0

pkgin upgrade also segfaults in the same way with a similar backtrace.
I have installed it following the official commands (minus the gpg check).

Thanks for the tool, it is otherwise great.

Activity

  1. jperkin commented on Jan 11, 2021

    @jperkin
    Collaborator

    Hmm, this may be NetBSDfr/pkgin#94. If you run pkg_add -U pkgin and then try again does it still fail?

  2. gaultier commented on Jan 11, 2021

    @gaultier
    Author

    Yes, it seems to work now after running this command. Thanks.

  3. added a commit that references this issue on Jan 13, 2021
  4. added a commit that references this issue on Feb 23, 2021
  5. added a commit that references this issue on Mar 30, 2021
  6. added a commit that references this issue on Dec 2, 2021
  7. added a commit that references this issue on Apr 19, 2022
  8. added a commit that references this issue on Sep 4, 2022
  9. added a commit that references this issue on May 5, 2023
    923387b
  10. 40 remaining items

  11. added a commit that references this issue on May 22, 2026
  12. added a commit that references this issue on Aug 25, 2026
  13. added a commit that references this issue on Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions