Debian Bug report logs -
#532570
tar - relies on standard SIGPIPE behaviour
Reported by: Bastian Blank <waldi@debian.org>
Date: Wed, 10 Jun 2009 09:12:01 UTC
Severity: grave
Tags: patch
Found in version tar/1.22-1
Fixed in version tar/1.22-1.1
Done: Bastian Blank <waldi@debian.org>
Bug is archived. No further changes may be made.
Forwarded to bug-tar@gnu.org
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Bdale Garbee <bdale@gag.com>:
Bug#532570; Package tar.
(Wed, 10 Jun 2009 09:12:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Bastian Blank <waldi@debian.org>:
New Bug report received and forwarded. Copy sent to Bdale Garbee <bdale@gag.com>.
(Wed, 10 Jun 2009 09:12:04 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Package: tar
Version: 1.22-1
Severity: grave
tar is not longer able to read tar files with some garbage at the end
under some condition. If it is called from the shell, the resulting
SIGPIPE kills the called bzip2 process and tar swallows the error:
| close(3) = 0
| waitpid(18165, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGPIPE}], 0) = 18165
| --- SIGCHLD (Child exited) @ 0 (0) ---
| [...]
| exit_group(0) = ?
In the other case I call it via a python script. The python interpreter
collects SIGPIPE by default and the setting is persistent in the child
processes. So the SIGPIPE is now collected by bzip2 and converted
into an error:
| write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = -1 EPIPE (Broken pipe)
| --- SIGPIPE (Broken pipe) @ 0 (0) ---
| [...]
| exit_group(1) = ?
| close(3) = 0
| waitpid(18105, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0) = 18105
| --- SIGCHLD (Child exited) @ 0 (0) ---
| [...]
| exit_group(2) = ?
| bzip2: I/O or other error, bailing out. Possible reason follows.
| bzip2: Broken pipe
| Input file = (stdin), output file = (stdout)
| tar: Child returned status 1
| tar: Exiting with failure status due to previous errors
It seems that tar now relies on the behaviour that SIGPIPE kills the
child and therfor needs to properly set it up.
Bastian
--
You're too beautiful to ignore. Too much woman.
-- Kirk to Yeoman Rand, "The Enemy Within", stardate unknown
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to debian-bugs-dist@lists.debian.org, Bdale Garbee <bdale@gag.com>:
Bug#532570; Package tar.
(Wed, 10 Jun 2009 10:12:13 GMT) (full text, mbox, link).
Acknowledgement sent
to Bastian Blank <waldi@debian.org>:
Extra info received and forwarded to list. Copy sent to Bdale Garbee <bdale@gag.com>.
(Wed, 10 Jun 2009 10:12:13 GMT) (full text, mbox, link).
Message #10 received at 532570@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
tags 532570 patch
thanks
Patch. I cleaned the autoconf cruft from it, please fix that.
Bastian
[diff (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]
Tags added: patch
Request was from Bastian Blank <waldi@debian.org>
to control@bugs.debian.org.
(Wed, 10 Jun 2009 10:12:18 GMT) (full text, mbox, link).
Reply sent
to Bdale Garbee <bdale@gag.com>:
You have marked Bug as forwarded.
(Wed, 10 Jun 2009 13:33:04 GMT) (full text, mbox, link).
Message #15 received at 532570-forwarded@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Please comment on the attached patch from Bastian Blank regarding
SIGPIPE behavior proposed for inclusion in my Debian packaging of tar.
Bdale
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Package: tar
Version: 1.22-1
Severity: grave
tar is not longer able to read tar files with some garbage at the end
under some condition. If it is called from the shell, the resulting
SIGPIPE kills the called bzip2 process and tar swallows the error:
| close(3) = 0
| waitpid(18165, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGPIPE}], 0) = 18165
| --- SIGCHLD (Child exited) @ 0 (0) ---
| [...]
| exit_group(0) = ?
In the other case I call it via a python script. The python interpreter
collects SIGPIPE by default and the setting is persistent in the child
processes. So the SIGPIPE is now collected by bzip2 and converted
into an error:
| write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = -1 EPIPE (Broken pipe)
| --- SIGPIPE (Broken pipe) @ 0 (0) ---
| [...]
| exit_group(1) = ?
| close(3) = 0
| waitpid(18105, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0) = 18105
| --- SIGCHLD (Child exited) @ 0 (0) ---
| [...]
| exit_group(2) = ?
| bzip2: I/O or other error, bailing out. Possible reason follows.
| bzip2: Broken pipe
| Input file = (stdin), output file = (stdout)
| tar: Child returned status 1
| tar: Exiting with failure status due to previous errors
It seems that tar now relies on the behaviour that SIGPIPE kills the
child and therfor needs to properly set it up.
Bastian
--
You're too beautiful to ignore. Too much woman.
-- Kirk to Yeoman Rand, "The Enemy Within", stardate unknown
[signature.asc (application/pgp-signature, inline)]
[Message part 5 (message/rfc822, inline)]
[Message part 6 (text/plain, inline)]
tags 532570 patch
thanks
Patch. I cleaned the autoconf cruft from it, please fix that.
Bastian
[diff (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to debian-bugs-dist@lists.debian.org, Bdale Garbee <bdale@gag.com>:
Bug#532570; Package tar.
(Fri, 12 Jun 2009 19:24:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Bdale Garbee <bdale@gag.com>.
(Fri, 12 Jun 2009 19:24:04 GMT) (full text, mbox, link).
Message #20 received at 532570@bugs.debian.org (full text, mbox, reply):
Hi,
On Wed, 10 Jun 2009, Bastian Blank wrote:
> | close(3) = 0
> | waitpid(18165, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGPIPE}], 0) = 18165
> | --- SIGCHLD (Child exited) @ 0 (0) ---
> | [...]
> | exit_group(0) = ?
>
> In the other case I call it via a python script. The python interpreter
> collects SIGPIPE by default and the setting is persistent in the child
> processes. So the SIGPIPE is now collected by bzip2 and converted
> into an error:
We have had this in other packages like git-buildpackage which is also in
python (see http://bugs.debian.org/525411). The problem has been fixed in
the python script and not somewhere else.
tar and any other program (dpkg-source) should be able to rightfully make
the assumption that SIGPIPE is not modified unless it modifies it itself.
In other words, you should fix genorig.py and not ask tar to modify its
behaviour.
See
http://git.debian.org/?p=users/agx/git-buildpackage.git;a=commitdiff;h=3e4b08ed095b12675b8865893274c65782720fe6
for an example of how this got fixed in git-buildpackage.
> It seems that tar now relies on the behaviour that SIGPIPE kills the
> child and therfor needs to properly set it up.
dpkg-source relies on it too.
Cheers,
--
Raphaël Hertzog
Contribuez à Debian et gagnez un cahier de l'admin Debian Lenny :
http://www.ouaza.com/wp/2009/03/02/contribuer-a-debian-gagner-un-livre/
Information forwarded
to debian-bugs-dist@lists.debian.org, Bdale Garbee <bdale@gag.com>:
Bug#532570; Package tar.
(Fri, 12 Jun 2009 19:48:03 GMT) (full text, mbox, link).
Acknowledgement sent
to Bastian Blank <waldi@debian.org>:
Extra info received and forwarded to list. Copy sent to Bdale Garbee <bdale@gag.com>.
(Fri, 12 Jun 2009 19:48:03 GMT) (full text, mbox, link).
Message #25 received at 532570@bugs.debian.org (full text, mbox, reply):
On Fri, Jun 12, 2009 at 05:51:11PM +0200, Raphael Hertzog wrote:
> On Wed, 10 Jun 2009, Bastian Blank wrote:
> > In the other case I call it via a python script. The python interpreter
> > collects SIGPIPE by default and the setting is persistent in the child
> > processes. So the SIGPIPE is now collected by bzip2 and converted
> > into an error:
> We have had this in other packages like git-buildpackage which is also in
> python (see http://bugs.debian.org/525411). The problem has been fixed in
> the python script and not somewhere else.
Please explain.
> tar and any other program (dpkg-source) should be able to rightfully make
> the assumption that SIGPIPE is not modified unless it modifies it itself.
Please explain where this is specified. You can only rely on
_documented_ behaviour and signal(7) specifies:
| During an execve(2), the dispositions of handled signals are reset to
| the default; the dispositions of ignored signals are left unchanged.
Bastian
--
Those who hate and fight must stop themselves -- otherwise it is not stopped.
-- Spock, "Day of the Dove", stardate unknown
Information forwarded
to debian-bugs-dist@lists.debian.org, Bdale Garbee <bdale@gag.com>:
Bug#532570; Package tar.
(Fri, 12 Jun 2009 21:12:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Bdale Garbee <bdale@gag.com>.
(Fri, 12 Jun 2009 21:12:04 GMT) (full text, mbox, link).
Message #30 received at 532570@bugs.debian.org (full text, mbox, reply):
On Fri, 12 Jun 2009, Bastian Blank wrote:
> > tar and any other program (dpkg-source) should be able to rightfully make
> > the assumption that SIGPIPE is not modified unless it modifies it itself.
>
> Please explain where this is specified. You can only rely on
> _documented_ behaviour and signal(7) specifies:
> | During an execve(2), the dispositions of handled signals are reset to
> | the default; the dispositions of ignored signals are left unchanged.
Which means that if you choose to ignore signals, you must ensure that
programs that you execute are fine with this... and you can only do that
if you are also the author/maintainer of those programs. Otherwise you
should not change from the default or you should reinstate the default
value before executing subprocesses.
There is some logic behind this, exactly in the same way that you don't
reset the PATH in all applications, you trust your caller to have kept it
to a sane value...
Cheers,
--
Raphaël Hertzog
Contribuez à Debian et gagnez un cahier de l'admin Debian Lenny :
http://www.ouaza.com/wp/2009/03/02/contribuer-a-debian-gagner-un-livre/
Information forwarded
to debian-bugs-dist@lists.debian.org, Bdale Garbee <bdale@gag.com>:
Bug#532570; Package tar.
(Fri, 12 Jun 2009 22:09:02 GMT) (full text, mbox, link).
Acknowledgement sent
to Bastian Blank <waldi@debian.org>:
Extra info received and forwarded to list. Copy sent to Bdale Garbee <bdale@gag.com>.
(Fri, 12 Jun 2009 22:09:02 GMT) (full text, mbox, link).
Message #35 received at 532570@bugs.debian.org (full text, mbox, reply):
On Fri, Jun 12, 2009 at 11:04:14PM +0200, Raphael Hertzog wrote:
> There is some logic behind this, exactly in the same way that you don't
> reset the PATH in all applications, you trust your caller to have kept it
> to a sane value...
Different problem. tar relies on exceptional states of its subprocesses,
not normal behaviour.
But anyway, you are not the maintainer of tar and this is a regression.
Bastian
--
"That unit is a woman."
"A mass of conflicting impulses."
-- Spock and Nomad, "The Changeling", stardate 3541.9
Message #36 received at 532570-forwarded@bugs.debian.org (full text, mbox, reply):
Bdale Garbee <bdale@gag.com> ha escrit:
> Please comment on the attached patch from Bastian Blank regarding
> SIGPIPE behavior proposed for inclusion in my Debian packaging of tar.
It is reasonable, but it's better be done in main(). I installed the
following patch:
diff --git a/src/tar.c b/src/tar.c
index dbffc2a..e10b804 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -2454,10 +2454,10 @@ main (int argc, char **argv)
obstack_init (&argv_stk);
-#ifdef SIGCHLD
+ /* Ensure default behavior for some signals */
+ signal (SIGPIPE, SIG_DFL);
/* System V fork+wait does not work if SIGCHLD is ignored. */
signal (SIGCHLD, SIG_DFL);
-#endif
/* Decode options. */
Regards,
Sergey
Information forwarded
to debian-bugs-dist@lists.debian.org, Bdale Garbee <bdale@gag.com>:
Bug#532570; Package tar.
(Tue, 30 Jun 2009 20:42:02 GMT) (full text, mbox, link).
Acknowledgement sent
to Bastian Blank <waldi@debian.org>:
Extra info received and forwarded to list. Copy sent to Bdale Garbee <bdale@gag.com>.
(Tue, 30 Jun 2009 20:42:02 GMT) (full text, mbox, link).
Message #41 received at 532570@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Attached is the NMU diff.
Bastian
--
It is a human characteristic to love little animals, especially if
they're attractive in some way.
-- McCoy, "The Trouble with Tribbles", stardate 4525.6
[diff (text/plain, attachment)]
Reply sent
to Bastian Blank <waldi@debian.org>:
You have taken responsibility.
(Tue, 30 Jun 2009 22:06:16 GMT) (full text, mbox, link).
Notification sent
to Bastian Blank <waldi@debian.org>:
Bug acknowledged by developer.
(Tue, 30 Jun 2009 22:06:16 GMT) (full text, mbox, link).
Message #46 received at 532570-close@bugs.debian.org (full text, mbox, reply):
Source: tar
Source-Version: 1.22-1.1
We believe that the bug you reported is fixed in the latest version of
tar, which is due to be installed in the Debian FTP archive:
tar_1.22-1.1.diff.gz
to pool/main/t/tar/tar_1.22-1.1.diff.gz
tar_1.22-1.1.dsc
to pool/main/t/tar/tar_1.22-1.1.dsc
tar_1.22-1.1_powerpc.deb
to pool/main/t/tar/tar_1.22-1.1_powerpc.deb
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 532570@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Bastian Blank <waldi@debian.org> (supplier of updated tar package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Tue, 30 Jun 2009 22:23:48 +0200
Source: tar
Binary: tar
Architecture: source powerpc
Version: 1.22-1.1
Distribution: unstable
Urgency: low
Maintainer: Bdale Garbee <bdale@gag.com>
Changed-By: Bastian Blank <waldi@debian.org>
Description:
tar - GNU version of the tar archiving utility
Closes: 532570
Changes:
tar (1.22-1.1) unstable; urgency=low
.
* Non-maintainer upload.
* Set SIGPIPE to default action, patch from upstream. (closes: #532570)
Checksums-Sha1:
3938f17b2e55c09c9ef8f6eb483b456d89e4beac 945 tar_1.22-1.1.dsc
49d4176b481e15fb0e4f5eb2665fbc3dd3e49346 17793 tar_1.22-1.1.diff.gz
44406954322d91b03aea8f861d77d0a4dbd6d8d1 851444 tar_1.22-1.1_powerpc.deb
Checksums-Sha256:
06580d4474510da0bf26eb2fc456e5efeaf673ba9b9c7940b0b276e9cb99250b 945 tar_1.22-1.1.dsc
b5c08353216eca57d8e662a7d2afbce0e79fe6af8421f64977a7dc7c7934a9ed 17793 tar_1.22-1.1.diff.gz
e7a170b339bd9771ab07e2192d789320189aa9289d283b64ffc30d207010b4df 851444 tar_1.22-1.1_powerpc.deb
Files:
5e1baed4203b60a9d3f554b26199c4fc 945 utils required tar_1.22-1.1.dsc
6ef3ccbad51c99960cdd8c5c1481b309 17793 utils required tar_1.22-1.1.diff.gz
5d18f48ecd3b65ca2a665591fbe60328 851444 utils required tar_1.22-1.1_powerpc.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkpKeGUACgkQLkAIIn9ODhFa/ACg2zHFhyDvlfbc1dBQVqikRnPA
nXAAn2aqHl1/xbwyxB9SsyOC5d7U+x0T
=CdME
-----END PGP SIGNATURE-----
Information forwarded
to debian-bugs-dist@lists.debian.org:
Bug#532570; Package tar.
(Wed, 01 Jul 2009 21:27:08 GMT) (full text, mbox, link).
Acknowledgement sent
to Bdale Garbee <bdale@gag.com>:
Extra info received and forwarded to list.
(Wed, 01 Jul 2009 21:27:08 GMT) (full text, mbox, link).
Message #51 received at 532570@bugs.debian.org (full text, mbox, reply):
On Tue, 2009-06-30 at 22:40 +0200, Bastian Blank wrote:
> Attached is the NMU diff.
Thanks! I have that patch in my git tree already, but hadn't made a new
upload yet... my bad! [sigh]
Bdale
Bug archived.
Request was from Debbugs Internal Request <owner@bugs.debian.org>
to internal_control@bugs.debian.org.
(Thu, 30 Jul 2009 07:45:51 GMT) (full text, mbox, link).
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Sun Jan 7 09:24:04 2018;
Machine Name:
beach
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.