Subject: bin/13883: sh: incorrect value of $? in here-documents
To: None <gnats-bugs@gnats.netbsd.org>
From: None <arador@gmx.net>
List: netbsd-bugs
Date: 09/06/2001 13:45:55
>Number: 13883
>Category: bin
>Synopsis: sh: incorrect value of $? in here-documents
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Sep 06 13:47:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Matthias Pretzer
>Release: 1.5.1
>Organization:
>Environment:
NetBSD vingilot.ea.homeip.net 1.5.1 NetBSD 1.5.1 (MYKERNEL) #1: Sun Sep 2 22:01:40 CEST 2001 root@vingilot.ea.homeip.net:/usr/src/sys/arch/i386/compile/MYKERNEL i386
>Description:
Bug found by Christian Weisgerber <naddy@mips.inka.de> for FreeBSD. His description (taken from http://www.freebsd.org/cgi/query-pr.cgi?pr=30392) :
----
In here-documents, sh expands $? to the return value of the current
command rather than that of the previous command.
This behavior differs from that of all other Bourne family shells
I have tested (bash 2.05, ksh93 2001-07-04, pdksh 5.2.14, zsh 4.0.2,
Solaris 7 /usr/bin/sh and /usr/bin/ksh).
I noticed this because it breaks the evaluation of several
(non-critical) tests in the configure script of gtar 1.13.22.----
>How-To-Repeat:
------->
false
cat >>foo <<EOF
$?
EOF
cat foo
<-------
Returns 0 for NetBSD sh, 1 for all other shells.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: