bug-gawk
[Top][All Lists]
Advanced

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

Re: SLES12: awk hat Probleme mit bestimmtem Dateinamen


From: arnold
Subject: Re: SLES12: awk hat Probleme mit bestimmtem Dateinamen
Date: Wed, 15 Jul 2020 08:41:50 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Hello. Thanks for sending in a report.

"Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> wrote:

> This is a bug report/feature request for GNU Awk 4.1.0, API: 1.0:

That is from May 2013; the current version is 5.1.0; you should update
if you can, and try to get Suse to update.

> The issue basically is: "when is a filename considered to be a variable
> assignment?"  The manual basically says: "If a filename on the command
> line has the form var=val it is treated as a  variable  assignment."
>
> I had the problem that awk did read from stdin when it was expected to
> read the file "cn=config/olcDatabase={1}hdb.ldif".  Agreed, it's an odd
> file name.
>
> Using option --lint did not bring any kind of warning, but when using
> "./cn=config/olcDatabase={1}hdb.ldif" as file parameter instead, awk
> red the file.

There's no reason for a warning. Gawk is behaving as defined and
as documented. There's no way for gawk to know that x=foo/bar is
a path name and not an assignment.

> So I see three possible options:
> 1) Improve the documentation when a filename is treated as variable
> assignment. Specifically add a note for option "-v" that the "-v"
> is actually optional. Also note that a name containing a '=' anywhere
> makes it a variable assignment, while a name starting with "./" is not
> a variable assignment (obviously).

-v is not optional for when you want the assignment to take effect
before the BEGIN rule.

Please see the current documentation:
https://www.gnu.org/software/gawk/manual/html_node/Other-Arguments.html
and
https://www.gnu.org/software/gawk/manual/html_node/Assignment-Options.html

I think things are quite clear as they are now.

> 2) Improve --lint to add a warning like "parameter is treated as variable
> assignment"

No reason to do that, as I said above.

> 3) Generally emit a warning of a variable assignment is done withoput
> option "-v"

Again, this is normal behavior, so warnings are inappropriate.

Thanks,

Arnold



reply via email to

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