[Fakeroot-commits] [SCM] fakeroot branch, upstream, updated. 04dab641455927d5062151311f4cb4c128aa6392

Clint Adams clint at debian.org
Sun Apr 22 02:15:22 UTC 2012


The following commit has been merged in the upstream branch:
commit 1ac75a8c1625f9edc67cd10724c6a26ee69a4557
Author: Mikhail Gusarov <mikhail.gusarov at cfengine.com>
Date:   Tue Apr 10 15:40:08 2012 +0200

    Wrap sysinfo(3) on Solaris in order to work around ISA issues
    
    Solaris provides a way to select binary basing on the available ISA, which
    breaks fakeroot running any non-trivial, as a mixture of 64-bit and 32-bit
    binaries are being executed. Unlike Linux, LD_PRELOAD'ed library of wrong
    architecture is not a warning, but a fatal error, and dynamic linker refuses to
    start instead of ignoring the library.
    
    In order to avoid this problem, fix the list of ISAs returned by sysinfo(3) to
    the ones compatible with the fakeroot's own binary.

diff --git a/libfakeroot.c b/libfakeroot.c
index e69240f..027fae3 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -108,6 +108,9 @@
 #if HAVE_FTS_H
 #include <fts.h>
 #endif /* HAVE_FTS_H */
+#ifdef __sun
+#include <sys/systeminfo.h>
+#endif
 
 #if !HAVE_DECL_SETENV
 extern int setenv (const char *name, const char *value, int replace);
@@ -1668,3 +1671,33 @@ fgetattrlist(int fd, void *attrList, void *attrBuf,
 }
 #endif /* if HAVE_FGETATTRLIST */
 #endif /* ifdef __APPLE__ */
+
+#ifdef __sun
+/*
+ * Disable the runtime selection of binaries on Solaris: libfakeroot is (yet?)
+ * unable to cope with several bitnesses of binaries being run.
+ */
+int sysinfo(int command, char *buf, long count)
+{
+    if (command == SI_ISALIST)
+    {
+        /* do the evil trick */
+#ifdef sparc
+#ifdef __arch64__
+        strncpy(buf, "sparcv9 sparc", count - 1);
+        return sizeof("sparcv9 sparc");
+#else
+        strncpy(buf, "sparcv7 sparc", count - 1);
+        return sizeof("sparcv7 sparc");
+#endif
+#else
+        strncpy(buf, "i386 i86", count - 1);
+        return sizeof("i386 i86");
+#endif
+    }
+    else
+    {
+        return next_sysinfo(command, buf, count);
+    }
+}
+#endif
diff --git a/wrapfunc.inp b/wrapfunc.inp
index 40f78eb..f2f8755 100644
--- a/wrapfunc.inp
+++ b/wrapfunc.inp
@@ -179,3 +179,7 @@ fts_children$INODE64;FTSENT *;(FTS *ftsp, int options);(ftsp, options)
 #endif
 #endif /* ifdef __APPLE__ */
 #endif /* HAVE_FTS_CHILDREN */
+
+#ifdef __sun
+sysinfo;int;(int command, char *buf, long count);(command, buf, count)
+#endif

-- 
fakeroot



More information about the Fakeroot-commits mailing list