diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-11-23 19:15:21 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-11-23 19:19:35 +0100 |
commit | c23d17095db0611d8ee32357f17da441bcb0bc75 (patch) | |
tree | 767b4d10bcedbeea907ba014ecafd929a8309867 | |
parent | 1d1fa9327c839bf7af92dd38d8306df0d456c11e (diff) | |
download | guix-c23d17095db0611d8ee32357f17da441bcb0bc75.tar guix-c23d17095db0611d8ee32357f17da441bcb0bc75.tar.gz |
utils: 'elf-file?' and 'ar-file?' return #f for directories.
This avoids uncaught exceptions when the 'strip' phase would call these
procedures on symlinks to directories, such as 'lib/terminfo' in
ncurses (see <http://hydra.gnu.org/build/167310/nixlog/1/tail-reload>.)
* guix/build/utils.scm (file-header-match): Catch 'system-error', and
return #f upon EISDIR.
-rw-r--r-- | guix/build/utils.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm index a3050b955c..c480dbf8a6 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -122,7 +122,13 @@ with the bytes in HEADER, a bytevector." (get-bytevector-n port len)) #:binary #t #:guess-encoding #f)) - (equal? (get-header) header))) + (catch 'system-error + (lambda () + (equal? (get-header) header)) + (lambda args + (if (= EISDIR (system-error-errno args)) + #f ;FILE is a directory + (apply throw args)))))) (define %elf-magic-bytes ;; Magic bytes of ELF files. See <elf.h>. |