bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] [PATCH] gawk 4.1.1 replace "/inet" with preprocessor macr


From: Dave Sines
Subject: Re: [bug-gawk] [PATCH] gawk 4.1.1 replace "/inet" with preprocessor macro
Date: Tue, 15 Apr 2014 13:49:56 +0100
User-agent: tin/2.2.0-20131224 ("Lochindaal") (UNIX) (Linux/3.0.0-1 (i686))

Eli Zaretskii <address@hidden> wrote:
>> From: address@hidden (Dave Sines)
>> Date: Mon, 14 Apr 2014 16:26:29 +0100
>> 
>> "/inet" is a directory on my system so to avoid confusion I usually
>> build gawk without network support.

That should probably read "without socket support".

>> The following patch allows an alternative base path to be specified
>> via CPPFLAGS during the build.  The documentation is not modified.
>> 
>>   CPPFLAGS="-DGAWK_INET_PATH='\"whatever\"'" \
>>   ./configure && make && make check
> 
> How will this help, if Gawk programs out there are written using
> "/inet", literally?

That's the point.  Such scripts expect socket support.  By building
gawk to use a base which doesn't collide with a filesystem object
(and editing the scripts accordingly) they become usable.

>  What you suggest will only allow you to run your
> programs on your machines, but you cannot possibly share them with
> anyone else,

Gawk programs are editable text.

> nor use programs written by others.

With socket support disabled I can't use scripts which rely on the
special handling of filenames beginning with "/inet/" anyway.

By compiling gawk to treat "/dev/inet/" specially instead of "/inet/",
I can edit those scripts and expect them to work correctly.

> OTOH, a problems with a directory called "/inet", if it ever gets in
> the way of your Gawk programs, can be worked around by using something
> like "/usr/../inet" or some such.

A default gawk build can't handle any filename beginning with "/inet/".

  $ ./gawk '{ print }' /inet/.mounted
  gawk: fatal: no (known) protocol supplied in special filename `/inet/.mounted'
  $ ./gawk 'BEGIN { f = "/inet/.mounted" ; getline < f }'
  gawk: cmd. line:1: fatal: no (known) protocol supplied in special filename 
`/inet/.mounted'

And while your suggestion works,

  $ ./gawk '{ print }' /./inet/.mounted
  $ ./gawk 'BEGIN { f = "/./inet/.mounted" ; getline < f }'
  $ 

Ensuring that gawk never receives a filename beginning with "/inet/"
(including indirectly in shell scripts) is impractical on a system with
an existing /inet.





reply via email to

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