unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: Using symlinks in 'local-file'
Date: Mon, 15 Jun 2015 22:44:03 +0200	[thread overview]
Message-ID: <878ubk66ss.fsf@gnu.org> (raw)
In-Reply-To: <87si9uglli.fsf@gmail.com> (Alex Kost's message of "Sun, 14 Jun 2015 22:02:01 +0300")

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

  reply	other threads:[~2015-06-15 20:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-14 19:02 Using symlinks in 'local-file' Alex Kost
2015-06-15 20:44 ` Ludovic Courtès [this message]
2015-06-16 18:05   ` Alex Kost
2015-06-19  8:26     ` Ludovic Courtès
2015-06-20 16:35       ` Alex Kost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878ubk66ss.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=alezost@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).