[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#56777] [PATCH] Use absolute path for home activation script.

From: Andrew Tropin
Subject: [bug#56777] [PATCH] Use absolute path for home activation script.
Date: Tue, 30 Aug 2022 10:01:31 +0300

On 2022-08-29 23:24, Ludovic Courtès wrote:

> Hi Andrew,
> Andrew Tropin <> skribis:
>> * gnu/home/services.scm (compute-activation-script): Use absolute path for
>> home activation script.
>> ---
>>  gnu/home/services.scm | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> diff --git a/gnu/home/services.scm b/gnu/home/services.scm
>> index b05ec53e2a..6d5e4308a0 100644
>> --- a/gnu/home/services.scm
>> +++ b/gnu/home/services.scm
>> @@ -418,7 +418,7 @@ (define (compute-activation-script init-gexp gexps)
>>              (new-home-env (getenv "GUIX_NEW_HOME"))
>>              (new-home (or new-home-env
>>                            ;; Path of the activation file if called 
>> interactively
>> -                          (dirname (car (command-line)))))
>> +                          (canonicalize-path (dirname (car 
>> (command-line))))))
> Just wondering: what’s the rationale?

It's been a while since I posted it, but IIRC, in case the activation
script called manually from other directory without this change the
relative new-home can be set, which can fail later if some of activation
code changes the current working directory, but reference home
environment by relative path.  Probably I faced this one, when was
working on prototype for

Another hypothetical case, which can fail:
ln -s /gnu/store/...-home ~/tmp/he
rm ~/tmp/he
# Dangling symlink ~/.guix-home -> ~/tmp/he

Last one can be solved by resolving full path of new-home in
symlink-manager, but always setting new-home to absolute path to home
item in the store seems as a way to avoid both potential problems
mentioned above.

This change is pushed as ffc391500ac7eae1ef100d8d36f6c01f4f606170

> This is harmless-looking and perhaps it’s all fine, but IME calling
> ‘canonicalize-path’ might sometimes paper over problems related to file
> name handling.

Will keep it in mind.

Best regards,
Andrew Tropin

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]