Prepare for 2.5.
[febootstrap.git] / fakechroot-2.8-relchroot.patch
index 9ba4d80..4d2b093 100644 (file)
@@ -1,9 +1,13 @@
-This patch must be applied to fakeroot 2.8 in order to
+This patch must be applied to fakechroot 2.8 or SVN in order to
 enable correct handling of relative chroots, for rpm and yum.
 
 enable correct handling of relative chroots, for rpm and yum.
 
---- fakechroot-2.8.orig/src/libfakechroot.c    2009-03-18 11:39:33.000000000 +0000
-+++ fakechroot-2.8.rpm/src/libfakechroot.c     2009-03-18 12:43:51.000000000 +0000
-@@ -1110,7 +1110,7 @@ int chroot (const char *path)
+Note this patch has been included in upstream fakechroot >= 2.9
+
+Index: src/libfakechroot.c
+===================================================================
+--- src/libfakechroot.c        (revision 311)
++++ src/libfakechroot.c        (working copy)
+@@ -1147,7 +1147,7 @@
  {
      char *ptr, *ld_library_path, *tmp, *fakechroot_path;
      int status, len;
  {
      char *ptr, *ld_library_path, *tmp, *fakechroot_path;
      int status, len;
@@ -12,7 +16,18 @@ enable correct handling of relative chroots, for rpm and yum.
  #if !defined(HAVE_SETENV)
      char *envbuf;
  #endif
  #if !defined(HAVE_SETENV)
      char *envbuf;
  #endif
-@@ -1134,23 +1134,21 @@ int chroot (const char *path)
+@@ -1162,7 +1162,9 @@
+         return -1;
+     }
+     if (*path != '/') {
+-        if (getcwd(cwd, FAKECHROOT_MAXPATH) == NULL) {
++        if (next_getcwd == NULL) fakechroot_init();
++
++        if (next_getcwd(cwd, FAKECHROOT_MAXPATH) == NULL) {
+             errno = ENAMETOOLONG;
+             return -1;
+         }
+@@ -1171,24 +1173,22 @@
              return -1;
          }
          if (strcmp(cwd, "/") == 0) {
              return -1;
          }
          if (strcmp(cwd, "/") == 0) {
@@ -27,15 +42,12 @@ enable correct handling of relative chroots, for rpm and yum.
      else {
 -        snprintf(full_path, FAKECHROOT_MAXPATH, "%s", path);
 -    }
      else {
 -        snprintf(full_path, FAKECHROOT_MAXPATH, "%s", path);
 -    }
--
--    fakechroot_path = getenv("FAKECHROOT_BASE");
 +      fakechroot_path = getenv("FAKECHROOT_BASE");
  
 +      fakechroot_path = getenv("FAKECHROOT_BASE");
  
+-    fakechroot_path = getenv("FAKECHROOT_BASE");
+-
 -    if (fakechroot_path != NULL) {
 -        snprintf(dir, FAKECHROOT_MAXPATH, "%s%s", fakechroot_path, full_path);
 -    if (fakechroot_path != NULL) {
 -        snprintf(dir, FAKECHROOT_MAXPATH, "%s%s", fakechroot_path, full_path);
--    }
--    else {
--        snprintf(dir, FAKECHROOT_MAXPATH, "%s", full_path);
 +      if (fakechroot_path != NULL) {
 +          snprintf(dir, FAKECHROOT_MAXPATH, "%s%s", fakechroot_path, path);
 +      }
 +      if (fakechroot_path != NULL) {
 +          snprintf(dir, FAKECHROOT_MAXPATH, "%s%s", fakechroot_path, path);
 +      }
@@ -43,5 +55,9 @@ enable correct handling of relative chroots, for rpm and yum.
 +          snprintf(dir, FAKECHROOT_MAXPATH, "%s", path);
 +      }
      }
 +          snprintf(dir, FAKECHROOT_MAXPATH, "%s", path);
 +      }
      }
+-    else {
+-        snprintf(dir, FAKECHROOT_MAXPATH, "%s", full_path);
+-    }
  
  #if defined(HAVE___XSTAT) && defined(_STAT_VER)
  
  #if defined(HAVE___XSTAT) && defined(_STAT_VER)
+     if ((status = next___xstat(_STAT_VER, dir, &sb)) != 0) {