From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Installing guix from Git Date: Wed, 12 Jun 2013 09:43:10 +0200 Message-ID: <87k3lzlqpd.fsf@gnu.org> References: <20913.65355.709961.445483@Konrad-Hinsens-MacBook-Pro.local> <87y5alevqt.fsf@gnu.org> <20915.26337.951308.384585@Konrad-Hinsens-MacBook-Pro.local> <87wqq48qd4.fsf@karetnikov.org> <20916.21220.189793.288404@Ordinateur-de-Catherine-Konrad.local> <8761xnoa4k.fsf@gnu.org> <20917.29505.485414.981206@Konrad-Hinsens-MacBook-Pro.local> <87ehcatlof.fsf@gnu.org> <20917.41598.314095.196531@Konrad-Hinsens-MacBook-Pro.local> <87ip1lsjy2.fsf@gnu.org> <20918.56758.65940.503085@Konrad-Hinsens-MacBook-Pro.local> <87zjuwon8i.fsf@gnu.org> <20919.9414.381369.916178@Konrad-Hinsens-MacBook-Pro.local> <87r4g8oik1.fsf@gnu.org> <20919.17025.684302.279219@Konrad-Hinsens-MacBook-Pro.local> <87zjuwl1i6.fsf@gnu.org> <20920.7963.954762.497815@Konrad-Hinsens-MacBook-Pro.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umfn0-0003md-Is for bug-guix@gnu.org; Wed, 12 Jun 2013 03:48:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Umfmz-0008C4-6S for bug-guix@gnu.org; Wed, 12 Jun 2013 03:48:18 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:33737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umfmy-0008Bw-TH for bug-guix@gnu.org; Wed, 12 Jun 2013 03:48:17 -0400 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") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Konrad Hinsen Cc: bug-guix@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Konrad Hinsen skribis: > Ludovic Court=C3=A8s writes: > > > Yes, probably (this is not a problem when it=E2=80=99s 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 =E2=80=98core-updates=E2=80=99 branch: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable commit cfbf7877a673400881db20521a9d6a44261ed62b (HEAD, refs/heads/core-upda= tes) Author: Ludovic Court=C3=A8s Date: Wed Jun 12 09:39:31 2013 +0200 ld-wrapper: Unless in a build env., allow files that symlink to the sto= re. =20=20=20=20 * 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=3D"(@ (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 =C2=A9 2012 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2012, 2013 Ludovic Court=C3=A8s ;;; ;;; 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")) =20 (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)))))))) =20 (define (switch-arguments switch args) ;; Return the arguments passed for the occurrences of SWITCH--e.g., --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable It should leave the behavior unchanged in build environments, while allowing libraries that are symlinks to the store in user environments. Thanks! Ludo=E2=80=99. --=-=-=--