@@ -425,6 +427,15 @@ exec_with_loader (const char *store, int argc, char *argv[])
mkdir_p (new_store_parent);
symlink (store, new_store);
+#ifdef GCONV_DIRECTORY
+ /* Tell libc where to find its gconv modules. This is necessary because
+ gconv uses non-interposable 'open' calls. */
+ char *gconv_path = concat (store,
+ GCONV_DIRECTORY + sizeof "@STORE_DIRECTORY@");
+ setenv ("GCONV_PATH", gconv_path, 1);
+ free (gconv_path);
+#endif
+
setenv ("FAKECHROOT_BASE", new_root, 1);
pid_t child = fork ();
@@ -739,6 +739,12 @@ last resort for relocation."
bv 0 (bytevector-length bv))
(utf8->string bv)))))
+ (define (gconv-directory directory)
+ ;; Return DIRECTORY/gconv if it exists as a directory.
+ (let ((gconv (string-append directory "/gconv")))
+ (and (directory-exists? gconv)
+ gconv)))
+
(define (elf-loader-compile-flags program)
;; Return the cpp flags defining macros for the ld.so/fakechroot
;; wrapper of PROGRAM.
@@ -750,8 +756,9 @@ last resort for relocation."
(match (elf-dynamic-info elf)
(#f '())
(dyninfo
- (let ((runpath (elf-dynamic-info-runpath dyninfo))
- (interp (elf-interpreter elf)))
+ (let* ((runpath (elf-dynamic-info-runpath dyninfo))
+ (gconv (any gconv-directory runpath))
+ (interp (elf-interpreter elf)))
(if interp
(list (string-append "-DPROGRAM_INTERPRETER=\""
interp "\"")
@@ -762,7 +769,12 @@ last resort for relocation."
", ")
", NULL }")
(string-append "-DFAKECHROOT_LIBRARY=\""
- #$(fakechroot-library) "\""))
+ #$(fakechroot-library) "\"")
+
+ (if gconv
+ (string-append "-DGCONV_DIRECTORY=\""
+ gconv "\"")
+ "-UGCONV_DIRECTORY"))
'())))))
'()))