diff options
author | Ludovic Courtès <ludovic.courtes@inria.fr> | 2020-08-27 15:08:05 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-08-27 19:58:16 +0200 |
commit | 28dce8f02db38a41e59ecdf3786baa6f732636ff (patch) | |
tree | 15e625dc5abd72a6be4805e35a31119c88247fda /gnu/packages/aux-files/run-in-namespace.c | |
parent | 8df6900dffa9e1c74ac3f64877f067974eee0eeb (diff) | |
download | guix-28dce8f02db38a41e59ecdf3786baa6f732636ff.tar.gz |
pack: fakechroot: Honor $LD_LIBRARY_PATH.
Until now, when using the "fakechroot" engine, $LD_LIBRARY_PATH would always be ignored. However, it's useful in some cases to allow users to specify LD_LIBRARY_PATH, so honor it. * gnu/packages/aux-files/run-in-namespace.c (concat_paths): New function. (exec_with_loader): Concatenante $LD_LIBRARY_PATH to the relocated AUDIT_LIBRARY_PATH.
Diffstat (limited to 'gnu/packages/aux-files/run-in-namespace.c')
-rw-r--r-- | gnu/packages/aux-files/run-in-namespace.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/gnu/packages/aux-files/run-in-namespace.c b/gnu/packages/aux-files/run-in-namespace.c index 436c0b6286..52a16a5362 100644 --- a/gnu/packages/aux-files/run-in-namespace.c +++ b/gnu/packages/aux-files/run-in-namespace.c @@ -405,6 +405,23 @@ relocated_search_path (const char *path[], const char *store) return new_path; } +/* Concatenate PATH1 and PATH2 with a colon in between. The result is + potentially malloc'd. */ +static char * +concat_paths (const char *path1, const char *path2) +{ + if (path1[0] == '\0') + return (char *) path2; + else + { + char *result = xmalloc (strlen (path1) + strlen (path2) + 2); + strcpy (result, path1); + strcat (result, ":"); + strcat (result, path2); + return result; + } +} + /* Execute the wrapped program by invoking the loader (ld.so) directly, passing it the audit module and preloading libfakechroot.so. */ static void @@ -421,9 +438,12 @@ exec_with_loader (const char *store, int argc, char *argv[]) loader_argv[2] = concat (store, LOADER_AUDIT_MODULE + sizeof original_store); - /* The audit module depends on libc.so and libgcc_s.so. */ + /* The audit module depends on libc.so and libgcc_s.so so honor + AUDIT_LIBRARY_PATH. Additionally, honor $LD_LIBRARY_PATH if set. */ loader_argv[3] = "--library-path"; - loader_argv[4] = relocated_search_path (audit_library_path, store); + loader_argv[4] = + concat_paths (getenv ("LD_LIBRARY_PATH") ?: "", + relocated_search_path (audit_library_path, store)); loader_argv[5] = "--preload"; loader_argv[6] = concat (store, |