guix_mirror_bot pushed a commit to branch core-packages-team in repository guix.
commit 9d20b9068c266879d8b834b979e41340e93f97ca Author: Noé Lopez <[email protected]> AuthorDate: Fri Mar 27 22:54:59 2026 +0100 gremlin: Avoid error when running strip-runpath on Guile object files. * guix/build/gremlin.scm (strip-runpath): Add error handling for when there is no RUNPATH in the file. Change-Id: Ie7fbc7b67bf7b36c8c718b68611cf9ead18f685e --- guix/build/gremlin.scm | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/guix/build/gremlin.scm b/guix/build/gremlin.scm index bd56cf83030..41312a6cf01 100644 --- a/guix/build/gremlin.scm +++ b/guix/build/gremlin.scm @@ -393,7 +393,7 @@ be found in RUNPATH ~s~%" (define (strip-runpath file) "Remove from the DT_RUNPATH of FILE any entries that are not necessary -according to DT_NEEDED." +according to DT_NEEDED. Returns the new DT_RUNPATH." (define (minimal-runpath needed runpath) (filter (lambda (directory) (and (string-prefix? "/" directory) @@ -416,20 +416,24 @@ according to DT_NEEDED." entries)) (runpath (find (lambda (entry) (= DT_RUNPATH (dynamic-entry-type entry))) - entries)) - (old (search-path->list - (dynamic-entry-value runpath))) - (new (minimal-runpath needed old))) - (unless (equal? old new) - (format (current-error-port) - "~a: stripping RUNPATH to ~s (removed ~s)~%" - file new - (lset-difference string=? old new)) - (seek port (dynamic-entry-offset runpath) SEEK_SET) - (put-bytevector port (string->utf8 (string-join new ":"))) - (put-u8 port 0)) - (close-port port) - new)) + entries))) + (if (not runpath) + (begin + (format (current-error-port) "~a: has no RUNPATH to strip~%" file) + '()) + (let* ((old (search-path->list + (dynamic-entry-value runpath))) + (new (minimal-runpath needed old))) + (unless (equal? old new) + (format (current-error-port) + "~a: stripping RUNPATH to ~s (removed ~s)~%" + file new + (lset-difference string=? old new)) + (seek port (dynamic-entry-offset runpath) SEEK_SET) + (put-bytevector port (string->utf8 (string-join new ":"))) + (put-u8 port 0)) + (close-port port) + new)))) (lambda (key . args) (false-if-exception (close-port port)) (apply throw key args))))
