Subject: bug#54003: closed (Re: bug#54003: 'local-file' fails to resolve relative file names with Guile 3.0.8)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 07 Mar 2022 13:20:02 +0000

Your bug report

#54003: 'local-file' fails to resolve relative file names with Guile 3.0.8

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
54003: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54003
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#54003: 'local-file' fails to resolve relative file names with Guile 3.0.8
From: Ludovic Courtès <[email-masked]>
To: Maxime Devos <[email-masked]>
Cc: Aleksandr Vityazev <[email-masked]>, Maxim Cournoyer <[email-masked]>, [email-masked]
Date: Mon, 07 Mar 2022 14:18:58 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Ludovic Courtès <[email-masked]> skribis:

> Ludovic Courtès <[email-masked]> skribis:
>
>>>>>From 7fd25c6f15f74fb6e45fc3f0db21a110267f262c Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <[email-masked]>
>> Date: Wed, 16 Feb 2022 11:27:43 +0100
>> Subject: [PATCH] gexp: Preserve source location for #~ and #$ read extensions.
>>
>> Read hash extensions preserve source location info as source properties
>> on their result.  However, in Guile 3.0.8, that location would be
>> dismissed, leading 'local-file' to fail to resolve file names relative
>> to the source directory.
>>
>> Fixes <https://issues.guix.gnu.org/54003>.
>> Reported by Aleksandr Vityazev <[email-masked]>.
>>
>> * guix/gexp.scm <eval-when> [read-syntax-redefined?, read-procedure]
>> [read-syntax*]: New variables.
>> [read-ungexp]: Adjust to expect either sexps or syntax objects.
>> [read-gexp]: Call 'read-procedure'.
>> * tests/gexp.scm ("local-file, relative file name, within gexp")
>> ("local-file, relative file name, within gexp, compiled"): New tests.
>
> Pushed as ca155a20aea25003b03ef5e0420c77e416d5f425 after verifying that
> it works with 3.0.7.
>
> I’m leaving the bug open so we can see what to do on the Guile side.

Fixed in Guile:

  https://git.savannah.gnu.org/cgit/guile.git/commit/?id=347321ece9fc85ddf74af3c798230b7b187fbce9

Closing!

Ludo’.

Subject: local-file after Guile update
From: Aleksandr Vityazev <[email-masked]>
To: [email-masked]
Date: Mon, 14 Feb 2022 21:50:08 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

I have the following dotfiles directory structure where I store my Guix home
config:

|-etc
|
|-subdir
|   |
|   |-home

I often use the 'local-file' procedure in modules in the home directory. For
example in /subdir/home/shells.scm:

#+begin_src scheme :scheme guile :season guile
(simple-service 'add-zsh-files
                home-files-service-type
                `(("config/zsh/zshrc"
                   ,(local-file "../../etc/zsh/zshrc"))))
#+end_src
And it works, as expected.

The following example also worked before the
076e825dc5d585943ce820a279fffe4af09757fb (gnu: guile: Add version 3.0.8 as
'guile-3.0-latest') commit.

in /subdir/home/wm.scm: 
#+begin_src scheme :scheme guile :season guile
(service
 home-rofi-service-type
 (home-rofi-configuration
  (config-rasi
   `(,#~(format
         #f "@theme \"~a\""
         #$(local-file "../../etc/rofi/nord.rasi"))))))
#+end_src

After 076e825dc5d585943ce820a279fffe4af09757fb
using (local-file "../../etc/rofi/nord.rasi") and not
(local-file "etc/rofi/nord.rasi") causes an error:

guix home: error: canonicalize-path: No such file or
directory: "../../etc/rofi/nord.rasi".

The example that causes the error uses the original Guix home implementation,
which uses gexps.  When I figure out how to make a minimal reproducer that
does not depend on it, I will update this report.

-- 
Best regards,
Aleksandr Vityazev