[Top][All Lists]

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

Re: 6.0 release

From: Gavin Smith
Subject: Re: 6.0 release
Date: Sun, 10 May 2015 15:29:44 +0100

On 10 May 2015 at 14:47,  <address@hidden> wrote:
> Eli Zaretskii <address@hidden> wrote:
>> While playing with texindex.awk, I found a surprising misfeature.
>> Observe:
>>   gawk -v Invocation_name="foo\texindex.awk" -f texindex\texindex.awk -- 
>> --help
>>   Usage: foo      exindex.awk [OPTION]... FILE...
>>   Generate a sorted index for each TeX output FILE.
>>   Usually FILE... is specified as `foo.??' for a document `foo.texi'.
>> Note that strange "foo      exindex.awk" part: this is Gawk
>> interpreting \t in Invocation_name as a TAB!
> This is standard awk behavior, not a misfeature.  It's even documented.
>> This comes from this line in texindex.awk:
>>   printf(_"Usage: %s [OPTION]... FILE...\n", Invocation_name)
>> Given that 'printf' in Awk interprets escape sequences
> It does not. The string value of the variable contains a tab.
> But the %s outputs the value of the variable without interpreting it.
>> how about making function 'usage' smarter about that?
> What should it do?  gsub(/\t/, "\\t", Invocation_name)?
> If on Windows you use a forward slash, everything will work.

If I understand correctly, the "Invocation_name" is set by the
texindex shell script that invokes awk, based on the name that was
used to invoke the texindex shell script. People running this shell
script aren't running awk directly and shouldn't need to know about
how awk interprets its command-line arguments. I think this problem
would occur with an invocation like "foo\texindex --help".

I'd suggest that this line in the texindex script:

exec $awk_binary -v Invocation_name="$0" -f "$ti_script" -- "$@"

do something to escape the \'s in $0

reply via email to

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