Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/usr.bin/printf
On Sun, Jun 28, 2020 at 21:52:23 +0700, Robert Elz wrote:
> Date: Fri, 26 Jun 2020 22:05:05 +0000
> From: "Valeriy E. Ushakov" <uwe%netbsd.org@localhost>
> Message-ID: <20200626220505.E9030FB28%cvs.NetBSD.org@localhost>
>
> | Modified Files:
> | src/usr.bin/printf: printf.1
> |
> | Log Message:
> | Drop redundant quoting in the nested printf example.
>
> I don't think that is correct, the quotes around 0x0A were obviously
> redundant (and changing it to 0x0a doesn't alter that), but those
> around the $(printf ...) are not - without those the result from the
> command substitution would be subject to field splitting, and if IFS
> happens to contain a \ or an octal digit, bad things will happen.
>
> In general it is never a good idea to omit quotes around sh word
> expansions except in the cases where you actually want field splitting
> (or pathname expansion, etc) to happen (and sometimes except in the
> contexts where those don't occur anyway, like x=$whatever)
>
> For the example in question, try running it with IFS=1 or IFS=2
> to see what I mean.
Right, but I'd expect people that actually use IFS with octal digits
or a backslash to also understand and know how to add necessary
quoting in that case. Though perhaps it makes sense to them back for
pedagogical purposes.
-uwe
Home |
Main Index |
Thread Index |
Old Index