* Using symlinks in 'local-file'
@ 2015-06-14 19:02 Alex Kost
2015-06-15 20:44 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Alex Kost @ 2015-06-14 19:02 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 431 bytes --]
If one uses a relative symlink in 'local-file', it will lead to a broken
symlink in the store as illustrated in the attached example. So I think
it either:
- should be documented explicitly that 'local-file' adds a specified
file to the store blindly, which may lead to the problem with a broken
symlink.
- or 'local-file' (or a deeper procedure) should take care of that case
and dereference a symlink if needed.
WDYT?
[-- Attachment #2: local-file-sample.scm --]
[-- Type: application/vnd.lotus-screencam, Size: 687 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using symlinks in 'local-file'
2015-06-14 19:02 Using symlinks in 'local-file' Alex Kost
@ 2015-06-15 20:44 ` Ludovic Courtès
2015-06-16 18:05 ` Alex Kost
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2015-06-15 20:44 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> skribis:
> If one uses a relative symlink in 'local-file', it will lead to a broken
> symlink in the store as illustrated in the attached example. So I think
> it either:
>
> - should be documented explicitly that 'local-file' adds a specified
> file to the store blindly, which may lead to the problem with a broken
> symlink.
>
> - or 'local-file' (or a deeper procedure) should take care of that case
> and dereference a symlink if needed.
>
> WDYT?
Actually, this only happens with #:recursive? #t, which is currently the
default.
With #:recursive? #f, you get an error:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,enter-store-monad
store-monad@(guile-user) [1]> (gexp->derivation "foo" #~(symlink #$(local-file "/tmp/symlink1" #:recursive? #f) #$output))
guix/store.scm:604:22: In procedure add-to-store:
guix/store.scm:604:22: Throw to key `srfi-34' with args `(#<condition &nix-protocol-error [message: "regular file expected" status: 1] 30c5ab0>)'.
--8<---------------cut here---------------end--------------->8---
So I think we should first make #:recursive? default to #f, since that’s
what we want by default, and optionally have the <local-file> gexp
expander resolve symlinks.
WDYT?
> (define (call-derivation drv)
> (apply system*
> (cons (derivation-builder drv)
> (derivation-builder-arguments drv))))
This is quite original. ;-)
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using symlinks in 'local-file'
2015-06-15 20:44 ` Ludovic Courtès
@ 2015-06-16 18:05 ` Alex Kost
2015-06-19 8:26 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Alex Kost @ 2015-06-16 18:05 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ludovic Courtès (2015-06-15 23:44 +0300) wrote:
> Alex Kost <alezost@gmail.com> skribis:
>
>> If one uses a relative symlink in 'local-file', it will lead to a broken
>> symlink in the store as illustrated in the attached example. So I think
>> it either:
>>
>> - should be documented explicitly that 'local-file' adds a specified
>> file to the store blindly, which may lead to the problem with a broken
>> symlink.
>>
>> - or 'local-file' (or a deeper procedure) should take care of that case
>> and dereference a symlink if needed.
>>
>> WDYT?
>
> Actually, this only happens with #:recursive? #t, which is currently the
> default.
>
> With #:recursive? #f, you get an error:
>
>
> scheme@(guile-user)> ,enter-store-monad
> store-monad@(guile-user) [1]> (gexp->derivation "foo" #~(symlink #$(local-file "/tmp/symlink1" #:recursive? #f) #$output))
> guix/store.scm:604:22: In procedure add-to-store:
> guix/store.scm:604:22: Throw to key `srfi-34' with args `(#<condition &nix-protocol-error [message: "regular file expected" status: 1] 30c5ab0>)'.
>
> So I think we should first make #:recursive? default to #f, since that’s
> what we want by default, and optionally have the <local-file> gexp
> expander resolve symlinks.
>
> WDYT?
I agree, getting an error is better than a broken link, so I'm for
making (#:recursive? #f) a default. And resolving symlinks would
probably be even better.
>> (define (call-derivation drv)
>> (apply system*
>> (cons (derivation-builder drv)
>> (derivation-builder-arguments drv))))
>
> This is quite original. ;-)
I suppose that's a polite version of "That's not how it should be done".
I just don't know what the proper way to "call" derivation is :-)
--
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using symlinks in 'local-file'
2015-06-16 18:05 ` Alex Kost
@ 2015-06-19 8:26 ` Ludovic Courtès
2015-06-20 16:35 ` Alex Kost
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2015-06-19 8:26 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> skribis:
> Ludovic Courtès (2015-06-15 23:44 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> If one uses a relative symlink in 'local-file', it will lead to a broken
>>> symlink in the store as illustrated in the attached example. So I think
>>> it either:
>>>
>>> - should be documented explicitly that 'local-file' adds a specified
>>> file to the store blindly, which may lead to the problem with a broken
>>> symlink.
>>>
>>> - or 'local-file' (or a deeper procedure) should take care of that case
>>> and dereference a symlink if needed.
>>>
>>> WDYT?
>>
>> Actually, this only happens with #:recursive? #t, which is currently the
>> default.
>>
>> With #:recursive? #f, you get an error:
>>
>>
>> scheme@(guile-user)> ,enter-store-monad
>> store-monad@(guile-user) [1]> (gexp->derivation "foo" #~(symlink #$(local-file "/tmp/symlink1" #:recursive? #f) #$output))
>> guix/store.scm:604:22: In procedure add-to-store:
>> guix/store.scm:604:22: Throw to key `srfi-34' with args `(#<condition &nix-protocol-error [message: "regular file expected" status: 1] 30c5ab0>)'.
>>
>> So I think we should first make #:recursive? default to #f, since that’s
>> what we want by default, and optionally have the <local-file> gexp
>> expander resolve symlinks.
>>
>> WDYT?
>
> I agree, getting an error is better than a broken link, so I'm for
> making (#:recursive? #f) a default. And resolving symlinks would
> probably be even better.
Done in commits 020f3e4 and 7833db1.
>>> (define (call-derivation drv)
>>> (apply system*
>>> (cons (derivation-builder drv)
>>> (derivation-builder-arguments drv))))
>>
>> This is quite original. ;-)
>
> I suppose that's a polite version of "That's not how it should be done".
Well, yes and no; I find it clever actually.
> I just don't know what the proper way to "call" derivation is :-)
With ‘build-derivations’, which lets guix-daemon built it on your behalf
in a container.
Roughly, what the daemon does is:
(eval-in-container
#~(apply system*
(cons (derivation-builder drv)
(derivation-builder-arguments drv))))
in terms of David’s forthcoming ‘eval-in-container’. ;-)
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using symlinks in 'local-file'
2015-06-19 8:26 ` Ludovic Courtès
@ 2015-06-20 16:35 ` Alex Kost
0 siblings, 0 replies; 5+ messages in thread
From: Alex Kost @ 2015-06-20 16:35 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ludovic Courtès (2015-06-19 11:26 +0300) wrote:
> Alex Kost <alezost@gmail.com> skribis:
[...]
>> I agree, getting an error is better than a broken link, so I'm for
>> making (#:recursive? #f) a default. And resolving symlinks would
>> probably be even better.
>
> Done in commits 020f3e4 and 7833db1.
I see, thank you!
>>>> (define (call-derivation drv)
>>>> (apply system*
>>>> (cons (derivation-builder drv)
>>>> (derivation-builder-arguments drv))))
>>>
>>> This is quite original. ;-)
>>
>> I suppose that's a polite version of "That's not how it should be done".
>
> Well, yes and no; I find it clever actually.
>
>> I just don't know what the proper way to "call" derivation is :-)
>
> With ‘build-derivations’, which lets guix-daemon built it on your behalf
> in a container.
>
> Roughly, what the daemon does is:
>
> (eval-in-container
> #~(apply system*
> (cons (derivation-builder drv)
> (derivation-builder-arguments drv))))
>
> in terms of David’s forthcoming ‘eval-in-container’. ;-)
Thanks for the explanation.
--
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-20 16:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-14 19:02 Using symlinks in 'local-file' Alex Kost
2015-06-15 20:44 ` Ludovic Courtès
2015-06-16 18:05 ` Alex Kost
2015-06-19 8:26 ` Ludovic Courtès
2015-06-20 16:35 ` Alex Kost
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.