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 GK2SAvkM02JbJgEAbAwnHQ (envelope-from ) for ; Sat, 16 Jul 2022 21:09:45 +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 ML1rAfkM02JY7gAAG6o9tA (envelope-from ) for ; Sat, 16 Jul 2022 21:09:45 +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 8AE5217C36 for ; Sat, 16 Jul 2022 21:09:44 +0200 (CEST) Received: from localhost ([::1]:40342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCnAd-00065o-PZ for larch@yhetil.org; Sat, 16 Jul 2022 15:09:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCn9x-00065f-7s for guix-devel@gnu.org; Sat, 16 Jul 2022 15:09:01 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:35468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCn9u-00040z-Ri; Sat, 16 Jul 2022 15:09:00 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 9C3B062905; Sat, 16 Jul 2022 19:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=bokr.com; s=easymail; t=1657998535; bh=5BcNrnuDJ5albCPApyvrWyf4PseRyD3dCFCaqj/aWpo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LjOKVn6g5ha4/q2fRWIP5TtHBgtmvdgl8zyVh63V+UKKiyoyvD5JjxZ9dejJNQlrD 0VWOl4sDDJxblbYQgwrK6vgNT1FclQJZi7uucK896wlRHVr+yUKfPQniIrdvNsqbYR SzHGUMzBfOiqwThf8TKXlj6Z9rAsbCCy392xO8XrJx/rlAq7dK33peXSlBFc1FRx7T a9U4amwNdkMQ8VpcqPtT8isxbkpsB7vV48H7ULosYClSBiQ8ROiM2FQpwJ9/NNYTQ+ OTTHsCxIYjzi+bTY2x2/vnMaqak3jhlug/Wbx6K7Q2C1S6gqZqy+xcPnDAnm7Q9uBL yyfk60ZsbHkRw== X-Virus-Scanned: Debian amavisd-new at emo07-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo07-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qc63dR5qYkmO; Sat, 16 Jul 2022 19:08:54 +0000 (UTC) Received: from localhost (m90-129-207-239.cust.tele2.se [90.129.207.239]) (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 3DDB162892; Sat, 16 Jul 2022 19:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=bokr.com; s=easymail; t=1657998534; bh=5BcNrnuDJ5albCPApyvrWyf4PseRyD3dCFCaqj/aWpo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Qwg3XtkcsTetzH6iF0zdSRWpGtpLrMe0LTOfuy6CQd6gh1iyTS9S1XWH1zvV+qurs B7sF2gKWKuZGZZg2Gu71W/EF0AmtsKmdU7+nFIqhMkFpTf3Ov88tqlOKaQ5J9L/tGX SxSUVbZN+1zrrXbkl3JgFylg8E3/oElX6FfJ1zjisEMk07GUepcSxjVjzXYifpfJap 7ksNfspKgX176q/cYerT9wuvu1daKwn0gFDc50iOZ6ZRa4KJY/xv5+LRMAGAgSQbBk Zdy4kybyJV4QZ2y5ZMTkl51uhdBzFDXuhRLKTPuWi8ynUCZ3IKCCw0FA6Zhvw5sdMC JjEmkjDPAJe3Q== Date: Sat, 16 Jul 2022 21:08:31 +0200 From: Bengt Richter To: zimoun Cc: jgart , Tobias Geerinckx-Rice , guix-devel@gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: repl macro (metacommand?) for guix CLI (sub)commands Message-ID: <20220716190831.GA5993@LionPure> References: <20220703131112.GB5967@gac> <87mtdpau7y.fsf@gnu.org> <20220704132159.GC3017@gac> <86tu7wxzpw.fsf@gmail.com> <20220705172743.GB3448@gac> <87o7y2zqnj.fsf@gmail.com> <20220706121338.GA16119@LionPure> <875ykaz9ca.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <875ykaz9ca.fsf@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Received-SPF: pass client-ip=64.68.200.34; envelope-from=bokr@bokr.com; helo=mailout.easymail.ca X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" 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=1657998584; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=cVc9XwVhjKeXHiLkypS0bgnhwr60C889eizi5sJ7AaQ=; b=CFxGeeUDivfacmUkSst5+xCOt0yUILe1Xnx9WC2JiSfC/ScJOCvnlc5CbOve7i7bQZR7a6 DH4ro9x0PcaLCLFfhZvCHhygMEvhCfmztMbFroI4DUK/w6glrmF32WQ5OzBpZAI2+CYDDc dqThaI0KuyB2Opi7qTI3ga/HigxQgwo0W55Wj8iW1iHILe0LC81ENiTEW7hQWr665Tr/tY CMTOpzEqNFe1AwmbGccD3rB/zqjaxVo4MOomAous2BxMbrsxGMpQeo4NNnf8B9fMPCBhB9 O3/cpd+DEYPrIzc2RBN6v4dOZmMDd7V0xaNmD1BgTMsr/3Uctj2vPh8RQbJf3w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657998584; a=rsa-sha256; cv=none; b=KZZ+X9XVPr0V91acHzZ7bIV+87AjSbMMrsqq0XqBY2QVtygUThVpJxUhXpxFNYEfber88r 2al0q8PkrSWon+Rm4ume1pSPyJEcdTAgESVgSXG+0qvfuFoWML864aUOt74A7LSD03bZ9K 5IGFUOkyfKGOXQ5rfe49iujKTm5MyrkuEnsovCGnGmW39YcwJ37rYwaEEw5lmBS1vvRe3+ bSXTl0Hr5RpzwMUO3fcQ6T32aWmk6u/hpYWvDw/ophjJNeqRH7wzYF5ZVaHa824W/jggOA MIvtyicaaPbFj2aBfQ2zUL9CrDJZiH38UWBIHyXyPujmlAJYt11zAAcqziHBOg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=LjOKVn6g; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=Qwg3Xtkc; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.06 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=LjOKVn6g; dkim=fail ("headers rsa verify failed") header.d=bokr.com header.s=easymail header.b=Qwg3Xtkc; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8AE5217C36 X-Spam-Score: 3.06 X-Migadu-Scanner: scn1.migadu.com X-TUID: tfEfadOtZu1M Hi Simon, On +2022-07-06 14:58:29 +0200, zimoun wrote: > Hi, > > On mer., 06 juil. 2022 at 14:13, bokr@bokr.com wrote: > > > [13:23 ~/bs]$ guile --no-auto-compile -c '(display (getenv "PS1"))(newline)' > > [\A \w]\$ > > On my machine, all is as usual and I run Bash: > > --8<---------------cut here---------------start------------->8--- > $ echo $PS1 > \n\w/\n\u@\h$ > $ guile --no-auto-compile -c '(display (getenv "PS1"))(newline)' > #f > --8<---------------cut here---------------end--------------->8--- > > Maybe I miss something. Thanks for giving a try. > > > Cheers, > simon > Hm, I see that on my system, I don't get #f from guile like you --8<---------------cut here---------------start------------->8--- $ echo $PS1 [\A \w]\$ $ guile --no-auto-compile -c '(display (getenv "PS1"))(newline)' [\A \w]\$ --8<---------------cut here---------------end--------------->8--- so I'm not sure what is the difference ;/ Since I was getting PS1 from a bash invocation of guile, I was had a different impression from yours of reality ;-) So I went looking for a context where invoking something would NOT see PS1 :) I found that a nested call of a bash script did not see PS1 unless invoked by sourcing. (Of course I can't source the guile I access with "guile" as a bash command, since it's a binary.) But IIRC guile under guix is actually a wrapper script to set up the environment, so maybe you could on your system -- I've no idea what would happen ;-) I was thinking that the discussed problem must involve a guile script that might not be able to sense that it was being invoked by an interactive repl if it got executed in a nested way as a sub-command, because the latter would not see a PS1 unless it was in its current environment. So I was trying to point out that if from the repl you invoke the nesting script by sourcing it instead of executing it, the sourcing makes the execution happen in the current environment, and PS1 is seen and apparently passed on to what the sourced script invokes. I was lazy about separating stuff, sorry. Comments on the pieces follow: --8<---------------cut here---------------start------------->8--- What you report above: ┌────────────────────────────────────────────────────────────────────┐ │ > $ echo $PS1 │ │ > \n\w/\n\u@\h$ │ │ > $ guile --no-auto-compile -c '(display (getenv "PS1"))(newline)' │ │ > #f │ │ > │ └────────────────────────────────────────────────────────────────────┘ The guile I'm running: { which guile; guile -v; } --8<---------------cut here---------------start------------->8--- /usr/bin/guile guile (GNU Guile) 2.2.4 Packaged by Debian (2.2.4-deb+1-2+deb10u1) Copyright (C) 2018 Free Software Foundation, Inc. License LGPLv3+: GNU LGPL 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. --8<---------------cut here---------------end--------------->8--- Me: Like you, but not getting #f -- my bug, presumably ? Should this return #f for sure? ┌──────────────────────────────────────────────────────────────────────────────┐ │ [13:23 ~/bs]$ guile --no-auto-compile -c '(display (getenv "PS1"))(newline)' │ │ [\A \w]\$ │ └──────────────────────────────────────────────────────────────────────────────┘ Invoking script[1] as command, not sourcing -- no PS1 in the command's env nested guile doesn't see it ┌─────────────────────────────────────┐ │ [13:24 ~/bs]$ ./guile-non-int-call │ │ PS1_val='#f' │ │ #f │ └─────────────────────────────────────┘ Sourcing makes the execution happen in the current env, so PS1 is visible ┌────────────────────────────────────────────┐ │ [13:24 ~/bs]$ source ./guile-non-int-call │ │ PS1_val='[\A \w]\$ ' │ │ [\A \w]\$ │ └────────────────────────────────────────────┘ [1] The script producing the above results as command vs sourced: ┌──────────────────────────────────────────────────────────────────────────────────────┐ │ [13:24 ~/bs]$ cat -nA ./guile-non-int-call │ │ 1 #!/usr/bin/bash$ │ │ 2 PS1_val="$(guile --no-auto-compile -c '(display (getenv "PS1"))(newline)')"$ │ │ 3 echo "PS1_val='$PS1_val'"$ │ │ 4 guile --no-auto-compile -c '(display (getenv "PS1"))(newline)'$ │ │ [13:25 ~/bs]$ │ └──────────────────────────────────────────────────────────────────────────────────────┘ --8<---------------cut here---------------end--------------->8--- WDYT? I need to go back to square 1 default .bash_login and .bashrc to debug this I guess :-( (so .profile and my mods down the .profile sequence will be ignored). Gaah :-/ -- Regards, Bengt Richter