delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/04/07/04:05:21

From: acherman AT inf DOT ethz DOT ch (Erwin Achermann)
Subject: fd handle bug
7 Apr 1998 04:05:21 -0700 :
Message-ID: <35222650.C667A18B.cygnus.gnu-win32@inf.ethz.ch>
Reply-To: erwin DOT achermann AT switzerland DOT org
Mime-Version: 1.0
To: "gnu-win32 AT cygnus DOT com" <gnu-win32 AT cygnus DOT com>, "cgf AT bbc DOT com" <cgf AT bbc DOT com>
Cc: Sergey Okhapkin <sos AT buggy DOT prospect DOT com DOT ru>,
Geoffrey Noer <noer AT cygnus DOT com>

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
<wgue AT berlin DOT snafu DOT de>. 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:achermann AT inf DOT ethz DOT ch  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
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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