From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Vong Subject: bug#29826: nondeterministic Broken pipe Date: Mon, 25 Dec 2017 22:02:58 +0800 Message-ID: <87608uaorx.fsf@gmail.com> References: <874lohdwhb.fsf@gmail.com> <87d133lqsb.fsf@netris.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eTTMN-0001n3-M9 for bug-guix@gnu.org; Mon, 25 Dec 2017 09:04:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eTTMI-0001oj-LO for bug-guix@gnu.org; Mon, 25 Dec 2017 09:04:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:42552) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eTTMI-0001oU-GK for bug-guix@gnu.org; Mon, 25 Dec 2017 09:04:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eTTMI-0002QY-5E for bug-guix@gnu.org; Mon, 25 Dec 2017 09:04:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87d133lqsb.fsf@netris.org> (Mark H. Weaver's message of "Sun, 24 Dec 2017 17:11:48 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Mark H Weaver Cc: 29826@debbugs.gnu.org --=-=-= Content-Type: text/plain Mark H Weaver writes: > Alex Vong writes: > >> I get the following error when running ``guix --version | head -n 1''. I >> can get similar after replacing ``--version'' with ``--help''. Also, the >> error is nondeterministic. Any idea? > > Attempts to write to a pipe that has already been closed on the other > end results in EPIPE. From the write(2) man page: > > EPIPE fd is connected to a pipe or socket whose reading end is closed. > When this happens the writing process will also receive a > SIGPIPE signal. (Thus, the write return value is seen only if > the program catches, blocks or ignores this signal.) > > In this case, there's a race condition. The result depends on whether > "head -n 1" closes its end of the pipe before or after "guix --version" > is finished writing all of its output. If "head -n 1" closes the pipe > first, then "guix --version" will receive EPIPE while attempting to > write to it. > > What normally happens is that the sending process receives SIGPIPE, > which simply causes it to exit prematurely without ever receiving this > error. However, since Guix arranges to ignore SIGPIPE in > 'initialize-guix' in guix/ui.scm, we receive EPIPE. > > That's what's happening here. I'll need to think on how best to fix it. > > Regards, > Mark Nice explaination as always! I forget to mention that I reported a bug of similar flavour before . I agree that thought is needed to fix all instances of this type of bug. Cheers, Alex --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEdZDkzSn0Cycogr9IxYq4eRf1Ea4FAlpBBRMACgkQxYq4eRf1 Ea7WKBAAq2tmAVBLOBX36icO3f8qb+9YsUvhrilqbLCa00uLCyUyN7PLp2vvlwPu U5Jo7cXw3OgifmqplbIiaVvyhJQwA2Rvlzfyw3Xi05z2NNX7dOOFA0LBLo3+ieE8 EUugVPbIJQJRTj1yFBQq56w+f62Ze95MFhn6efmHqAvCDjP6eG0QNyxq5P/Q8R3A 7p8LACieqz9xYQsKk7PVLDXxsCFiF3RaVB+hOZa6d7aYBCXejvQvBVSkNsJSd6hV SC7sm7PX96UA6I4mue3jVFV7Wv/HQMYn9uaTFfs8OLI+3nwbOvhvhJrgyGcamuep WPG9Ghko4RUbm7/AVzwZ2C2I/o5z4wPEaDfmLqhH0NXx3SJu0htMw2as8lys9/LF JfunT5pmPtZGC8jLMUMz2kf+mJhGsYuhmNsCbC9QXQD8OuzO8XrZuWHt+blmRt8C uQjUodrqXDFz5ZfqFMuk/MevikR6oxQ7xO0RGYGuqj8Nyju9+Y+V7DHgffG0RVi3 LdvYv5PEyzeS6xbM4gsjKpB+ExDcgWIU+iooNoGA7gZs58vXvqOHvnBtuhU3fY2N YQgnjLp4NLvqRulDQ7JobxsPfelzqqQ1OZNz/EtJBsl1yGz6kndsUuogtcPblKkD uyLuj+IeNxy0CnFkVKMEuZgI8v+Kt9tKOXsuuBiFuIBFpH4wOgA= =DDTi -----END PGP SIGNATURE----- --=-=-=--