[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19614: make dist exits succesfully even when tar exits with error
From: |
Eric Blake |
Subject: |
bug#19614: make dist exits succesfully even when tar exits with error |
Date: |
Fri, 16 Jan 2015 09:47:51 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
On 01/16/2015 08:01 AM, Dimitrios Apostolou wrote:
> (Please keep me CC'd as I'm not subscribed.)
In general, GNU list policy is to reply-to-all, precisely so you don't
have to leave disclaimers like that :)
>
> Hello list,
>
> as the title says, I believe running "make dist" should fail when tar
> fails. The problem is that because there is a shell pipeline with gzip,
> the exit code of the pipeline is 0. I'm not aware of a portable way to
> fix this (named pipes maybe?), but most convenient would be bash's "set
> -o pipefail".
Alas, pipefail is not portable.
>
> Relevant output from "make V=1 dist":
>
> tardir=cfengine-3.7.0a1.5ffcc54 && tar --format=ustar -chf - "$tardir" |
> GZIP=--best gzip -c >cfengine-3.7.0a1.5ffcc54.tar.gz
It is portable to do something hairy like:
{ tar ...; echo $? > file; } | gzip ...
inspect file
It is even possible to avoid an intermediate file with even hairier exec
operations to shuffle fds around.
It may be simpler to break things into two steps, with an intermediate
file instead of a pipeline, although I'm not sure it would be efficient.
But you definitely make a point that we should fix things to detect tar
failure.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature