Attached please find an updated patch for #650141; it should apply to
the head of the debianutils git repository.

Let me know if you see any problem with it.

Thanks for maintaining debianutils,

    --dkg

commit 08c62ded83444d40f696143fc680b7b88807b9a6
Author: Daniel Kahn Gillmor <d...@fifthhorseman.net>
Date:   Thu Dec 1 20:09:49 2011 -0500

    ischroot now "detects" a chroot under fakechroot (Closes: #650141)

diff --git a/ischroot.c b/ischroot.c
index f280602..9af6ea2 100644
--- a/ischroot.c
+++ b/ischroot.c
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -36,6 +37,18 @@ void usage()
   exit(0);
 }
 
+/* return 1 if we are operating within a fakechroot environment,
+   return 0 otherwise */
+int isfakechroot()
+{
+  const char *fakechroot, *ldpreload;
+  return ((fakechroot = getenv("FAKECHROOT")) &&
+	  (strcmp("true", fakechroot) == 0) &&
+	  (NULL != getenv("FAKECHROOT_BASE")) &&
+	  (ldpreload = getenv("LD_PRELOAD")) &&
+	  (NULL != strstr(ldpreload, "libfakechroot.so")));
+}
+
 #if defined (__linux__)
 
 /* On Linux we can detect chroots by checking if the 
@@ -183,7 +196,10 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  exit_status = ischroot();
+  if (isfakechroot())
+    exit_status = 0;
+  else
+    exit_status = ischroot();
 
   if (exit_status == 2) {
     if (default_true)

Attachment: pgp5Gip1Lvfj6.pgp
Description: PGP signature

Reply via email to