GNU bug report logs -
#20733
coreutils build problem
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Thu, 4 Jun 2015 19:18:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #37 received at 20733 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 06/04/2015 02:59 PM, Eric Blake wrote:
>>> +good:
>>> + @@list='$(list)'; for arg in $$list; do echo $$arg; done
>> [...]
>>
>> Another option is to use:
>>
>> for arg in $${-+$(list)}; do echo $$arg; done
> Furthermore, your suggestion mishandles a list with a bare }, whereas
> mine does not. "make good list='} a'" should output $'}\na\n', not $'a}\n'.
Of course, your version has the benefit of preserving a list that
contains shell quoting (such as list = "a b" intended to produce a
single string $'a b') while mine eats it early (producing $'"a' and
$'b"'). But remember that my example is written in a context of
makefiles, where makefile variables tend to be designed to be split at
all whitespace boundaries and do not have an easy mechanism for handling
text that must have specific embedded spacing, and as such are unlikely
to require shell quoting in the first place.
Once again going to show that you have to think about each particular
problem in context (what sort of input will it be processing), rather
than blindly assuming that one formulation will be a catch-all solution.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 10 years and 49 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.