texinfo-devel
[Top][All Lists]
Advanced

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

Re: 6.0 release


From: Eli Zaretskii
Subject: Re: 6.0 release
Date: Sun, 10 May 2015 17:55:36 +0300

> From: address@hidden
> Date: Sun, 10 May 2015 07:47:27 -0600
> Cc: address@hidden, address@hidden
> 
> 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.

I didn't mean an awk misfeature, I meant a misfeature of the script.

> > 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.

No, it contains 2 characters: a backslash followed by 't'.  This isn;t
a Posix shell we are talking about, so the "\t" part was passed to the
script verbatim.

> But the %s outputs the value of the variable without interpreting it.

It probably passes it to libc's printf, no?

> > how about making function 'usage' smarter about that?
> 
> What should it do?  gsub(/\t/, "\\t", Invocation_name)?

That's one way, but I hoped there's something more elegant we could
do.

In a nutshell, Invocation_name is a literal string, so IMO it should
be displayed as such.

> If on Windows you use a forward slash, everything will work.

The Windows shell features that take file names apart produce
backslashes, not forward slashes.  So the batch file I wrote cannot
use forward slashes.

If this is a nuisance with no good solution, I can remove leading
directories from Invocation_name.  I just thought that we don't want
this behavior on any platform.  E.g., what if a directory name
includes some other special characters?



reply via email to

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