Greg Wooledge wrote:
On Wed, Nov 18, 2015 at 10:46:57AM -0800, Linda Walsh wrote:
One thing that seems to be another problem. Greg called
my attention to another printf format bug:
%q causes printf to output the corresponding argument in
a
format that can be reused as shell input.
Which it doesn't when nuls are involved.
An argument cannot contain a NUL byte. So it's moot.
---
As in:
printf '"%c"\n' $'\x00'|hexdump -C
00000000 22 00 22 0a |".".|
I see 2 arguments being passed to printf. That puts the
NUL byte between 2 double quotes and terminates the line w/a newline.
What I'm pointing out is that a NUL byte can be used
and processed as an argument in some cases. The fact that it doesn't work
in most places, I will agree, is a short-coming. However one cannot
categorically say that a NUL byte can't be used as an argument. Solving
other places where it doesn't work might make it so that it *would* work...
Maybe a "-b" (binary) option could be added to 'declare'?