Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 508446 - app-shells/bash-4.2_p45-r1 (and others) output "Segmentation fault: 11" when a command is not found
Summary: app-shells/bash-4.2_p45-r1 (and others) output "Segmentation fault: 11" when ...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: AMD64 OS X
: Normal normal
Assignee: Gentoo Prefix
URL: https://trac.macports.org/ticket/41248
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-22 19:04 UTC by Stuart Shelton
Modified: 2020-12-14 20:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2014-04-22 19:04:23 UTC
$ which notfound
which: no notfound in (/opt/gentoo/usr/local/bin:/opt/gentoo/usr/bin:/opt/gentoo/bin:/opt/gentoo/opt/bin:/opt/gentoo/usr/sbin:/opt/gentoo/sbin:/opt/gentoo/usr/x86_64-apple-darwin13/gcc-bin/4.2.1:/usr/bin:/bin)
$ notfound
Segmentation fault: 11
$ export LC_ALL=C
$ stillnotfound
Segmentation fault: 11
$ definitionofmadness
Segmentation fault: 11
$ /usr/bin/true # Ensure we're running an external command, not a shell builtin
$ working
-bash: working: command not found
$ unset LC_ALL
$ brokenagain
Segmentation fault: 11

It appears that if the system language cannot be detected, then any attempt to execute a command which doesn't exist will result in bash issuing a "Segmentation fault: 11" message (although the invoking shell does not appear to be further affected).  If LC_ALL is set, then there is no effect until a valid external binary *is* executed, at which point commands which aren't present will generate the appropriate message.  The segfault message returns, though, as soon as LC_ALL is undefined.  Setting LC_LANG (or other LC_* variables) seems to have no effect on the issue.

The URL above has further discussion of this issue relating to the MacPorts build (so it's not just a Gentoo thing...)
Comment 1 Stuart Shelton 2014-04-22 19:05:03 UTC
Portage 2.2.8-prefix (prefix/darwin/macos/10.9/x64, gcc-4.2.1, unavailable, 13.1.0 x86_64)
=================================================================
System uname: Darwin-13.1.0-x86_64-i386-64bit
Timestamp of tree: Tue, 22 Apr 2014 18:06:40 +0000
app-shells/bash:      4.2_p45-r1
dev-lang/python:      2.7.5-r4::srcshelton
dev-util/cmake:       2.8.12.2
dev-util/pkgconfig:   0.28-r1
sys-devel/autoconf:   2.69
sys-devel/automake:   1.14
sys-devel/gcc-config: 1.8-r00.1
sys-devel/libtool:    2.4.2
sys-devel/make:       4.0-r1
Repositories: gentoo_prefix timebomb_overlay srcshelton
ACCEPT_KEYWORDS="amd64 amd64-linux x64-macos ~x64-macos"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-apple-darwin13"
CFLAGS="-arch x86_64 -march=core-avx-i -mmacosx-version-min=10.9 -fcolor-diagnostics -ftrapv -O3 -pipe"
CHOST="x86_64-apple-darwin13"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-arch x86_64 -march=core-avx-i -mmacosx-version-min=10.9 -fcolor-diagnostics -ftrapv -O3 -pipe"
DISTDIR="/opt/gentoo/usr/portage/distfiles"
FCFLAGS=""
FEATURES="assume-digests binpkg-logs buildpkg candy clean-logs collision-protect compress-build-logs compressdebug config-protect-if-modified distlocks downgrade-backup ebuild-locks fail-clean fixlafiles force-prefix merge-sync news nostrip parallel-fetch parallel-install preserve-libs protect-owned sfperms split-elog split-log splitdebug strict stricter unknown-features-warn unmerge-backup unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LC_ALL="C"
LDFLAGS="-Wl,-dead_strip_dylibs"
MAKEOPTS="-j7"
PKGDIR="/opt/gentoo/usr/portage/packages/clang"
PORTAGE_CONFIGROOT="/opt/gentoo/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/Volumes/Scratch/tmp"
PORTDIR="/opt/gentoo/usr/portage"
PORTDIR_OVERLAY="/opt/gentoo/usr/portage/local/timebomb /opt/gentoo/usr/portage/local/overlay"
USE="aqua berkdb bzip2 clang coreaudio cracklib crypt cxx expat gdbm gmp iconv icu idn ipv6 libedit lzma lzo mmx mmxext modules mpfr ncurses nls objc objc++ pcre perl prefix python python2 readline sqlite sse sse2 ssl threads unicode x64-macos xml zlib" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="Darwin" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="Darwin" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC
Comment 2 John Gibson 2014-08-10 22:26:17 UTC
Recently there were updates in the MacPorts ticket regarding the cause being tracked down to the OS X implementation of gettext:
> bash calls 'gettext' in the child process to print the 'command not found' error, and 'gettext' may call the function 'CFPreferencesCopyAppValue', which is not async-signal-safe. In particular, the bug happens if LC_ALL, LC_MESSAGES and LANG are all not set and 'gettext' is called for the first time in a child process (because otherwise CFPreferencesCopyAppValue is not called as the result is cached)

I think that this gettext bug may also be the root cause of a tar bug that I've seen recently on OS X. tar fails when dealing with compressed archives when LC_ALL is unset:
> % tar tjf foo.tar.bz2
> tar: Child died with signal 11
> tar: Error is not recoverable: exiting now
Comment 3 Fabian Groffen gentoo-dev 2020-12-14 20:44:39 UTC
I'm going to assume this is fixed in recent editions of the systems, toolchains and software packages affected.