delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/24/04:34:24

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Fri, 24 Aug 2001 10:27:39 +0200
From: Corinna Vinschen <cygwin AT cygwin DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Re: ash-20010805-1 calling trap incorrectly.
Message-ID: <20010824102739.B16154@cygbert.vinschen.de>
Mail-Followup-To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
References: <B51F0C636E578A4E832D3958690CD73ED20B3F AT es04snlnt>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <B51F0C636E578A4E832D3958690CD73ED20B3F@es04snlnt>; from kmorel@sandia.gov on Thu, Aug 23, 2001 at 11:41:16AM -0600

Thanks for the report!

I think I have found a fix for that but I have to check it further.
I will upload a new ash probably next week.

Corinna

On Thu, Aug 23, 2001 at 11:41:16AM -0600, Moreland, Kenneth wrote:
> I've recently installed cygwin on Windows 2000 and noticed a problem with
> sh, specifically the sh included in ash-20010805-1.tar.bz2.  When using the
> << form of redirection AND using a `command || command` command substitution
> within the text of the redirection where the first command is not a shell
> built in, the trap for signal 0 is called.  The trap appears to be called in
> a subshell of some sort because it cannot affect the standard output or
> error streams nor can it change any shell variables.  However, its effects
> can be seen indirectly through the manipulation of files.  As an example,
> consider the following shell script:
> 
> 
> #! /bin/sh
> 
> rm -f out
> 
> trap "echo Caught trap! >> out" 0
> 
> echo "Before cat." > out
> 
> cat <<EOF
> `/bin/echo hello || /bin/echo world`
> EOF
> 
> echo "After cat." >> out
> 
> trap 0
> 
> echo "Trap cleared." >> out
> 
> cat out
> 
> 
> When run with the latest version of the shell script, the output is:
> 
> hello
> Before cat.
> Caught trap!
> After cat.
> Trap cleared.
> 
> As you can see, the signal 0 is somehow raised in the cat command and
> "Caught trap!" is inserted into the file out.  When I back out of the latest
> version of ash to ash-20010425.tar.gz, I get the correct output:
> 
> hello
> Before cat.
> After cat.
> Trap cleared.
> 
> I first noticed this bug while using autoconf and libtool.  The
> AC_PROG_LIBTOOL macro generated script code with the described conditions,
> which caused a trap command to be called that deleted a header file which
> subsequent compiler tests depended on.
> 
> -Ken
> 
>    ****      Kenneth Moreland
>     ***      Sandia National Laboratories
> ***********  
> *** *** ***  email: kmorel AT sandia DOT gov
> **  ***  **  phone: (505) 844-8919
>     ***      fax:   (505) 844-9297
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019