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é <phi...@redhat.com>
> ---
> 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