unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#56777] [PATCH] Use absolute path for home activation script.
@ 2022-01-14  6:16 Andrew Tropin
  2022-08-29 21:24 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Tropin @ 2022-01-14  6:16 UTC (permalink / raw)
  To: 56777

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

* 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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#56777] [PATCH] Use absolute path for home activation script.
  2022-01-14  6:16 [bug#56777] [PATCH] Use absolute path for home activation script Andrew Tropin
@ 2022-08-29 21:24 ` Ludovic Courtès
  2022-08-30  7:01   ` Andrew Tropin
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2022-08-29 21:24 UTC (permalink / raw)
  To: Andrew Tropin; +Cc: 56777

Hi Andrew,

Andrew Tropin <andrew@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’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#56777] [PATCH] Use absolute path for home activation script.
  2022-08-29 21:24 ` Ludovic Courtès
@ 2022-08-30  7:01   ` Andrew Tropin
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Tropin @ 2022-08-30  7:01 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 56777

[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]

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

> Hi Andrew,
>
> Andrew Tropin <andrew@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-30  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14  6:16 [bug#56777] [PATCH] Use absolute path for home activation script Andrew Tropin
2022-08-29 21:24 ` Ludovic Courtès
2022-08-30  7:01   ` Andrew Tropin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).