[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: fix non POSIX constructs causing failures with dash
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] tests: fix non POSIX constructs causing failures with dash |
Date: |
Tue, 19 May 2015 14:04:31 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 19/05/15 13:45, Mike Frysinger wrote:
> On 19 May 2015 12:42, Pádraig Brady wrote:
>> * tests/cp/no-ctx.sh: Scope of `var=val func` is inconsistent
>> across shells, so avoid that construct with functions.
>
> i think POSIX requires the behavior dash exhibits, and bash will do the same
> when it's in POSIX compliant mode.
Right http://pubs.opengroup.org/onlinepubs/9699919799//utilities/read.html
>
>> -LD_PRELOAD=./k.so returns_ 1 cp --preserve=context file_src file_dst ||
>> fail=1
>> +( LD_PRELOAD=./k.so; export LD_PRELOAD;
>
> there is no need to split these into two statements. if you're using
> `checkbashisms`, that script is outdated and should be taken with a grain
> of salt.
I was being paranoid. Though we do use a mixture of the above older style
and the newer `export LD_PRELOAD=./k.so` form. I'll change to the newer form.
>> --- a/tests/df/no-mtab-status.sh
>> +++ b/tests/df/no-mtab-status.sh
>> @@ -88,34 +88,38 @@ EOF
>> gcc_shared_ k.c k.so \
>> || framework_failure_ 'failed to build shared library'
>>
>> +cleanup_() { unset LD_PRELOAD; }
>
> if you're just going to unset it, why not do just this ? the rest of the
> changes need not be made.
> -mike
cleanup_() is called after by the test framework.
The other adjustments are to move the LD_PRELOAD
setting global to the script, rather than to each command.
thanks for the review!
Pádraig.