guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] profiles: Let canonicalize-profile return an absolute path.


From: Roel Janssen
Subject: Re: [PATCH] profiles: Let canonicalize-profile return an absolute path.
Date: Thu, 12 Jul 2018 22:53:34 +0200
User-agent: mu4e 1.0; emacs 26.1

Ludovic Courtès <address@hidden> writes:

> Hi Roel,
>
> Roel Janssen <address@hidden> skribis:
>
>> I'd like to change the way the symlinks to custom profiles are created.
>> Here's what currently happens:
>>
>> $ guixr package -i hello -p guix-profiles/test
>> $ ls -l guix-profiles
>> lrwxrwxrwx. 1 user group 25 Jul  3 19:53 test -> guix-profiles/test-1-link
>> lrwxrwxrwx. 1 user group 51 Jul  3 19:53 test-1-link -> 
>> /gnu/store/...6qbaps-profile
>>
>> Now, that symlink is broken.
>> Instead, I'd like to have it always use absolute paths:
>
> How about instead making the link to the generation file (“test-1-link”)
> always a relative symlink?  Like this:
>
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guix package -p foo/x -i sed
>
> [...]
>
> $ ls -l foo/*
> lrwxrwxrwx 1 ludo users  8 Jul 11 13:03 foo/x -> x-1-link
> lrwxrwxrwx 1 ludo users 51 Jul 11 13:03 foo/x-1-link -> 
> /gnu/store/qp6dqlbsf0pw9p9fwc3gzdcaxx40rn9v-profile
> --8<---------------cut here---------------end--------------->8---
>
> Patch below.
>
> FWIW I prefer avoiding ‘canonicalize-path’ in general because it’s
> inefficient and because it can surprise the user: you can end up with a
> long file name that you didn’t type in, or you can have ENOENT errors
> because ‘canonicalize-path’ requires the given file to exist.
>
> WDYT?
>
> Thanks,
> Ludo’.

I like your patch a lot better than mine!  It fixes the issue I run
into, so it'd be great to apply your patch soon.

There's one other thing I also run into that is somewhat related to
this:
On a multi-user system, where ‘root’ cannot see what's in a user's
directory, it's impossible to keep track of custom profiles.  However,
the default user profiles are fine, because they are actually stored in
the local state dir, and symlinked outside.  Could we do the same with
custom profiles?  The functionality stays the same, it might even be
cleaner in the user's directory because it only needs a single symlink
to the latest generation of a profile, and we might be able to do
garbage collection again on our cluster!

I'd image something like this:

--8<---------------cut here---------------start------------->8---
$ echo $HOME
/home/roel
$ guix package -i hello teeworlds -p ~/my/custom/profile
--> /var/guix/profiles/per-user/roel/home/roel/my/custom/profile -> ...
--> /var/guix/profiles/per-user/roel/home/roel/my/custom/profile-1-link
$ ls -l ~/my/custom
drwxrwxrwx ... profile -> 
/var/guix/profiles/per-user/roel/home/roel/my/custom/profile
--8<---------------cut here---------------end--------------->8---

That way, if root cannot look into ‘/home/roel’, it can still keep
track of the profile because it can look into ‘/var/guix’.

Kind regards,
Roel Janssen



reply via email to

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