qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is us


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-block] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used
Date: Tue, 5 Feb 2019 00:55:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 1/29/19 11:21 PM, Eric Blake wrote:
> On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
>> Various sed regexp from common.filter use sed GNU extensions.
>> Instead of spending time to write these regex to be POSIX compliant,
>> verify the GNU sed is available and use it.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
>> ---
>> I think the test isn't well placed in common.filter and should be in
>> common.rc, but couldn't get that working.
>> ---
> 
>> +++ b/tests/qemu-iotests/common.filter
>> @@ -23,37 +23,37 @@
>>  #
>>  _filter_date()
>>  {
>> -    sed \
>> +    ${SED} \
> 
> I might have written $SED instead of ${SED}, but that's merely
> aesthetics and not a correctness issue.
> 
> 
>> +++ b/tests/qemu-iotests/common.rc
>> @@ -17,6 +17,18 @@
>>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>>  #
>>  
> 
> If SED is inherited in the environment prior to this point,...
> 
>> +for sed in sed gsed; do
>> +    (command $sed --version | grep 'GNU sed') > /dev/null 2>&1
> 
> Why do you need command here? (It doesn't hurt, but I also don't see how
> it helps).

I copy/pasted the 'dd' use in the same file :/

> 
>> +    if [ "$?" -eq 0 ]; then
>> +        SED=$sed
>> +        break
>> +    fi
>> +done
> 
> ...but neither sed nor gsed are GNU sed,
> 
>> +if [ -z "$SED" ]; then
>> +    echo "$0: GNU sed not found"
>> +    exit 1
>> +fi
> 
> ...then you fail to diagnose that. Fix it by adding SED= prior to the loop.

Good point, thanks!

Regards,

Phil.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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