qemu-devel
[Top][All Lists]
Advanced

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

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


From: Eric Blake
Subject: Re: [Qemu-devel] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used
Date: Tue, 29 Jan 2019 16:21:44 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

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).

> +    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.


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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