[MacPorts] #68638: bash @5.2.15: When a "command not found" situation happens, Bash prints errors and ends with "Abort Trap: 6" instead of printing "Command not found"
MacPorts
noreply at macports.org
Mon Apr 29 09:13:42 UTC 2024
#68638: bash @5.2.15: When a "command not found" situation happens, Bash prints
errors and ends with "Abort Trap: 6" instead of printing "Command not
found"
----------------------+----------------------
Reporter: some1so | Owner: raimue
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: bash |
----------------------+----------------------
Comment (by msbit):
Replying to [comment:22 bradleyCPA]:
> I suppose the problem lies at the intersection of gettext() usage after
fork() and before exec() in bash [execute_cmd.c in bash source] in
combination with setlocale() function replacement [libintl.h, "define
setlocale libintl_setlocale", gettext-runtime/intl/setlocale.c in gettext
source]. It seems that there must be some scenario or scenarios where
calling into Apple's APIs in the gettext-provided setlocale() replacement
spawns a thread so that after the fork() [in bash] calling back into
Apple's APIs using CFLocaleCopyPreferredLanguages (or similar) in the
gettext() call results in the forked process terminating.
From what I can tell, this is what happens:
{{{
int main() {
// via bash`reset_locale_vars > libintl.8.dylib`libintl_setlocale >
.`_libintl_locale_name_default
CFPreferencesCopyAppValue(CFSTR("AppleLocale"),
kCFPreferencesCurrentApplication);
if (fork() == 0) {
// via bash`execute_disk_command > libintl.8.dylib`libintl_gettext >
.`libintl_dcgettext > .`libintl_dcigettext > .`guess_category_value >
.`_libintl_language_preferences_default
CFLocaleCopyPreferredLanguages();
}
}
}}}
`CFPreferencesCopyAppValue` spins up a thread (one of the GCD worker
threads) which triggers this forced crash whenever an objc `+initialize`
method is called (as occurs within `CFLocaleCopyPreferredLanguages`).
--
Ticket URL: <https://trac.macports.org/ticket/68638#comment:25>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list