[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using symlinks in 'local-file'
From: |
Ludovic Courtès |
Subject: |
Re: Using symlinks in 'local-file' |
Date: |
Mon, 15 Jun 2015 22:44:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Alex Kost <address@hidden> 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’.