Package: dash
Version: 0.5.7-3
Severity: normal
Dear Maintainer,
While trying to suppress the "Aborted" message given by the shell when a
command exits on SIGABRT, I came to the following test script:
====[ filter_aborted.sh ]=============================================
#!/bin/dash
echo "Test #1"
(
./abort 2>&3 || exit $?
) 3>&2 2> /dev/null
echo "=> $?"
echo "Test #2"
(
( exec ./abort ) 2>&3 || exit $?
) 3>&2 2> /dev/null
echo "=> $?"
======================================================================
The "abort" command simply outputs a simple message on stdout and
stderr, and then aborts with SIGABRT. Its C source is given bellow.
====[ abort.c ]=======================================================
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
fputs("1 on stdout\n", stdout);
fflush(stdout);
fputs("2 on stderr\n", stderr);
fflush(stderr);
abort();
}
======================================================================
I was expecting to get the same visible result for both tests (#1 and #2
in the script), i.e. see the simple messages from the "abort" command,
but the "Aborted" message from the shell redirected to /dev/null.
This only works for the second case (Test #2) where a double subshell is
used. Note that it works as expected with "bash --posix".
Sample output :
$ ./filter_aborted.sh
Test #1
1 on stdout
2 on stderr
Aborted (core dumped)
=> 134
Test #2
1 on stdout
2 on stderr
=> 134
Regards,
Arnaud Giersch
-- System Information:
Debian Release: 7.7
APT prefers proposed-updates
APT policy: (500, 'proposed-updates'), (500, 'stable'), (50, 'unstable'),
(40, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages dash depends on:
ii debianutils 4.3.2
ii dpkg 1.16.15
ii libc6 2.13-38+deb7u6
dash recommends no packages.
dash suggests no packages.
-- debconf information:
* dash/sh: true
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]