From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Milan Zimmermann Newsgroups: gmane.emacs.bugs Subject: bug#59469: 29.0.50; Eshell "for" loop: Calling a non-lisp command (example: /usr/bin/tail) sets the variable exported in the {} block of "for var in list {}" to nil Date: Mon, 21 Nov 2022 21:04:51 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000000c2e6805ee059bc7" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1022"; mail-complaints-to="usenet@ciao.gmane.io" To: 59469@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 22 03:06:20 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxIg0-0000A9-7z for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Nov 2022 03:06:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxIfk-0000Pc-CN; Mon, 21 Nov 2022 21:06:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxIfi-0000PH-MQ for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:06:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxIfi-00025o-Ec for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxIfi-00080C-9p for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Milan Zimmermann Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Nov 2022 02:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59469 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166908273630724 (code B ref -1); Tue, 22 Nov 2022 02:06:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Nov 2022 02:05:36 +0000 Original-Received: from localhost ([127.0.0.1]:49258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxIfI-0007zT-1m for submit@debbugs.gnu.org; Mon, 21 Nov 2022 21:05:36 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:47262) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxIfC-0007zF-Hm for submit@debbugs.gnu.org; Mon, 21 Nov 2022 21:05:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxIfC-0000MA-DD for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:05:30 -0500 Original-Received: from mail-vs1-xe31.google.com ([2607:f8b0:4864:20::e31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxIfA-0001yf-MJ for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:05:30 -0500 Original-Received: by mail-vs1-xe31.google.com with SMTP id i2so13131346vsc.1 for ; Mon, 21 Nov 2022 18:05:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=yw7Osjz63P3UKs34dbmLhDSvPDFdeui/kaVU2JTe1L8=; b=NWrzVCwgKalxYzBY8U/lwNjusVI3nM6TvMRq74puJNOppdvxS6gfn1ZwCSOK9Ktp3x UnWytfZO10E+D6F88fAYSal2v82heJgPVLrkYjVnX7xtJ5n79HWEkrtNMZEnSEvTm+76 YBLq4X4nuHR1CZYyL3pihjmLqC+Z5ITmvdZ1a5SAJay7kk67oCi1t24XrH42w4z3IkKb r9hMrSlkgFB4z6bgDuerCgIuFhDy6LfviE5O6mIQ+EJMT6RfED2O41qdRwfeNZ7CcZWg GmQtV+Hub4P1Q0CSZLgJv3atx0Bo/YUBdVHgaZm9/bHNAJ53n+ZZqQ/12CqUZoZMG9Bs MsNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yw7Osjz63P3UKs34dbmLhDSvPDFdeui/kaVU2JTe1L8=; b=XQmIQg7M1wGhTqTtQm9d5SkpczTfoK7AT2jlntRg2wxASH1EQBdXV9uooaJGSiZuMP 1ri9JWbkTj+1qIP76cRRoLOXGosD2SllYlSyEXmcKcYOCiFkm+eqSCv2IQ3UnMo9yODD gbREtm0GXQH6ODoyVzVoSmNNwEKbxDm3h+E6dKomDWGySS97Tb0rbeOKypARdJXSxm2P iKaUVx5JYgD1vK2fd9JZQFN5rJ3YGsQ/7lE1mnDvm75abAiu+lHjSZ3S3ZM34EiN1xgq RXkmxYgRL57SK5A9Fep3xsQ/2JciAFRUy9tO2zGpRFVsaUiAFBH7r+8cxabILTMbSALZ HbFQ== X-Gm-Message-State: ANoB5pkV1yq+sBCOS+O5o9edIhAPpDWNQENoysjwPORd3kLgnc/kM1cU MUbxr6tY7Ru5e3n7Py9b5GoKqsiFiJbo2faG/nlmYP8B+Es= X-Google-Smtp-Source: AA0mqf6JR6klzftwta9ke6j2yQ0cxw/idKKoafxXsD51bjZo/NQeOBlzPenzrAfBlk1icOeR6htzVbKPssPfMfVlsZ8= X-Received: by 2002:a05:6102:11e5:b0:3aa:2fea:86f4 with SMTP id e5-20020a05610211e500b003aa2fea86f4mr1101360vsg.54.1669082727065; Mon, 21 Nov 2022 18:05:27 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::e31; envelope-from=milan.zimmermann@gmail.com; helo=mail-vs1-xe31.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, FREEMAIL_FROM=0.001, HTML_IMAGE_ONLY_28=1.404, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_REMOTE_IMAGE=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248592 Archived-At: --0000000000000c2e6805ee059bc7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, I might be doing something wrong, but it appears that calling any non-lisp command (example: /usr/bin/tail) causes the variable set in the {} block of "for var in list {}" to change to nil. To duplicate, please create a file "bug.txt" in ~tmp, echo "line one" > ~/tmp/bug.txt then run the following code - In the code below, *please replace my full path "/home/mzimmermann/tmp/bug.txt" with your full path. There seems to be an unrelated issue trying to list ~/tmp/bug.txt* for file in (list "/home/mzimmermann/tmp/bug.txt") { type-of $file echo "file=3D$file"; # Create a variable. The back and forth between .log and .txt is # only there to simulate some useful work to set value of samefile export samefile=3D"${echo $file(:s/.txt/.log/)}"(:s/.log/.txt/); echo "samefile=3D$samefile" # Note that on my system, 'which tail' =3D=3D> /usr/bin/t= ail tail $file # Note that on my system, 'which cat' =3D=3D> eshell/cat = is a byte-compiled Lisp function in =E2=80=98em-unix.el=E2=80=99. # cat $file echo "samefile=3D$samefile" echo "file=3D$file"; } Actual result: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D string file=3D/home/mzimmermann/tmp/bug.txt samefile=3D/home/mzimmermann/tmp/bug.txt line one samefile=3Dnil file=3D/home/mzimmermann/tmp/bug.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Please *note how the contents of samefile is nullified. This is the bug I am reporting here* Expected result: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D string file=3D/home/mzimmermann/tmp/bug.txt samefile=3D/home/mzimmermann/tmp/bug.txt line one samefile=3D/home/mzimmermann/tmp/bug.txt file=3D/home/mzimmermann/tmp/bug.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Notes: 1. I tried this with other non-lisp functions (/usr/bin/gzip) and it caused the same issue. 2. If we use "cat" which is an elisp function, the loop works as expected. Thanks, Milan Zimmermann --0000000000000c2e6805ee059bc7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
I might be doing something wrong, but it appears that calling any no= n-lisp command =C2=A0(example: /usr/bin/tail) causes the variable set in th= e {} block of "for var in list {}" to change to nil.
To duplicate, please create a file "bug.txt" in ~tmp,

