bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PROCINFO["FS"] and other bugs


From: Aharon Robbins
Subject: Re: PROCINFO["FS"] and other bugs
Date: Tue, 7 May 2002 17:30:11 +0300

Greetings. Re this:

> From: address@hidden (Kenny McCormack)
> Subject: Re: PROCINFO["FS"] and other bugs
> Date: 6 May 2002 11:52:29 -0500
>
> In article <address@hidden>,
> Stepan Kasal <address@hidden> wrote:
> ....
> >I've read the source of gawk-3.1.0.  I've created a few patches.
> >Every patch has a comment at its own beginning.
> >
> >gawk-3.1.0-procinfo_fs.patch         fixes a bug
>
> I looked at this and I have a few comments:
>       1) What is the point of PROCINFO["FS"]?  Isn't it equivalent to
>          just checking to see if FIELDWIDTHS is set or not?

No.  It's possible for both FS and FIELDWIDTHS to have nonempty
values; PROCINFO["FS"] tells you which method gawk is currently using.

        {       ....
                FS = # whatever
                ...
                FIELDWIDTHS = # whatever
                ...
                FS = FS         # go back to FS spliting
                ...
                FIELDWIDTHS = FIELDWIDTHS  # go back to FIELDWIDTHS splitting
                ...
        }

>       2) I think the real problem is that setting the variable via the
>          "-v" command line option, doesn't trigger the normal
>          re-evaluation.  I'm wondering if that wouldn't be the better
>          place to fix this.

Nope.  During -v processing gawk's state is, shall we say, "fragile".
In particular, as is pointed out in the original note, -v processing
happens *before* PROCINFO is created.  Just invoking the set_FS routine
would probably crash gawk or some such.

Arnold



reply via email to

[Prev in Thread] Current Thread [Next in Thread]