From unknown Sun Jun 15 08:58:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69436: confused by changing absolute pathname Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 27 Feb 2024 20:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69436 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 69436@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17090655545818 (code B ref -1); Tue, 27 Feb 2024 20:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Feb 2024 20:25:54 +0000 Received: from localhost ([127.0.0.1]:51654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rf41N-0001Vb-Um for submit@debbugs.gnu.org; Tue, 27 Feb 2024 15:25:54 -0500 Received: from lists.gnu.org ([209.51.188.17]:48132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rf41I-0001VJ-OC for submit@debbugs.gnu.org; Tue, 27 Feb 2024 15:25:48 -0500 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 1rf40r-0005eD-P4 for bug-guile@gnu.org; Tue, 27 Feb 2024 15:25:17 -0500 Received: from river.fysh.org ([2001:41d0:d:20da::2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rf40n-0001tm-CN for bug-guile@gnu.org; Tue, 27 Feb 2024 15:25:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fysh.org; s=20170316; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iS729lk5nBIY0BDsQtIieM3Ffd8SxEjGPrwJcF75bMs=; b=BU2eGpRTWN3p+tZsTkth40nK0s fGyUMwTdSpI5XHfWwAEKDPIjUJG+nT/U1l0UA2rJwzCJq1MtV2gmP03E/I+WWLMFmMpx0TzVwjKh5 ZUTU4Wvs2Hp+n0YUgZBM+Dw4fetB/w6LRKeF5oEJMUm6VWMEKG0ECzbMby83n7JNMAS0=; Received: from zefram by river.fysh.org with local (Exim 4.96 #2 (Debian)) id 1rf40f-00GJzF-1J; Tue, 27 Feb 2024 20:25:05 +0000 Date: Tue, 27 Feb 2024 20:25:05 +0000 From: Zefram Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=2001:41d0:d:20da::2; envelope-from=zefram@fysh.org; helo=river.fysh.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) 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: -3.3 (---) The guile(1) command-line interface is documented to take the filename of a script to execute. Here's how well it resolves filenames (testing on Guile 3.0.5): $ mkdir a $ cd a $ echo '(display "ok") (newline)' > ok.scm $ perl -e 'chdir ".."; while(1) { rename("a", "b"); rename("b", "a"); }' & [1] 389562 $ guile --no-auto-compile ok.scm ok $ guile --no-auto-compile ok.scm Backtrace: 0 (primitive-load "/home/zefram/tmp/g0/b/ok.scm") ERROR: In procedure primitive-load: In procedure open-file: No such file or directory: "/home/zefram/tmp/g0/b/ok.scm" $ guile --no-auto-compile ok.scm Backtrace: 0 (primitive-load "/home/zefram/tmp/g0/a/ok.scm") ERROR: In procedure primitive-load: In procedure open-file: No such file or directory: "/home/zefram/tmp/g0/a/ok.scm" $ guile --no-auto-compile ok.scm ;;; Stat of /home/zefram/tmp/g0/b/ok.scm failed: ;;; In procedure stat: No such file or directory: "/home/zefram/tmp/g0/b/ok.scm" ok $ guile --no-auto-compile ok.scm ok Each time that I invoked guile(1), the filename "ok.scm" given on the command line unambiguously referred to an extant script file in the current directory. Some invocations successfully ran it, but others got confused. The confused invocations either entirely fail to run the script, or produce some extra stderr noise and then run the script. guile(1) is getting confused because the absolute pathname of the current directory is changing. It works out an absolute pathname for the specified script, and then tries to use that at a time when it may be stale. The manifestation of the bug varies from run to run because it is subject to this race condition. I use the --no-auto-compile option in my example in order to avoid the extra noise of guile's caching system. If caching is allowed to occur then similar results ensue, but there's extra stderr noise that doesn't indicate a real problem, and the situation is semantically a bit more complicated because of the caching. guile(1) shouldn't need to use an absolute pathname for the script file. The name given on the command line should be used; relative pathnames should work. Debian incarnations of this bug report (two of them because two versions of Guile are packaged separately): https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064443 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064446 -zefram