=C2= =A0 =C2=A0echo "line one" > ~/tmp/bug.txt

then run the = following code -

In the code below, *please replace my full path &qu= ot;/home/mzimmermann/tmp/bug.txt" with your full path. There seems to = be an unrelated issue trying to list ~/tmp/bug.txt*

=C2=A0 for file = in (list "/home/mzimmermann/tmp/bug.txt") {
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 type-of $file
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "file=3D$fil= e";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = # Create a variable. The back and forth between .log and .txt is
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # only there to sim= ulate some useful work to set value of samefile
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 export samefile=3D"${echo $f= ile(:s/.txt/.log/)}"(:s/.log/.txt/);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "samefile=3D$samefile"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # Note that= on my system, 'which tail' =3D=3D> /usr/bin/tail
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tail $file
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # Note that on my s= ystem, 'which cat' =3D=3D> eshell/cat is a byte-compiled Lisp fu= nction in =E2=80=98em-unix.el=E2=80=99.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # cat $file
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "samefile=3D$samefile"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "= file=3D$file";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
Actual result:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D
string
file=3D/home/mzimmermann/tmp/bug.txt
samefile=3D/home/m= zimmermann/tmp/bug.txt
line one
samefile=3Dnil
file=3D/home/mzimme= rmann/tmp/bug.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Please *note how the contents of samefile is nullified. This is the bug I= am reporting here*

Expected result:
=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D
string
file=3D/home/mzimmermann/tmp/bug.txt
= samefile=3D/home/mzimmermann/tmp/bug.txt
line one
samefile=3D/home/mz= immermann/tmp/bug.txt
file=3D/home/mzimmermann/tmp/bug.txt
=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Notes:

1. I tried thi= s with other non-lisp functions (/usr/bin/gzip) and it caused the same issu= e.

2. If we use "cat" which is an elisp function, the loop= works as expected.

Thanks,=C2=A0
Milan Zimmerm= ann
--0000000000000c2e6805ee059bc7--