Jan Nieuwenhuizen <jann...@gnu.org> skribis: > Ludovic Courtès writes: > >> Out of curiosity, what package was this? > > I encountered it first in jison, a javascript parser generator.
How does the script determines its location? Using $0 is unreliable, and using /proc/self/exe is non portable. >> Since this is a rebuild-the-world change, I applied to to a new >> ‘core-updates’ branch (and adjusted the commit log.) > > Yes, I got bitten by that, trying to test it. I had an interesting > learning experience getting to know guix and getting this to work and > reverted to using > > (#phases > (replace 'patch-source-shebangs > ;;patch-source-shebangs-no-symlinks > (lambda* (#:key outputs #:allow-other-keys) > (for-each patch-shebang > (remove (lambda (file) > (or (not (file-exists? file)) ;dangling > symlink > ;;(file-is-symlink? file) > (and (file-exists? file) > (eq? 'symlink (stat:type (lstat > file)))) > (file-is-directory? file))) > (find-files "."))))) > > in the package itself. Rebuilding the world is no fun when you want to > get things done. Yeah. In such cases it’s easier to simply delete or customize the faulty phase like you did above. > When I actually got to test it, it appears that something like the above > is still necessary. It seems that the previous patch merely avoids > visiting any symlinked directories, while this version actually looks > at the script to be patched. [...] > diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm > index 2abaa6e..34edff7 100644 > --- a/guix/build/gnu-build-system.scm > +++ b/guix/build/gnu-build-system.scm > @@ -303,7 +303,7 @@ makefiles." > (define (list-of-files dir) > (map (cut string-append dir "/" <>) > (or (scandir dir (lambda (f) > - (let ((s (stat (string-append dir "/" f)))) > + (let ((s (lstat (string-append dir "/" f)))) > (eq? 'regular (stat:type s))))) > '()))) This is exactly what the previous patch does (applied as c13a9feb.) Am I missing something? Anyway, it seems clear enough that the effect of this one-liner is to prevent symlinks from being patched. :-) Ludo’.