Opened 11 years ago

Last modified 7 months ago

#41248 assigned defect

bash @4.2.45_2 - Segmentation Fault when executing undefined command — at Version 4

Reported by: onitsuka42@… Owned by: raimue@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc:
Port: bash

Description (last modified by mf2k (Frank Schima))

When executing any undefined command in bash 4.2.45_2, I get a segmentation fault: 11

$ echo "test"
test
$ dummy
Segmentation fault: 11

I generated a core dump for this segmentation fault, here are the details I extracted from it :

$ lldb

(lldb) target create -core core.7288
error: core.7288 is a corrupt mach-o file: load command 72 LC_SEGMENT_64 has a fileoff + filesize (0x1d602000) that extends beyond the end of the file (0x1d601000), the segment will be truncated
error: core.7288 is a corrupt mach-o file: load command 73 LC_SEGMENT_64 has a fileoff (0x1d602000) that extends beyond the end of the file (0x1d601000)
Core file '/Users/romain/Desktop/tmp/core.7288' (x86_64) was loaded.
Process 0 stopped
* thread #1: tid = 0x0000, 0x00007fff9358d206 libdispatch.dylib`_dispatch_wakeup + 100, stop reason = signal SIGSTOP
    frame #0: 0x00007fff9358d206 libdispatch.dylib`_dispatch_wakeup + 100
libdispatch.dylib`_dispatch_wakeup + 100:
-> 0x7fff9358d206:  movq   %rbx, 16(%rax)
   0x7fff9358d20a:  jmp    0x7fff9358d217            ; _dispatch_wakeup + 117
   0x7fff9358d20c:  movq   %r14, %rdi
   0x7fff9358d20f:  movq   %rbx, %rsi

(lldb) thread backtrace all
* thread #1: tid = 0x0000, 0x00007fff9358d206 libdispatch.dylib`_dispatch_wakeup + 100, stop reason = signal SIGSTOP
    frame #0: 0x00007fff9358d206 libdispatch.dylib`_dispatch_wakeup + 100
    frame #1: 0x00007fff9358d7a8 libdispatch.dylib`_dispatch_queue_push_list_slow2 + 30
    frame #2: 0x00007fff93590145 libdispatch.dylib`_dispatch_mach_msg_send + 608
    frame #3: 0x00007fff9358fe99 libdispatch.dylib`dispatch_mach_send + 136
    frame #4: 0x00007fff892d0864 libxpc.dylib`_xpc_connection_send_message_with_reply_f + 125
    frame #5: 0x00007fff892d0724 libxpc.dylib`xpc_connection_send_message_with_reply_sync + 180
    frame #6: 0x00007fff85fd6193 CoreFoundation`-[CFPrefsPlistSource copyReplyForDaemonMessage:toConnection:error:] + 243
    frame #7: 0x00007fff86130820 CoreFoundation`__47-[CFPrefsPlistSource alreadylocked_synchronize]_block_invoke_2 + 352
    frame #8: 0x00007fff85fd5a9b CoreFoundation`withDaemonConnection + 299
    frame #9: 0x00007fff85fd54fb CoreFoundation`-[CFPrefsPlistSource alreadylocked_synchronize] + 587
    frame #10: 0x00007fff85fd51f3 CoreFoundation`_copyValueForKey + 131
    frame #11: 0x00007fff85fd5147 CoreFoundation`-[CFPrefsPlistSource copyValueForKey:] + 71
    frame #12: 0x00007fff85fd4fa5 CoreFoundation`-[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 149
    frame #13: 0x00007fff85fd4edf CoreFoundation`-[CFPrefsSource copyValueForKey:] + 79
    frame #14: 0x00007fff85fd4e70 CoreFoundation`__CFPreferencesCopyAppValue_block_invoke + 32
    frame #15: 0x00007fff85fcf04e CoreFoundation`+[CFPrefsSearchListSource withSearchListForIdentifier:perform:] + 846
    frame #16: 0x00007fff85fcecb8 CoreFoundation`CFPreferencesCopyAppValue + 168
    frame #17: 0x000000010eaa0598 libintl.8.dylib`_nl_language_preferences_default + 70
    frame #18: 0x000000010ea9e9ea libintl.8.dylib`libintl_dcigettext + 894
    frame #19: 0x000000010e994f71 bash`execute_command_internal + 13351
    frame #20: 0x000000010e991af4 bash`execute_command + 92
    frame #21: 0x000000010e983993 bash`reader_loop + 519
    frame #22: 0x000000010e983052 bash`main + 5994
    frame #23: 0x00007fff8c5905fd libdyld.dylib`start + 1

Once I exit lldb, the issue is solved and now undefined command execution doesn't segfault, but fails properly :

$ dummy
-bash: dummy : command not found

Change History (4)

comment:1 Changed 11 years ago by onitsuka42@…

Cc: onitsuka42@… added

Cc Me!

comment:2 Changed 11 years ago by onitsuka42@…

Sorry I can't edit the ticket to fix the formatting.

comment:3 Changed 11 years ago by onitsuka42@…

I may have found what's causing the issue.

It happens when connecting using ssh and seems to be related to the fact that LC_ALL is undefined.

Last edited 11 years ago by onitsuka42@… (previous) (diff)

comment:4 Changed 11 years ago by mf2k (Frank Schima)

Cc: onitsuka42@… removed
Description: modified (diff)
Keywords: bash segfault lldb core removed
Owner: changed from macports-tickets@… to raimue@…
Port: bash added

In the future, please fill in the Port field and Cc the port maintainers (port info --maintainers bash), but not yourself since the reporter is automatically Cc'ed.

Note: See TracTickets for help on using tickets.