Subject: current-filename does not always work

From: Tommi Höynälänmaa <[email-masked]>
Date: Fri, 28 Mar 2025 10:28:17 +0200

Guile version: 3.0.10

Machine type: x86_64-pc-linux-gnu

Guile binary package version: 3.0.10+really3.0.10-4

Steps to reproduce the bug:

1. Extract the following snippet to file cur-fname1.scm some directory:

---cut here---

(define-module (cur-fname1))

(define-public %current-filename (current-filename))

---cut here---

2. Create subdirectory mod and extract the following snippet to file 
cur-fname2.scm there:

---cut here---

(define-module (mod cur-fname2))

(define-public %current-filename (current-filename))

---cut here---

3. Launch guile with command "GUILE_LOAD_PATH=. guile" and give the 
following commands in the REPL:

,use (cur-fname1)

%current-filename

4. Change to the subdirectory mod, launch guile with command 
"GUILE_LOAD_PATH=.. guile", and give the following commands in the REPL:

,use (mod cur-fname2)

%current-filename

Expected output:

Guile should print the filename in both steps 3 and 4.

Actual output:

Guile prints filename in step 3 but #f in step 4.

      - Tommi Höynälänmaa

-- 
Kotisivu / Homepage: http://www.iki.fi/tohoyn/
Sähköposti / E-Mail: [email-masked]
GPG-sormenjälki / GPG fingerprint:
55F4 2477 7155 3528 5CB2 2B7A BB86 1FDE 4046 0F83
FT, Debian-ylläpitäjä / PhD, Debian Maintainer