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.master
parent
1d1fa9327c
commit
c23d17095d
|
@ -122,7 +122,13 @@ with the bytes in HEADER, a bytevector."
|
||||||
(get-bytevector-n port len))
|
(get-bytevector-n port len))
|
||||||
#:binary #t #:guess-encoding #f))
|
#: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
|
(define %elf-magic-bytes
|
||||||
;; Magic bytes of ELF files. See <elf.h>.
|
;; Magic bytes of ELF files. See <elf.h>.
|
||||||
|
|
Reference in New Issue