From: ludo@gnu.org (Ludovic Courtès)
To: Konrad Hinsen <konrad.hinsen@fastmail.net>
Cc: bug-guix@gnu.org
Subject: Re: Installing guix from Git
Date: Wed, 12 Jun 2013 09:43:10 +0200 [thread overview]
Message-ID: <87k3lzlqpd.fsf@gnu.org> (raw)
In-Reply-To: <20920.7963.954762.497815@Konrad-Hinsens-MacBook-Pro.local> (Konrad Hinsen's message of "Wed, 12 Jun 2013 09:11:23 +0200")
[-- Attachment #1: Type: text/plain, Size: 543 bytes --]
Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:
> Ludovic Courtès writes:
>
> > Yes, probably (this is not a problem when it’s used in a build
> > environment, because everything is under /nix/store anyway.)
>
> Right. And in a user environment, it is quite useful to be able to
> link to impure libraries, so perhaps the best solution is to
> make this the default (not sure though), or at least discuss the
> environment variable in the documentation.
I just pushed this patch in the new ‘core-updates’ branch:
[-- Attachment #2: Type: text/x-patch, Size: 2605 bytes --]
commit cfbf7877a673400881db20521a9d6a44261ed62b (HEAD, refs/heads/core-updates)
Author: Ludovic Courtès <ludo@gnu.org>
Date: Wed Jun 12 09:39:31 2013 +0200
ld-wrapper: Unless in a build env., allow files that symlink to the store.
* gnu/packages/ld-wrapper.scm (pure-file-name?): As a last resort, when
%BUILD-DIRECTORY is false, check whether FILE is a symlink, and loop
over it to check whether its target is in the store.
Modified gnu/packages/ld-wrapper.scm
diff --git a/gnu/packages/ld-wrapper.scm b/gnu/packages/ld-wrapper.scm
index fd5a4cb..41ff3df 100644
--- a/gnu/packages/ld-wrapper.scm
+++ b/gnu/packages/ld-wrapper.scm
@@ -11,7 +11,7 @@ main="(@ (gnu build-support ld-wrapper) ld-wrapper)"
exec @GUILE@ -c "(load-compiled \"$0.go\") (apply $main (cdr (command-line)))" "$@"
!#
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -82,13 +82,26 @@ exec @GUILE@ -c "(load-compiled \"$0.go\") (apply $main (cdr (command-line)))" "
(getenv "GUIX_LD_WRAPPER_DEBUG"))
(define (pure-file-name? file)
- ;; Return #t when FILE is the name of a file either within the store or
- ;; within the build directory.
- (or (not (string-prefix? "/" file))
- (string-prefix? %store-directory file)
- (string-prefix? %temporary-directory file)
- (and %build-directory
- (string-prefix? %build-directory file))))
+ ;; Return #t when FILE is the name of a file either within the store
+ ;; (possibly via a symlink) or within the build directory.
+ (define %max-symlink-depth 50)
+
+ (let loop ((file file)
+ (depth 0))
+ (or (not (string-prefix? "/" file))
+ (string-prefix? %store-directory file)
+ (string-prefix? %temporary-directory file)
+ (if %build-directory
+ (string-prefix? %build-directory file)
+
+ ;; When used from a user environment, FILE may refer to
+ ;; ~/.guix-profile/lib/libfoo.so, which is itself a symlink to the
+ ;; store. Check whether this is the case.
+ (let ((s (false-if-exception (lstat file))))
+ (and s
+ (eq? 'symlink (stat:type s))
+ (< depth %max-symlink-depth)
+ (loop (readlink file) (+ 1 depth))))))))
(define (switch-arguments switch args)
;; Return the arguments passed for the occurrences of SWITCH--e.g.,
[-- Attachment #3: Type: text/plain, Size: 167 bytes --]
It should leave the behavior unchanged in build environments, while
allowing libraries that are symlinks to the store in user environments.
Thanks!
Ludo’.
next prev parent reply other threads:[~2013-06-12 7:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-07 15:42 Installing guix from Git Konrad Hinsen
2013-06-07 16:22 ` Ludovic Courtès
2013-06-08 17:16 ` Konrad Hinsen
2013-06-08 17:27 ` Nikita Karetnikov
2013-06-09 10:03 ` Konrad Hinsen
2013-06-09 10:23 ` Ludovic Courtès
2013-06-10 6:33 ` Konrad Hinsen
2013-06-10 8:26 ` Ludovic Courtès
2013-06-10 8:27 ` Ludovic Courtès
2013-06-10 9:55 ` Konrad Hinsen
2013-06-10 22:02 ` Ludovic Courtès
2013-06-11 8:20 ` Konrad Hinsen
2013-06-11 12:17 ` Ludovic Courtès
2013-06-11 13:23 ` Konrad Hinsen
2013-06-11 13:58 ` Ludovic Courtès
2013-06-11 15:30 ` Konrad Hinsen
2013-06-11 22:35 ` Ludovic Courtès
2013-06-12 7:11 ` Konrad Hinsen
2013-06-12 7:43 ` Ludovic Courtès [this message]
2013-06-11 19:47 ` Konrad Hinsen
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=87k3lzlqpd.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=bug-guix@gnu.org \
--cc=konrad.hinsen@fastmail.net \
/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).