From unknown Tue Jun 17 01:48:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78641: Scripts in `expect' package enter an endless `sh exec' loop. Resent-From: "W. Kosior" Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 30 May 2025 08:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78641 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 78641@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174859357016221 (code B ref -1); Fri, 30 May 2025 08:27:02 +0000 Received: (at submit) by debbugs.gnu.org; 30 May 2025 08:26:10 +0000 Received: from localhost ([127.0.0.1]:45401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uKv44-0004DL-9h for submit@debbugs.gnu.org; Fri, 30 May 2025 04:26:10 -0400 Received: from lists.gnu.org ([2001:470:142::17]:40536) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uKv3z-0004CE-8n for submit@debbugs.gnu.org; Fri, 30 May 2025 04:26:06 -0400 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 1uKv3t-0005PA-6d for bug-guix@gnu.org; Fri, 30 May 2025 04:25:57 -0400 Received: from salamina.koszko.org ([188.68.237.248] helo=koszko.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKv3q-0007Jd-Qn for bug-guix@gnu.org; Fri, 30 May 2025 04:25:56 -0400 Received: from dummy-client.koszko.org ([192.168.193.169]) by salamina.koszko.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1uKv3m-000000005QH-0TFl for bug-guix@gnu.org; Fri, 30 May 2025 10:25:50 +0200 Date: Fri, 30 May 2025 10:25:48 +0200 From: "W. Kosior" Message-ID: <20250530102548.30f91828.koszko@koszko.org> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/zJ3n4meXlFTaydX.dY44H1L"; protocol="application/pgp-signature"; micalg=pgp-sha512 Received-SPF: pass client-ip=188.68.237.248; envelope-from=koszko@koszko.org; helo=koszko.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --Sig_/zJ3n4meXlFTaydX.dY44H1L Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable I wanted to use the `unbuffer' command from `expect' package. `unbuffer' can be used to run another command in a way it sees its STDOUT as a terminal. Even the simplest invokation guix shell expect -- unbuffer echo test freezes without printing "test" as it should. I found that the initial lines in all `expect's executable script files contain an extra `exec sh' line that causes the script to enter an endless recursion when interpreted by a POSIX shell. --8<---------------cut here---------------start------------->8--- $ head -6 $(file $(guix build expect)/bin/* | grep text | sed 's/^\([^:]\+\= ).*/\1/') =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/autoe= xpect <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/autop= asswd <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/crypt= dir <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/decry= ptdir <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/dislo= cate <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/ftp-r= fc <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/kibit= z <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/lpunl= ock <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/mkpas= swd <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/multi= xterm <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/passm= ass <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/rftp = <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/rlogi= n-cwd <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/timed= -read <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/timed= -run <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/tknew= sbiff <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/tkpas= swd <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/unbuf= fer <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/weath= er <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/xkibi= tz <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} =3D=3D> /gnu/store/bwix93j3pysx464sh4mp98lsjgsbpcri-expect-5.45.4/bin/xpsta= t <=3D=3D #!/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/sh # \ exec sh "$0" ${1+"$@"} # -*- tcl -*- # The next line is executed by /bin/sh, but not tcl \ exec tclsh "$0" ${1+"$@"} --8<---------------cut here---------------end--------------->8--- An artifact of incorrect shebang patching, perhaps? Nonetheless, as one might guess, giving the script directly to tclsh makes it work: --8<---------------cut here---------------start------------->8--- $ guix shell tcl expect bash -- bash -c 'tclsh $(which unbuffer) echo test' test --8<---------------cut here---------------end--------------->8--- I am using `expect' from Guix d3d157bc61c4a6a3fac11e33d26f6f2a72a24151 from May 21, 2025. Best! -- W. Kosior website: https://koszko.org/koszko.html fediverse: https://friendica.me/profile/koszko/profile PGP fingerprint: E972 7060 E3C5 637C 8A4F 4B42 4BC5 221C 5A79 FD1A --Sig_/zJ3n4meXlFTaydX.dY44H1L Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQTpcnBg48VjfIpPS0JLxSIcWnn9GgUCaDlrjAAKCRBLxSIcWnn9 GpGLAQDcOMr968rS72UO93//nKZzo2hwregmbtPm8Ado+mmvhwEA8pbKMFuLulBy 3ybM8IJ0bQwl22Iuh7YXCSwrYRDk+QA= =nR98 -----END PGP SIGNATURE----- --Sig_/zJ3n4meXlFTaydX.dY44H1L--