automake-patches
[Top][All Lists]
Advanced

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

Re: [RFC 05/20] depcomp: safer quoting in variable expansion


From: Peter Rosin
Subject: Re: [RFC 05/20] depcomp: safer quoting in variable expansion
Date: Fri, 19 Oct 2012 08:36:04 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 2012-10-19 07:39, Pavel Raiskup wrote:
> Hi,
> 
> On Thu, 2012-10-18 at 22:40 +0200, Stefano Lattarini wrote:
>> * lib/depcomp (pgcc): Here.  Probably not needed, but since the
>> rest of the script seems to employ proper quoting, better to be
>> consistent.
>>
>> Signed-off-by: Stefano Lattarini <address@hidden>
>> ---
>>  lib/depcomp | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/depcomp b/lib/depcomp
>> index dbcacd0..2f0c6c5 100755
>> --- a/lib/depcomp
>> +++ b/lib/depcomp
>> @@ -358,24 +358,24 @@ pgcc)
>>    lockdir=$base.d-lock
>>    trap "
>>      echo '$0: caught signal, cleaning up...' >&2
>> -    rmdir $lockdir
>> +    rmdir '$lockdir'
> 
> here seems to be problem,

No, because the whole thing is inside double quotes, like this...

$ bash
$ lockdir="foo   foo"
$ trap "echo '$lockdir'" 0
$ exit
exit
foo   foo
$ 

...which looks much better than the preexisting version...

$ bash
$ lockdir="foo   foo"
$ trap "echo $lockdir" 0
$ exit
exit
foo foo
$ 

...but '$lockdir' sure looks odd, maybe this pattern is better?

$ bash
$ lockdir="foo   foo"
$ trap "echo \"$lockdir\""
$ exit
exit
foo   foo
$ 

Admittedly it requires escapes, but it doesn't look as
odd on first glance and therefore isn't as susceptible to
some later unwelcome "fixups" (classified as trivial).

On the other hand, there's the preexisting $0 also inside
single in that very same trap. All in all, I'm happy with
this patch as is. It's a definite improvement.

Cheers,
Peter




reply via email to

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