From naddy@mips.inka.de  Thu Sep  6 07:44:51 2001
Return-Path: <naddy@mips.inka.de>
Received: from mail.inka.de (quechua.inka.de [212.227.14.2])
	by hub.freebsd.org (Postfix) with ESMTP id 483BA37B403
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  6 Sep 2001 07:44:50 -0700 (PDT)
Received: from kemoauc.mips.inka.de (uucp@)
	by mail.inka.de with local-bsmtp 
	id 15f0Oe-0007k9-00; Thu, 6 Sep 2001 16:44:48 +0200
Received: (from naddy@localhost)
	by kemoauc.mips.inka.de (8.11.6/8.11.6) id f86EU3484645;
	Thu, 6 Sep 2001 16:30:03 +0200 (CEST)
	(envelope-from naddy)
Message-Id: <200109061430.f86EU3484645@kemoauc.mips.inka.de>
Date: Thu, 6 Sep 2001 16:30:03 +0200 (CEST)
From: Christian Weisgerber <naddy@mips.inka.de>
Reply-To: Christian Weisgerber <naddy@mips.inka.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sh: incorrect value of $? in here-documents
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         30392
>Category:       bin
>Synopsis:       sh: incorrect value of $? in here-documents
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 06 07:50:00 PDT 2001
>Closed-Date:    Sun Jul 18 06:39:17 GMT 2004
>Last-Modified:  Sun Jul 18 06:39:17 GMT 2004
>Originator:     Christian Weisgerber
>Release:        FreeBSD 5.0-CURRENT alpha
>Organization:
>Environment:
System: FreeBSD kemoauc.mips.inka.de 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Sep 3 14:29:29 CEST 2001 naddy@kemoauc.mips.inka.de:/home/obj/usr/src/sys/KEMOAUC alpha

>Description:

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 FreeBSD sh, 1 for all other shells.

>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: maxim 
State-Changed-When: Sun Jul 18 06:38:47 GMT 2004 
State-Changed-Why:  
Duplicate of bin/41410. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=30392 
>Unformatted:
