Debian Bug report logs - #697052
moreutils: 'pee' with 'echo' buggy.

version graph

Package: moreutils; Maintainer for moreutils is Nicolas Schier <nicolas@fjasle.eu>; Source for moreutils is src:moreutils (PTS, buildd, popcon).

Reported by: "A. Costa" <agcosta@gis.net>

Date: Mon, 31 Dec 2012 10:48:02 UTC

Severity: normal

Found in version moreutils/0.47

Fixed in version moreutils/0.62-1

Done: Nicolas Schier <nicolas@fjasle.eu>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#697052; Package moreutils. (Mon, 31 Dec 2012 10:48:04 GMT) (full text, mbox, link).


Acknowledgement sent to "A. Costa" <agcosta@gis.net>:
New Bug report received and forwarded. Copy sent to Joey Hess <joeyh@debian.org>. (Mon, 31 Dec 2012 10:48:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: "A. Costa" <agcosta@gis.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: moreutils: 'pee' with 'echo' buggy.
Date: Mon, 31 Dec 2012 05:45:27 -0500
Package: moreutils
Version: 0.47
Severity: normal

Dear Maintainer,

This should print 3 "foo"s, but doesn't:

	% echo foo | pee cat echo cat cat | nl -b a
	     1	
	     2	foo

Discovered the above, while trying to print "hi\nho\n":

	% echo hi | pee cat "echo ho"
	hi
	ho
	# add a 'cat' and the order changes.
	% echo hi | pee cat "echo ho" cat
	ho
	hi

HTH...



-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash

Versions of packages moreutils depends on:
ii  libc6            2.13-35
ii  libipc-run-perl  0.92-1
ii  perl             5.14.2-12

moreutils recommends no packages.

Versions of packages moreutils suggests:
pn  libtime-duration-perl  <none>
ii  libtimedate-perl       1.2000-1

-- debconf-show failed



Information forwarded to debian-bugs-dist@lists.debian.org, Debian QA Group <packages@qa.debian.org>:
Bug#697052; Package moreutils. (Tue, 11 Nov 2014 08:33:05 GMT) (full text, mbox, link).


Acknowledgement sent to Nicolas Schier <nicolas+debian@hjem.rpa.no>:
Extra info received and forwarded to list. Copy sent to Debian QA Group <packages@qa.debian.org>. (Tue, 11 Nov 2014 08:33:05 GMT) (full text, mbox, link).


Message #10 received at 697052@bugs.debian.org (full text, mbox, reply):

From: Nicolas Schier <nicolas+debian@hjem.rpa.no>
To: 697052@bugs.debian.org
Cc: "A. Costa" <agcosta@gis.net>
Subject: Re: moreutils: 'pee' with 'echo' buggy.
Date: Tue, 11 Nov 2014 09:11:33 +0100
[Message part 1 (text/plain, inline)]
Dear A. Costa,
dear Maintainer,

as soon as you delay the exit of the pipe's input command until all 
children of 'pee' are able to output the incoming data, everything 
should work as expected; the obvious example:

	(echo foo ; sleep 1) | pee cat echo cat cat

Modifying pee to delay the closing of the pipes would not be helpful.  
In my opinion it might be helpful to a simple further explanation to 
the man page and leave the sources as they are.

Kind regards,
Nicolas
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Nicolas Schier <nicolas@hjem.rpa.no>:
Bug#697052; Package moreutils. (Sun, 13 Nov 2016 23:27:02 GMT) (full text, mbox, link).


Acknowledgement sent to Ole Jørgen Brønner <olejorgenb@yahoo.no>:
Extra info received and forwarded to list. Copy sent to Nicolas Schier <nicolas@hjem.rpa.no>. (Sun, 13 Nov 2016 23:27:02 GMT) (full text, mbox, link).


Message #15 received at 697052@bugs.debian.org (full text, mbox, reply):

From: Ole Jørgen Brønner <olejorgenb@yahoo.no>
To: "697052@bugs.debian.org" <697052@bugs.debian.org>
Subject: Re: moreutils: 'pee' with 'echo' buggy.
Date: Sun, 13 Nov 2016 23:22:34 +0000 (UTC)
    (echo foo ; sleep 1) | pee cat echo cat cat

Outputs just one foo here.

I'm quite sure the issue is that 'echo' close the stream immediately, causing a SIGPIPE that kills the pee process.

The same problem happens when you want both head and tail of a large stream:

    $ seq 100000 | pee 'head -n1' 'tail -n1'
    1
    14139


Adding empty signal handler for SIGPIPE


    void handle_sig(int sig) {}

    /* ... */

           signal(SIGPIPE, handle_sig);

and simply ignoring the write error in pee.c fixes the head/tail case.

A workaround is
    
   $ seq 100000 | pee 'head -n1; cat >/dev/null' 'tail -n1'

I'm sure there are cases where one wants the SIGPIPE to abort the rest of pipes, but there should at least be an option to ignore it.



Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#697052; Package moreutils. (Tue, 20 Dec 2016 07:39:02 GMT) (full text, mbox, link).


Acknowledgement sent to Nicolas Schier <nicolas@hjem.rpa.no>:
Extra info received and forwarded to list. (Tue, 20 Dec 2016 07:39:02 GMT) (full text, mbox, link).


Message #20 received at 697052@bugs.debian.org (full text, mbox, reply):

From: Nicolas Schier <nicolas@hjem.rpa.no>
To: Ole Jørgen Brønner <olejorgenb@yahoo.no>, 697052@bugs.debian.org
Subject: Re: Bug#697052: moreutils: 'pee' with 'echo' buggy.
Date: Tue, 20 Dec 2016 08:38:05 +0100
[Message part 1 (text/plain, inline)]
Dear Ole,

> I'm quite sure the issue is that 'echo' close the stream immediately, 
> causing a SIGPIPE that kills the pee process.
>
> [...]
>
> I'm sure there are cases where one wants the SIGPIPE to abort the 
> rest of pipes, but there should at least be an option to ignore it.

thanks for your valueable pointers!  Reading pipe(7) confirms your 
statement about SIGPIPE.  If there wasn't the backward-compatibility 
issue, I would like to see 'pee' to always ignore SIGPIPE and write 
errors to pipes.

I am going to forward a patch suggestion to Joey (upstream).

Kind regards,
Nicolas
[v1-0001-pee-ignore-SIGPIPE-and-write-errors---simple.patch (text/x-diff, attachment)]
[v2-0001-pee-ignore-SIGPIPE-and-write-errors---dirty-non-getopt.patch (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Nicolas Schier <nicolas@hjem.rpa.no>:
Bug#697052; Package moreutils. (Tue, 20 Dec 2016 19:12:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ole Jørgen Brønner <olejorgenb@yahoo.no>:
Extra info received and forwarded to list. Copy sent to Nicolas Schier <nicolas@hjem.rpa.no>. (Tue, 20 Dec 2016 19:12:03 GMT) (full text, mbox, link).


Message #25 received at 697052@bugs.debian.org (full text, mbox, reply):

From: Ole Jørgen Brønner <olejorgenb@yahoo.no>
To: Nicolas Schier <nicolas@hjem.rpa.no>, "697052@bugs.debian.org" <697052@bugs.debian.org>
Subject: Sv: Bug#697052: moreutils: 'pee' with 'echo' buggy.
Date: Tue, 20 Dec 2016 19:08:09 +0000 (UTC)

> I am going to forward a patch suggestion to Joey (upstream).


Thanks!

Best regards
Ole Jørgen Brønner



Reply sent to Nicolas Schier <nicolas@fjasle.eu>:
You have taken responsibility. (Sun, 08 Apr 2018 10:33:36 GMT) (full text, mbox, link).


Notification sent to "A. Costa" <agcosta@gis.net>:
Bug acknowledged by developer. (Sun, 08 Apr 2018 10:33:36 GMT) (full text, mbox, link).


Message #30 received at 697052-close@bugs.debian.org (full text, mbox, reply):

From: Nicolas Schier <nicolas@fjasle.eu>
To: 697052-close@bugs.debian.org
Subject: Bug#697052: fixed in moreutils 0.62-1
Date: Sun, 08 Apr 2018 10:22:01 +0000
Source: moreutils
Source-Version: 0.62-1

We believe that the bug you reported is fixed in the latest version of
moreutils, which is due to be installed in the Debian FTP archive.

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 697052@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Nicolas Schier <nicolas@fjasle.eu> (supplier of updated moreutils 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@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Fri, 06 Apr 2018 22:21:07 +0200
Source: moreutils
Binary: moreutils
Architecture: source amd64
Version: 0.62-1
Distribution: unstable
Urgency: medium
Maintainer: Nicolas Schier <nicolas@fjasle.eu>
Changed-By: Nicolas Schier <nicolas@fjasle.eu>
Description:
 moreutils  - additional Unix utilities
Closes: 697052 867167 885221 893880
Changes:
 moreutils (0.62-1) unstable; urgency=medium
 .
   * New upstream version (0.62):
     + chronic: Flush output more often to better preserve stdout,err ordering.
     + ts: Add -m option to use monotonic clock.
     + ts: Added %.T format like %T but with hi-res.
     + pee: Ignore SIGPIPE and write errors caused by the command not
       consuming all its input. Closes: #697052
     + chronic: document return value semantics of -e option. Closes: #867167
     + vidir: reword man page to more explicit mention 'file' args.
       Closes: #885221
     + pee: Don't buffer input, bringing behavior into line with tee.
   * Remove obsolete is-utf8 patch
   * Mark moreutils Multi-Arch: foreign. Closes: #893880,
     thanks to Helmut Grohne <helmut@subdivi.de>
   * debian/copyright: update URI: http → https
   * Bump standards to 4.1.3 (no changes required)
   * Use debhelper 11
   * debian/rules: use dpkg-buildflags for hardening
   * parallel: fix minor typo (patch)
   * Use https in homepage URI
   * is_utf8: fix allow-hardening-flags patch
   * Override lintian tag hardening-no-fortify functions for usr/bin/ifne
Checksums-Sha1:
 be7f1cbe8cab4cef06acd76f346c446be24f0d63 1783 moreutils_0.62-1.dsc
 e1167351127aad1d661b987245e619f737a2fc0c 80364 moreutils_0.62.orig.tar.xz
 a7cbd043381c8e6e07b731b8b765dd2a5feed83e 11008 moreutils_0.62-1.debian.tar.xz
 13fe57d982c6ff847e07344da95ed4d36e99d8ea 65932 moreutils-dbgsym_0.62-1_amd64.deb
 9f811130bbf955f16a9855d32245efb6b987e4b6 5905 moreutils_0.62-1_amd64.buildinfo
 beb0c50b74b4b13fa417b6ddae42853f91c703cd 73108 moreutils_0.62-1_amd64.deb
Checksums-Sha256:
 84cd89f47f6af51cf958499dde292c83e4f855f4c5af6f614547094aae78b045 1783 moreutils_0.62-1.dsc
 ffd0bfb2e490db63355e1a7d168c6f3f9802ee2c5e80880ca632e603b4b67d88 80364 moreutils_0.62.orig.tar.xz
 9b362cfac2f38af04e65c21a2405edd6cf46ce4fa2bdc48dd733a97f2f729899 11008 moreutils_0.62-1.debian.tar.xz
 ae20dea5bbda385cf15d6ccfebacf0fdf95dcbd942addc1ccaa590c6dba54b47 65932 moreutils-dbgsym_0.62-1_amd64.deb
 f025b08532c1a867ed6c864e9e53f07474d18b2bd3eb3d18a6357bd42ccc756a 5905 moreutils_0.62-1_amd64.buildinfo
 8580d25b422ad871f82f50329c01e8d7b25619b52139b21694050ac93191387e 73108 moreutils_0.62-1_amd64.deb
Files:
 9a780d6bba20bb3344e379fed4712c10 1783 utils optional moreutils_0.62-1.dsc
 8f083914757e624cc73289016a6f3d87 80364 utils optional moreutils_0.62.orig.tar.xz
 e298e05ca4e2a091608b726ff2492277 11008 utils optional moreutils_0.62-1.debian.tar.xz
 6f30b237b3589a7bc6c90b24bfb3c291 65932 debug optional moreutils-dbgsym_0.62-1_amd64.deb
 9768bd0289959f4e6545bd51c2744f21 5905 utils optional moreutils_0.62-1_amd64.buildinfo
 905140fefe92c6bed4c97c8530b3ba71 73108 utils optional moreutils_0.62-1_amd64.deb

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEfAcX+forK514ixQbptwk2dokk9EFAlrJ5xcACgkQptwk2dok
k9HJNg//aRLIJBV4GFh+e6vn092mg80w6NrtQtCQJGhwBG0rHkjQDxEO3iSeVK/2
W7WRQDXyOV9rzTbmnUpUB3mH0+OGGhJyDNVlGThiAI5gnTx3O4iHBIjMXkjrYaQw
RUiU7MEx4YaEt08TUU43qcqDGnDwqRCJgVdf3rlNEyQ3/N1TVNdrN8+xJlVZxLZ2
ENDYrPktdRYV6QEhcOhpDP14b/xepp3Bx8AazGhsozW/GXnZKO4G0J2ceQm2L0vt
ajC73mGHUzAwry1RjfQr+jogI0E9jG6HtZW3Ci+RSmzEHoBohcSvxTFz1RcNE1Xj
JiZEMBssueioCaN7rwzmosyFcFx1WaIJrP2TJyywrmeC9d0uBmrPmBCblj2MxKa/
Y9EZhR98doP/ieiernHwHKZ/+zc8A5PROlVwOtHX9T+qtp+zh3SqZ8auWeY/NXfz
+Wtw3TAGbeTFJYHQV/idQmqtqpttlBOmyM1+hd25PjVWqX/0p5CN8Q68Hsi8KMGU
BMQ2UfJ4C2jc+qr9IFx/DyXT26jVbBQ9OahZNzk8JNorcCZhDIPGXBcvzkHlRjj1
4LHQeBO57MOvPR/SLg4Va+9iIrYiqYRbqUzYYhLVzJbL3g7Xmkcn+bgBpn943Or1
zC2UPc2KB/fnnLZJHboAZdrVCULsyPiOBnXX9PCJmxGdwzEWYoU=
=YHmB
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 14 May 2018 07:30:38 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: Tue Aug 14 21:52:47 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.