unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Zefram via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" <bug-guile@gnu.org>
To: 69436@debbugs.gnu.org
Subject: bug#69436: confused by changing absolute pathname
Date: Tue, 27 Feb 2024 20:25:05 +0000	[thread overview]
Message-ID: <Zd5FIQpHN2Gb0E-F@fysh.org> (raw)

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





                 reply	other threads:[~2024-02-27 20:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zd5FIQpHN2Gb0E-F@fysh.org \
    --to=bug-guile@gnu.org \
    --cc=69436@debbugs.gnu.org \
    --cc=zefram@fysh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).