GNU bug report logs - #56777
[PATCH] Use absolute path for home activation script.

Previous Next

Package: guix-patches;

Reported by: Andrew Tropin <andrew <at> trop.in>

Date: Tue, 26 Jul 2022 08:09:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56777 in the body.
You can then email your comments to 56777 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#56777; Package guix-patches. (Tue, 26 Jul 2022 08:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrew Tropin <andrew <at> trop.in>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 26 Jul 2022 08:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: guix-patches <at> gnu.org
Subject: [PATCH] Use absolute path for home activation script.
Date: Fri, 14 Jan 2022 09:16:32 +0300
[Message part 1 (text/plain, inline)]
* 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))))))
             (old-home-env (getenv "GUIX_OLD_HOME"))
             (old-home (or old-home-env
                           (if (file-exists? (he-init-file he-path))
-- 
2.37.0

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#56777; Package guix-patches. (Mon, 29 Aug 2022 21:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 56777 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andrew Tropin <andrew <at> trop.in>
Cc: 56777 <at> debbugs.gnu.org
Subject: Re: bug#56777: [PATCH] Use absolute path for home activation script.
Date: Mon, 29 Aug 2022 23:24:02 +0200
Hi Andrew,

Andrew Tropin <andrew <at> trop.in> 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?

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.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#56777; Package guix-patches. (Tue, 30 Aug 2022 07:02:01 GMT) Full text and rfc822 format available.

Message #11 received at 56777 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 56777 <at> debbugs.gnu.org
Subject: Re: bug#56777: [PATCH] Use absolute path for home activation script.
Date: Tue, 30 Aug 2022 10:01:31 +0300
[Message part 1 (text/plain, inline)]
On 2022-08-29 23:24, Ludovic Courtès wrote:

> Hi Andrew,
>
> Andrew Tropin <andrew <at> trop.in> 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 https://issues.guix.gnu.org/56669

Another hypothetical case, which can fail:
ln -s /gnu/store/...-home ~/tmp/he
~/tmp/he/activate
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
[signature.asc (application/pgp-signature, inline)]

bug closed, send any further explanations to 56777 <at> debbugs.gnu.org and Andrew Tropin <andrew <at> trop.in> Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 31 Aug 2022 20:43:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Sep 2022 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.