Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 To: "'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'" References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; 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 < `/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/