From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id AFNZHDmKr2LbWgAAbAwnHQ (envelope-from ) for ; Sun, 19 Jun 2022 22:42:33 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2MlvGzmKr2L85AAAG6o9tA (envelope-from ) for ; Sun, 19 Jun 2022 22:42:33 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EF6FB2B0B7 for ; Sun, 19 Jun 2022 22:42:32 +0200 (CEST) Received: from localhost ([::1]:49648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o31ke-00063u-3J for larch@yhetil.org; Sun, 19 Jun 2022 16:42:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o31kB-00063O-66 for bug-guix@gnu.org; Sun, 19 Jun 2022 16:42:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o31kA-0005Ep-UR for bug-guix@gnu.org; Sun, 19 Jun 2022 16:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o31kA-00012x-RG for bug-guix@gnu.org; Sun, 19 Jun 2022 16:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#53355: guix shell --check: confusing error message Resent-From: Chris Marusich Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 19 Jun 2022 20:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53355 X-GNU-PR-Package: guix X-GNU-PR-Keywords: moreinfo To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 53355@debbugs.gnu.org, 51466@debbugs.gnu.org Received: via spool by 53355-submit@debbugs.gnu.org id=B53355.16556712643942 (code B ref 53355); Sun, 19 Jun 2022 20:42:02 +0000 Received: (at 53355) by debbugs.gnu.org; 19 Jun 2022 20:41:04 +0000 Received: from localhost ([127.0.0.1]:53294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o31jE-00011Q-6v for submit@debbugs.gnu.org; Sun, 19 Jun 2022 16:41:04 -0400 Received: from mail-pj1-f53.google.com ([209.85.216.53]:45852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o31jC-00010N-UC; Sun, 19 Jun 2022 16:41:03 -0400 Received: by mail-pj1-f53.google.com with SMTP id t3-20020a17090a510300b001ea87ef9a3dso8462834pjh.4; Sun, 19 Jun 2022 13:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=1FmFGA4oAMyTjtZLdLSKGtGhb1FiM10alkocvBJMFrU=; b=D+50OsczFpLqqcuevdsBK0GueC07mr36hWNDgyKqxKhSwaULoTJaov/CW4fbyxzQKb +bPQR8xAuOnekGyTQ6cPkrsl9q/Bn20iPzesTsUt6s5Dl4aSo9RhyrsIrMatW+sqI0Jh jjHt3f7oxwYFz3Ths7IGo7oygbNEDVX12edpXtWB4bHRbU1CdSAr6nqViIvbYcod/Pjf 9KtPb2GCBADO7sGcBLxH4691AzhMQfaGvnGE9XbU2NiN3nwec9lWOh6U4jmYYE+nOkzo dLnQaL3Prk1JDQqefLiXgRGFJ/hYHCuUMiXVAI6f9HopLl/r++twYidFViKX/GEoSf1T FQEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=1FmFGA4oAMyTjtZLdLSKGtGhb1FiM10alkocvBJMFrU=; b=iUp48v0Tiu59NJWeryhX30xS15pMrWKQGGqFWHJvqqjrrMwf9nekJwtPY9+x78B8SO 4iN0ivn6WT4pQhtydXXom8ZqDJOaj6Y5RKZS9GXJ3AFNLNZQPyQhm3SUrs2QZFPCQsXm i/wrqvL1TB2J53sUrIcTz82mtlZGDbfYdtn0DrUHPn9IIvNcxtzCd+UBbTCnMdKDbPxt RavmV3bVvX2x69DSk7iFRNvXeBzIhAR0vF38ytFQT31lvN3myUH5cL7DNWl53bEVyIhi TNLC5FkBCujbVV5mItMRCGiKo8RkPUxm9QBDWbjRCn15t6Pn5Pf+NpHSHdCCd7F9gF1w T96w== X-Gm-Message-State: AJIora+SutH+s/GFTdjLCCUInePJFPyMqP29G3BQe585+Cs6uusYKFti ba+U/boTjc/yEGYYayXky2Yd25g8gEA= X-Google-Smtp-Source: AGRyM1vBke6apiexPMN0L2U8j5js1C2Z14Yx/lMKs7k1TbU/yNefETE3iuOBLDVyo2wYx076T9GAKg== X-Received: by 2002:a17:902:cec2:b0:166:4e45:e1b2 with SMTP id d2-20020a170902cec200b001664e45e1b2mr20576692plg.73.1655671256404; Sun, 19 Jun 2022 13:40:56 -0700 (PDT) Received: from fedora (c-71-231-157-28.hsd1.wa.comcast.net. [71.231.157.28]) by smtp.gmail.com with ESMTPSA id iy20-20020a170903131400b0016a04b577f1sm5058913plb.246.2022.06.19.13.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 13:40:55 -0700 (PDT) From: Chris Marusich References: <87h7a08kub.fsf@gmail.com> <87lez5td4n.fsf@gnu.org> <87sftc4osu.fsf@gmail.com> <87h79slysd.fsf@gnu.org> <87sft13dyv.fsf@gmail.com> <874k59d802.fsf@gnu.org> <87wnhy2w73.fsf_-_@gmail.com> <878rudzsmv.fsf@gnu.org> <87sfozzglf.fsf_-_@gmail.com> <871qvsubgv.fsf@gnu.org> Date: Sun, 19 Jun 2022 13:40:50 -0700 In-Reply-To: <871qvsubgv.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 13 Jun 2022 12:03:28 +0200") Message-ID: <87k09cpest.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655671353; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=1FmFGA4oAMyTjtZLdLSKGtGhb1FiM10alkocvBJMFrU=; b=ikgaIeCjs1dSKBT3g1N1nbbu1lqOFoMwxx2ODOT/WhljorCWeG7PSED7ZDR1uhzeXld4DS hEZKXdrHwaMOwgc8NkEHF1OQtbnGGxtj81CkMvm63CxBofKV9SOkYN07pDP9CywylmK6X+ MQtYdUPrhXNK4cn5/fMe5vorpHh1wfRxKy60Q+nNZ6KYxmBVeFcnjm65cH2H5DYupoqICU 4DUXGWLEuumGVS+7ddcxa0TXmPhwHiATRZcYXLn7bDWlPSn0qxwpTARrt1lgQzIChBhuy5 iiprElIrlF4t68PxpTNBEbn67HyZRBk3QzouLan031L0/eF1MueAl39rHqrIAg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655671353; a=rsa-sha256; cv=none; b=AFWItAn/731XCJPoye6wIy+NDibr1rh6o0Oq+Bi7ZJPg+9ngGdG7e97hXLTHlqg7piKQ4T lY4CdU7LwiT+KUTlFhqb5+e1UYFNtnH89so7ToukaQpnKDboHzHLabeup5vayuWk44gqka Xz2InhRD1xeLqkB4WitrTDqUZdFQG/kN6Zt0s7IlSFkRc4IQJguuOTDxIPr3QiVlZecalJ 21J187FptR86NGIaSOdxh5tQ0IeTmwoTTBTXmQqsfTxiDdb8HzmDPxwKXlD/8xBD07CHqt VcgnH2faMcCznXNUhUkWpnxlsgrWo/bl6RCIEHLfJB/4nOaIvNGVlC+zjD+4DA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=D+50Oscz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=D+50Oscz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EF6FB2B0B7 X-Spam-Score: 3.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: yCEcBcB8m2fJ --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, Thank you for the review! Ludovic Court=C3=A8s writes: > LGTM, please push! Before pushing, I did some more tests to make sure it was still working. When I did this, I noticed that read-line was no longer returning strings that end in "\r". This prevents child-shell-environment from behaving correctly, since it incorrectly assumes that all the lines end in "\r", stripping it off unconditionally. In the past, I'm sure read-line was returning strings that end in "\r". I don't know what changed, but I've attached a second patch that fixes this issue, also. Unless you have more feedback, I'll go ahead and push both patches to master in a few days. =2D-=20 Chris PGP: https://savannah.gnu.org/people/viewgpg.php?user_id=3D106836 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-environment-Don-t-assume-that-lines-have-a-trailing-.patch Content-Transfer-Encoding: quoted-printable From=20c4fee9e63f8cb694de86ae46bd1e2e4c692eb6f6 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Sun, 19 Jun 2022 13:16:04 -0700 Subject: [PATCH] environment: Don't assume that lines have a trailing "\r". I've noticed that the child-shell-environment procedure is misbehaving on my computer because the lines returned by read-line do not have a trailing "\r= ". In the past, I recall that such lines did in fact have a trailing "\r". I'm not sure why it changed, but it seems prudent to just rewrite this code to tolerate both cases, since it seems that both cases can happen. * guix/scripts/environment.scm (child-shell-environment) [lines]: Instead of checking if the line exactly matches "GUIX_CHECK_DONE\r"; check if the line begins with "GUIX_CHECK_DONE". Instead of always stripping the trailing character from the line, only do it if the line has a trailing "\r". =2D-- guix/scripts/environment.scm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index f0cb341aab..1fb4f5b7c6 100644 =2D-- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -462,13 +462,18 @@ (define lines ;; prompt from getting mixed into what we read. (match (read-line shell-pipe-in) ((? eof-object?) (reverse lines)) =2D ("GUIX-CHECK-DONE\r" + ((? (lambda (line) + ;; The line might or might not have a tr= ailing \r. + (string-prefix? "GUIX-CHECK-DONE" line))) (display "done\n" port) (reverse lines)) (line =2D ;; Drop the '\r' from LINE. =2D (loop (cons (string-drop-right line 1) =2D lines)))))))) + ;; Strip the trailing '\r' from LINE if prese= nt. + (let ((stripped-line + (if (string-suffix? "\r" line) + (string-drop-right line 1) + line))) + (loop (cons stripped-line lines))))))))) (close-port port) (close-port shell-pipe-in) (waitpid pid) =2D-=20 2.34.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAmKvidMVHGNtbWFydXNp Y2hAZ21haWwuY29tAAoJEN1AmhXYIkadCbEP/ixl02qd6fKeuKSLzJq+FDSMRNqs sn4EYxszto77JYFsnHwdIAfMK9kDrZxHqfY9IBLlKS6eUymNFGJs2o64FqezqLOj bWcneKhUr72BwAzzhstiToRv3CuILB0gyLtTuFWFk/B5+n1zCuNicZ4XKnULChA1 13IyWv/xXZNi2kpa9JVk+Q4y8DHs24O7SsN0C5lKKC7On7aOXaoMd+jE89q84Ick kzqqXogu04WsxmNhXrgWBq3ByvJjAaL9k8ReoB0rIO3kGj+yNn9shItCti9cGqDb 0pqaedQaidBztol6LIgf3HdZ8sqwhU7bg0ibkpWqXJZte11veFutgXZi/x0kHPo5 /5NmfyPW1ErWBloaUCz6VNZfpPokDbjKtinLntIe+DvNmxqwa3niWZLbWYTbVqO0 dIM4CU5B17cpjhXZR5ApSJv+TpvET7HqmT7EV0dOwsq5YgNliB2ZxM3i2EQC6ZxQ ASMj1A+gL0vg3ZSgzkad+EwZXHMw5ksPYdWzqyvpNlfXd4PaOVHxxHnlpXnimhh3 BPZdbcf41P6UV2q7sTQBsLKsj7sNkJN1yCnk0kSIZUuWw5bn4WFRNs5dJmIjKeo9 bQe3EVLISSl1rOB+Fj6VF1dcv8VtNqmEGOyjNvz5BcufhV+JPsw3PPaQYgXxZx1d p7QRW97iTH6UmKBm =Ni0q -----END PGP SIGNATURE----- --==-=-=--