From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 QCDRLWNIsGIsGQAAbAwnHQ (envelope-from ) for ; Mon, 20 Jun 2022 12:13:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 2LWtLWNIsGKCMwEA9RJhRA (envelope-from ) for ; Mon, 20 Jun 2022 12:13:55 +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 29859A322 for ; Mon, 20 Jun 2022 12:13:55 +0200 (CEST) Received: from localhost ([::1]:40732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3EPq-0003c6-9K for larch@yhetil.org; Mon, 20 Jun 2022 06:13:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3EP0-0003av-NF for bug-guix@gnu.org; Mon, 20 Jun 2022 06:13:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3EP0-0006jA-FM for bug-guix@gnu.org; Mon, 20 Jun 2022 06:13:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o3EP0-0003Zx-AI for bug-guix@gnu.org; Mon, 20 Jun 2022 06:13:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#53355: bug#51466: bug#53355: guix shell --check: confusing error message Resent-From: bokr@bokr.com Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 20 Jun 2022 10:13: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: Chris Marusich Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 53355@debbugs.gnu.org, 51466@debbugs.gnu.org Received: via spool by 53355-submit@debbugs.gnu.org id=B53355.165571995813718 (code B ref 53355); Mon, 20 Jun 2022 10:13:02 +0000 Received: (at 53355) by debbugs.gnu.org; 20 Jun 2022 10:12:38 +0000 Received: from localhost ([127.0.0.1]:54436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o3EOc-0003Z6-Bs for submit@debbugs.gnu.org; Mon, 20 Jun 2022 06:12:38 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:44460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o3EOY-0003Yj-Ek; Mon, 20 Jun 2022 06:12:36 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id B798461D76; Mon, 20 Jun 2022 10:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=bokr.com; s=easymail; t=1655719948; bh=2sveoYcOrAXCbu66Lcz+YQA+rm7eOZZ8Y+bZIah7Ink=; h=From:Date:To:Cc:Subject:References:In-Reply-To:From; b=RAIxWx15cUc5Cl3qTm+pncCSa2S5+kS/zZvoVBZ7xBrK1dsSLCBR8OpNqEyNxrgXU XCdc2lK9Lxte4LaOSJ/dtZmraJ/k0wDfzJSlxS4rK3xsnW2KmpBGhl2F83xt9156CH J/bzczT0YNoV/ixlNP1waoq1EUxh/az2Ix+gg2iYt4Dm0IJsSxd7fRtKGm8AwD9XGp /ePMGoBMO/UlCg9wwf5XKPVxblk6Y7JTYAZIrONfbsyylTjjK2K4qGvGkb+pSLZouO oy0XvTCB6B+QoEhx+GkpA0lJnScp/VQuOuE9tapwSWE3RVYeeyaq7+ta/xCQKDC0Yv cvsyTNS0p3S4w== X-Virus-Scanned: Debian amavisd-new at emo09-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo09-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yuE3T0keRJ6A; Mon, 20 Jun 2022 10:12:28 +0000 (UTC) Received: from localhost (m90-129-192-219.cust.tele2.se [90.129.192.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id D5E6D61C94; Mon, 20 Jun 2022 10:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=bokr.com; s=easymail; t=1655719948; bh=2sveoYcOrAXCbu66Lcz+YQA+rm7eOZZ8Y+bZIah7Ink=; h=From:Date:To:Cc:Subject:References:In-Reply-To:From; b=RAIxWx15cUc5Cl3qTm+pncCSa2S5+kS/zZvoVBZ7xBrK1dsSLCBR8OpNqEyNxrgXU XCdc2lK9Lxte4LaOSJ/dtZmraJ/k0wDfzJSlxS4rK3xsnW2KmpBGhl2F83xt9156CH J/bzczT0YNoV/ixlNP1waoq1EUxh/az2Ix+gg2iYt4Dm0IJsSxd7fRtKGm8AwD9XGp /ePMGoBMO/UlCg9wwf5XKPVxblk6Y7JTYAZIrONfbsyylTjjK2K4qGvGkb+pSLZouO oy0XvTCB6B+QoEhx+GkpA0lJnScp/VQuOuE9tapwSWE3RVYeeyaq7+ta/xCQKDC0Yv cvsyTNS0p3S4w== From: bokr@bokr.com Date: Mon, 20 Jun 2022 12:12:10 +0200 Message-ID: <20220620101210.GA19777@LionPure> References: <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> <87k09cpest.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87k09cpest.fsf@gmail.com> https: //lwn.net/Articles/892755/https://lwn.net/Articles/892755/ttps://lwn.net/Articles/892755/ User-Agent: Mutt/1.10.1 (2018-07-13) 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=1655720035; 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: content-transfer-encoding:content-transfer-encoding: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=FGUG5gQTN8fWxu12bi+DOm7e+sSpv1u+Cl3TuQ5kZdg=; b=h8k1owcabdI8xw4QzpDXbqJw8GOo31DLoimomwFaZPPv3FC7WPFxc+DXUlnye8uEPbhYJh PY7KA1xTo3D3qN/Jw/B9wTys5j/Lee4yjpm/Anl1wJ1cwqqb1/uurLzTQHMjpy6ey9ekXr RLkH3XJKK0+gDvMdV2U1qcRjJE9/ET3ff8S62su9nzkUWWU1cJLO4awMT6msSDtaLj+ZVe SYguOq/bat4mBFIXCeKnuvux+4lXolJEkpRp9K+26zbc+TUepAmtSSOJ3Vq9ezBgBxKSpU v+yFljSbJyj1emDwKyPhfhTpJMq4KQQS+UNPEYG/8CFvVQS2ontCKchPcpFYPw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655720035; a=rsa-sha256; cv=none; b=GcnG7yVcT8dTeOfPdEaLF1EMebt1qSzr7Js7ZT8o4/50I+cWSyD7XyVyEoQNHRkAKA3PXp tL7VRdwGP0AuZRYe2DW1fYavn7vX4sExFBgo2SpOtuOhvZ2cDQ5mUPus7Ipb+OuofjbULa LLOqOXqoU4ARqJEHrPB2z+hzB9YDRWVGlM71UPCYeAFusiN3E3IkBbAd0oVNRjGzISug8k vVlqbSRWSZJmoGcER6cHjpCtS7YA4RRmgtKYF58ZTGVVp8oI5s6ZPi5fdm9gLSzjAtLBER 9bU3hUveyiJWg0YhcApI1EEjpub3O3+9FrOoL1DomHubKVLZejgfMU1ginur8A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=RAIxWx15; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=RAIxWx15; dmarc=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: 1.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=RAIxWx15; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=RAIxWx15; dmarc=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: 29859A322 X-Spam-Score: 1.33 X-Migadu-Scanner: scn1.migadu.com X-TUID: QEmL/eumm4ok Hi Chris, Did you observe this behaviour inside a git repo directory? I wonder if this git security thing could be relevant: https://lwn.net/Articles/892755/ It makes also me wonder about readline completion stuff possibly interacting. Isn't that implemented with readline? I have had some mystery bash parsing errors, and I noticed set|less shows a heck of a lot of functions defined that I don't remember seeing in the past. Anyway, shouldn't stuff like that have better hygiene than just prefixed _underscore ? Or maybe set|less doesn't show all that on your system? Disclaimer: I played a lot of games trying to make stuff conditional at login, where I renamed .bash_profile and .bashrc (e.g. .my_bashrc) which brought .profile into play, and I messed with the downstream of that to source some .my_'s conditionally, so I've go a fragile mess right now ;/ Anyway, did you determine why things changed in the first place? Or will this be a whack-a-mole game with future weirdnesses? :) Semms like IWBN to have interfaces governed by contracts :) Best, Bengt Richter On +2022-06-19 13:40:50 -0700, Chris Marusich wrote: > Hi Ludo, > > Thank you for the review! > > Ludovic Courtès 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. > > -- > Chris > > PGP: https://savannah.gnu.org/people/viewgpg.php?user_id=106836 > From c4fee9e63f8cb694de86ae46bd1e2e4c692eb6f6 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". > --- > 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 > --- 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)) > - ("GUIX-CHECK-DONE\r" > + ((? (lambda (line) > + ;; The line might or might not have a trailing \r. > + (string-prefix? "GUIX-CHECK-DONE" line))) > (display "done\n" port) > (reverse lines)) > (line > - ;; Drop the '\r' from LINE. > - (loop (cons (string-drop-right line 1) > - lines)))))))) > + ;; Strip the trailing '\r' from LINE if present. > + (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) > -- > 2.34.0 >