[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: /dev/fd/n bug in gawk 3.1.5
From: |
John H. DuBois III |
Subject: |
Re: /dev/fd/n bug in gawk 3.1.5 |
Date: |
Wed, 21 Jun 2006 23:49:23 -0700 |
User-agent: |
Mutt/1.5.10i |
Thanks, that works perfectly, with all 777 /dev/fd's I was trying to
feed it :)
John
On Sun, Jun 18, 2006 at 10:44:53PM +0300, Aharon Robbins wrote:
> Greetings. Re this:
>
> > Date: Tue, 13 Jun 2006 17:49:58 -0700
> > From: "John H. DuBois III" <address@hidden>
> > Subject: /dev/fd/n bug in gawk 3.1.5
> > To: address@hidden
> >
> > $ cat /dev/fd/4 /dev/fd/5 4<tm1 5<tm2
> > Contents of tm1
> > Contents of tm2
> > $ gawk 1 /dev/fd/4 /dev/fd/5 4<tm1 5<tm2
> > Contents of tm1
> > Contents of tm1
> >
> >
> > gawk: (FILENAME=/dev/fd/5 FNR=3) fatal: error reading input file
> > `/dev/fd/4': Bad file number
>
> The bug fix I posted yesterday was incomplete. It solved the command line
> problem
> but (as I suspected) bugs were still lurking, as shown by this test program.
>
> ---------------------------------------------
> BEGIN {
> while (1) {
> if ((getline l1 < "/dev/fd/4") <= 0)
> break
> print l1
>
> if ((getline l2 < "/dev/fd/5") <= 0)
> break
> print l2
> }
> }
> ---------------------------------------------
>
> Try it with something like
>
> gawk -f foo.awk 4< f1 5< f2
>
> Or by something like this:
>
> $ gawk 1 /dev/pid
> gawk: cmd. line:1: warning: use `PROCINFO["pid"]' instead of `/dev/pid'
> 12102
> gawk: (FILENAME=/dev/pid FNR=1) fatal: error reading input file
> `(null)': Bad file descriptor
>
> Here is a complete patch.
>
> Thanks for helping me get this straightened out!
>
> Arnold
--
John DuBois address@hidden KC6QKZ/AE http://www.armory.com/~spcecdt/