Date: Sun, 30 Jan 2011 22:57:53 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r218105 - in head: bin/sh tools/regression/bin/sh/execution Message-ID: <201101302257.p0UMvr79088266@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sun Jan 30 22:57:52 2011 New Revision: 218105 URL: http://svn.freebsd.org/changeset/base/218105 Log: sh: Send messages about signals to stderr. This is required by POSIX and seems to make more sense. See also r217557. Added: head/tools/regression/bin/sh/execution/killed2.0 (contents, props changed) Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sun Jan 30 21:00:57 2011 (r218104) +++ head/bin/sh/jobs.c Sun Jan 30 22:57:52 2011 (r218105) @@ -1056,13 +1056,13 @@ dowait(int block, struct job *job) } if (sig > 0 && sig != SIGINT && sig != SIGPIPE) { if (sig < sys_nsig && sys_siglist[sig]) - out1str(sys_siglist[sig]); + out2str(sys_siglist[sig]); else - out1fmt("Signal %d", sig); + outfmt(out2, "Signal %d", sig); if (coredump) - out1str(" (core dumped)"); - out1c('\n'); - flushout(out1); + out2str(" (core dumped)"); + out2c('\n'); + flushout(out2); } } else { TRACE(("Not printing status, rootshell=%d, job=%p\n", rootshell, job)); Added: head/tools/regression/bin/sh/execution/killed2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/killed2.0 Sun Jan 30 22:57:52 2011 (r218105) @@ -0,0 +1,10 @@ +# $FreeBSD$ +# Most shells print a message when a foreground job is killed by a signal. +# POSIX allows this, provided the message is sent to stderr, not stdout. +# Some trickery is needed to capture the message as redirecting stderr of +# the command itself does not affect it. The colon command ensures that +# the subshell forks for ${SH}. + +exec 3>&1 +r=`(${SH} -c 'kill $$'; :) 2>&1 >&3` +[ -n "$r" ]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101302257.p0UMvr79088266>