Subject: fd handle bug
From: [email-masked] (Erwin Achermann)

7 Apr 1998 04:05:21 -0700
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: "[email-masked]" <[email-masked]>, "[email-masked]" <[email-masked]>
Cc: Sergey Okhapkin <[email-masked]>,
        Geoffrey Noer <[email-masked]>

Howdy all,

while porting a unix shell script suite, i came across an fd handler bug

A workarround is sufficiently easy, but nevertheless someone might be
able to fix it. It might be related to the readlink() bug, another file
descriptor bug reported recently here on the list by Wolfgang Guelcker
<[email-masked]>. A bad feeling creeps up my back when i think of
all the  inexplicable errors that may stem from one single fd bug!

Here is the reduced script that works as expected on unix but on cygnus
B19 it gives that (un-)funny /dev/fd/6 error

I am running Chris Faylors patched version of cygwinb19.dll.

Keep on digging!

Erwin
-----------------------------------------

#!/bin/bash
e="end"
b="begin"
f=myfile
f=myfile

echo "some real data" > $f
#echo "$b" >> $f
#echo "some old data" >> $f
#echo "$e" >> $f

tmp=$f.tmp
echo "$b" > $tmp
echo "some tmp data" >> $tmp
echo "$e" >> $tmp

# this works on unix as expected
#cat $f <(grep -q "$e" <$f || echo "\n$b\n$e") | \
#	sed -e "/$e/ r $tmp" -e "/$b/,/$e/ d" > $f.new
# ---> leads to: $ cat: /dev/fd/6: No such file or directory

#workarround for cygnus
(grep -q "$e" <$f || echo "\n$b\n$e") | cat $f - | \
	sed -e "/$e/ r $tmp" -e "/$b/,/$e/ d" > $f.new

-- 
Erwin Achermann                               Tel:      ++41 1 632 74 40
Institut fuer Wissenschaftliches Rechnen      Fax:      ++41 1 632 11 72
ETH Zentrum, IFW C29.2         mailto:[email-masked]  ICQ:4625051
CH-8092 Zuerich	               http://www.inf.ethz.ch/personal/acherman/
>  Perfection is reached, not when there is no longer anything to add, <
>  but when there is no longer anything to take away.                  <
>                                          -- Antoine de Saint-Exupery <
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".