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

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

Re: might be a bug in gawk


From: Dave B
Subject: Re: might be a bug in gawk
Date: Thu, 26 Mar 2009 10:17:03 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090114)

Micah Cowan wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Andreas Schwab wrote:
>> Dave B <address@hidden> writes:
>>
>>> Andreas Schwab wrote:
>>>
>>>> There is no formatting directive that reqires an argument.  %28b is
>>>> unknown and %29% is treated the same as %%. 
>>> Where is that documented?
>> Nowhere.  Both are undefined.
> 
> To be pedantic, %29% is not undefined, AFAICT: % is an ordinary
> conversion specifier, and I don't see anything anywhere that says it
> can't take a field width (but neither would I particularly expect
> real-world implementations to behave appropriately with them).

These are the relevant points in the awk standard about printf:

- If there are insufficient expression arguments to satisfy all the
conversion specifications in the format string, the behavior is undefined.

(and not, as I thought, an error shall be produced)


- If any character sequence in the format string begins with a '%'
character, but does not form a valid conversion specification, the behavior
is unspecified.

Since in the OP's example at least one or both the above points are surely
met, each implementation is really free to behave as it likes, and either
producing an error or being silent is correct.

Thanks to everybody for the hints.

-- 
D.




reply via email to

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