Red Hat Bugzilla – Bug 747592
segfault message supressed with su -c
Last modified: 2014-09-29 10:01:48 EDT
Description of problem: If I try to run a single command via su, and the program crashes, I don't get the segfault message echoed on stderr with bash. Version-Release number of selected component (if applicable): bash-4.1.2-8.el6 How reproducible: always Steps to Reproduce: export LANG=C pushd /tmp cat << EOF > kaboom.c main () { int *p; *p = 0; } EOF cc -o kaboom kaboom.c echo "1) non login BASH" su -s /bin/bash -c "/tmp/kaboom" ; echo $? echo "2) non login TCSH" su -s /bin/tcsh -c "/tmp/kaboom" ; echo $? echo "3) login BASH" su -s /bin/bash -l -c "/tmp/kaboom" ; echo $? echo "4) login TCSH" su -s /bin/tcsh -l -c "/tmp/kaboom" ; echo $? rm -f kaboom kaboom.c popd Actual results: 1) non login BASH 139 2) non login TCSH Segmentation fault 139 3) login BASH 139 4) login TCSH Segmentation fault 139 Expected results: 1) non login BASH Segmentation fault 139 2) non login TCSH Segmentation fault 139 3) login BASH Segmentation fault 139 4) login TCSH Segmentation fault 139 Additional info:
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. If you would like it considered as an exception in the current release, please ask your support representative.
How is it related to bash?
su isn't reporting that error message. Reassigning to coreutils.
(In reply to comment #3) > How is it related to bash? that the problem happens with bash and not with another shell ... (In reply to comment #4) > su isn't reporting that error message. Reassigning to coreutils. ... well, I thought that it is a matter of the shell to report the message, not that su should report it; IOW, I can get "Segmentation fault" message without involving su at all however, I'm not an expert in these matters, feel free to prove me wrong; assigning to bash was just a first try
This request was not resolved in time for the current release. Red Hat invites you to ask your support representative to propose this request, if still desired, for consideration in the next release of Red Hat Enterprise Linux.
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development. This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate, in the next release of Red Hat Enterprise Linux.
Fixed in util-linux upstream a few months back: http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/6438/focus=6445
I suspect this patch bring new error as 128 is added to every exitcode above 0. reproducer: # getent passwd testuser >/dev/null || useradd testuser && for i in {0..3}; do su - testuser -c "exit $i"; echo $i:$?; done actual: 0:0 1:129 2:130 3:131 expected: 0:0 1:1 2:2 3:3 could you please confirm this was brought by this patch and eventually fix it?
I believe this is expected - Value 128+ is used to indicate failure to execute another program in a subprocess - exit 1/2/3 of subprocess (of exit 1/2/3 command) can be seen as failures. However, setting needinfo on Ondrej, so he can confirm that.
just to be clear: this does not happen on currently released version. Also on Fedora coreutils-8.21-11.fc19.x86_64 behaves normally without adding those 128.
Ok, discussed with Ondrej via IRC, he already fixed the bug.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-1652.html