mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
pack: "fakechroot" execution engine can load its audit module.
Fixes <https://bugs.gnu.org/42558>. Until now, loading 'pack-audit.so' in a truly non-Guix environment would usually fail because 'pack-audit.so' depends on 'libgcc_s.so' and 'libc.so', none of which could be found. Furthermore, the test was not working as expected: the trick unshare -mrf sh -c 'mount -t tmpfs none /gnu ; ...' would allow the fakechroot engine to make its store available as /gnu/store as a result of another bug. * gnu/packages/aux-files/run-in-namespace.c (relocated_search_path): New function. (exec_with_loader): Pass "--library-path" to the loader. * guix/scripts/pack.scm (wrapped-package)[build](runpath): New procedure. (elf-loader-compile-flags): Pass "-DLOADER_AUDIT_RUNPATH". * tests/guix-pack-relocatable.sh: Remove 'STORE_PARENT'. (run_without_store): New function. Erase $NIX_STORE_DIR instead of $STORE_PARENT. Use 'run_without_store' throughout.
This commit is contained in:
parent
8b221b64a5
commit
c6c0d5a22c
3 changed files with 99 additions and 42 deletions
|
@ -744,11 +744,13 @@ last resort for relocation."
|
|||
(with-imported-modules (source-module-closure
|
||||
'((guix build utils)
|
||||
(guix build union)
|
||||
(guix build gremlin)
|
||||
(guix elf)))
|
||||
#~(begin
|
||||
(use-modules (guix build utils)
|
||||
((guix build union) #:select (relative-file-name))
|
||||
(guix elf)
|
||||
(guix build gremlin)
|
||||
(ice-9 binary-ports)
|
||||
(ice-9 ftw)
|
||||
(ice-9 match)
|
||||
|
@ -786,6 +788,14 @@ last resort for relocation."
|
|||
bv 0 (bytevector-length bv))
|
||||
(utf8->string bv)))))
|
||||
|
||||
(define (runpath file)
|
||||
;; Return the RUNPATH of FILE as a list of directories.
|
||||
(let* ((bv (call-with-input-file file get-bytevector-all))
|
||||
(elf (parse-elf bv))
|
||||
(dyninfo (elf-dynamic-info elf)))
|
||||
(or (and=> dyninfo elf-dynamic-info-runpath)
|
||||
'())))
|
||||
|
||||
(define (elf-loader-compile-flags program)
|
||||
;; Return the cpp flags defining macros for the ld.so/fakechroot
|
||||
;; wrapper of PROGRAM.
|
||||
|
@ -807,6 +817,13 @@ last resort for relocation."
|
|||
|
||||
(string-append "-DLOADER_AUDIT_MODULE=\""
|
||||
#$(audit-module) "\"")
|
||||
(string-append "-DLOADER_AUDIT_RUNPATH={ "
|
||||
(string-join
|
||||
(map object->string
|
||||
(runpath
|
||||
#$(audit-module)))
|
||||
", " 'suffix)
|
||||
"NULL }")
|
||||
(if gconv
|
||||
(string-append "-DGCONV_DIRECTORY=\""
|
||||
gconv "\"")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue