Hi again, Yesterday I only tested on amd64. Today, on an i386 machine I discovered that openat64() is needed, too.
I attach the complete debdiff against -1.3 again, for clarity. This obsoletes the previous patches I sent. Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
diff -u fakechroot-2.6/debian/changelog fakechroot-2.6/debian/changelog
--- fakechroot-2.6/debian/changelog
+++ fakechroot-2.6/debian/changelog
@@ -1,3 +1,19 @@
+fakechroot (2.6-1.3ubuntu0.1) hardy-proposed; urgency=low
+
+ * src/libfakechroot.c: Provide wrappings for some *at() functions which have
+ been introduced into Hardy's glibc and coreutils. Not wrapping them causes
+ fakechroot to be unusable to debootstrap and work with Hardy. Add the
+ following wrappings:
+ - __fxstatat() and __fxstatat64() to fix a whole range of shell tools,
+ - unlinkat(), to unbreak rm of absolute path names
+ - openat() and openat64(), to unbreak rm -r
+ - fchmodat(), to unbreak chmod
+ - fchownat(), to unbreak chown
+ This extends the original patch from Daniel Kahn Gillmor in Debian
+ #473682. (LP: #228534)
+
+ -- Martin Pitt <[EMAIL PROTECTED]> Fri, 09 May 2008 07:46:24 +0200
+
fakechroot (2.6-1.3) unstable; urgency=low
* Non-maintainer upload to fix the fix for the fix for #422586
diff -u fakechroot-2.6/src/libfakechroot.c fakechroot-2.6/src/libfakechroot.c
--- fakechroot-2.6/src/libfakechroot.c
+++ fakechroot-2.6/src/libfakechroot.c
@@ -321,7 +321,9 @@
#endif
static int (*next_chdir) (const char *path) = NULL;
static int (*next_chmod) (const char *path, mode_t mode) = NULL;
+static int (*next_fchmodat) (int dfd, const char *path, mode_t mode, int
flag) = NULL;
static int (*next_chown) (const char *path, uid_t owner, gid_t group) =
NULL;
+static int (*next_fchownat) (int dfd, const char *path, uid_t owner, gid_t
group, int flag) = NULL;
/* static int (*next_chroot) (const char *path) = NULL; */
static int (*next_creat) (const char *pathname, mode_t mode) = NULL;
static int (*next_creat64) (const char *pathname, mode_t mode) = NULL;
@@ -422,7 +424,9 @@
static int (*next_nftw64) (const char *dir, int (*fn)(const char *file,
const struct stat64 *sb, int flag, struct FTW *s), int nopenfd, int flags) =
NULL;
#endif
static int (*next_open) (const char *pathname, int flags, ...) = NULL;
+static int (*next_openat) (int dfd, const char *pathname, int flags, ...)
= NULL;
static int (*next_open64) (const char *pathname, int flags, ...) = NULL;
+static int (*next_openat64) (int dfd, const char *pathname, int flags,
...) = NULL;
#if !defined(HAVE___OPENDIR2)
static DIR * (*next_opendir) (const char *name) = NULL;
#endif
@@ -463,6 +467,9 @@
static int (*next_truncate64) (const char *path, off64_t length) = NULL;
#endif
static int (*next_unlink) (const char *pathname) = NULL;
+static int (*next_unlinkat) (int dirfd, const char *pathname, int flags) =
NULL;
+static int (*next___fxstatat) (int ver, int dirfd, const char *pathname,
struct stat *buf, int flags) = NULL;
+static int (*next___fxstatat64) (int ver, int dirfd, const char *pathname,
struct stat64 *buf, int flags) = NULL;
#ifdef HAVE_ULCKPWDF
/* static int (*next_ulckpwdf) (void) = NULL; */
#endif
@@ -536,7 +543,9 @@
#endif
nextsym(chdir, "chdir");
nextsym(chmod, "chmod");
+ nextsym(fchmodat, "fchmodat");
nextsym(chown, "chown");
+ nextsym(fchownat, "fchownat");
/* nextsym(chroot, "chroot"); */
nextsym(creat, "creat");
nextsym(creat64, "creat64");
@@ -637,7 +646,9 @@
nextsym(nftw64, "nftw64");
#endif
nextsym(open, "open");
+ nextsym(openat, "openat");
nextsym(open64, "open64");
+ nextsym(openat64, "openat64");
#if !defined(HAVE___OPENDIR2)
nextsym(opendir, "opendir");
#endif
@@ -678,6 +689,9 @@
nextsym(truncate64, "truncate64");
#endif
nextsym(unlink, "unlink");
+ nextsym(unlinkat, "unlinkat");
+ nextsym(__fxstatat, "__fxstatat");
+ nextsym(__fxstatat64, "__fxstatat64");
#ifdef HAVE_ULCKPWDF
/* nextsym(ulckpwdf, "ulckpwdf"); */
#endif
@@ -921,6 +935,13 @@
if (next_chmod == NULL) fakechroot_init();
return next_chmod(path, mode);
}
+int fchmodat (int dfd, const char *path, mode_t mode, int flag)
+{
+ char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+ expand_chroot_path(path, fakechroot_path, fakechroot_ptr, fakechroot_buf);
+ if (next_fchmodat == NULL) fakechroot_init();
+ return next_fchmodat(dfd, path, mode, flag);
+}
/* #include <sys/types.h> */
@@ -933,6 +954,13 @@
return next_chown(path, owner, group);
}
+int fchownat (int dfd, const char *path, uid_t owner, gid_t group, int flag)
+{
+ char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+ expand_chroot_path(path, fakechroot_path, fakechroot_ptr, fakechroot_buf);
+ if (next_fchownat == NULL) fakechroot_init();
+ return next_fchownat(dfd, path, owner, group, flag);
+}
/* #include <unistd.h> */
int chroot (const char *path)
@@ -1921,6 +1949,21 @@
return next_open(pathname, flags, mode);
}
+int openat (int dfd, const char *pathname, int flags, ...) {
+ int mode = 0;
+ char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+ expand_chroot_path(pathname, fakechroot_path, fakechroot_ptr,
fakechroot_buf);
+
+ if (flags & O_CREAT) {
+ va_list arg;
+ va_start (arg, flags);
+ mode = va_arg (arg, int);
+ va_end (arg);
+ }
+
+ if (next_openat == NULL) fakechroot_init();
+ return next_openat(dfd, pathname, flags, mode);
+}
/* #include <sys/types.h> */
/* #include <sys/stat.h> */
@@ -1942,6 +1985,22 @@
return next_open64(pathname, flags, mode);
}
+int openat64 (int dfd, const char *pathname, int flags, ...)
+{
+ int mode = 0;
+ char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+ expand_chroot_path(pathname, fakechroot_path, fakechroot_ptr,
fakechroot_buf);
+
+ if (flags & O_CREAT) {
+ va_list arg;
+ va_start (arg, flags);
+ mode = va_arg (arg, int);
+ va_end (arg);
+ }
+
+ if (next_openat64 == NULL) fakechroot_init();
+ return next_openat64(dfd, pathname, flags, mode);
+}
#if !defined(HAVE___OPENDIR2)
/* #include <sys/types.h> */
@@ -2222,6 +2281,31 @@
return next_unlink(pathname);
}
+/* #include <fcntl.h> */
+int unlinkat (int dirfd, const char *pathname, int flags)
+{
+ char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+ expand_chroot_path(pathname, fakechroot_path, fakechroot_ptr,
fakechroot_buf);
+ if (next_unlinkat == NULL) fakechroot_init();
+ return next_unlinkat(dirfd, pathname, flags);
+}
+
+/* #include <fcntl.h> */
+/* #include <sys/stat.h> */
+int __fxstatat (int ver, int dirfd, const char *pathname, struct stat *buf,
int flags)
+{
+ char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+ expand_chroot_path(pathname, fakechroot_path, fakechroot_ptr,
fakechroot_buf);
+ if (next___fxstatat == NULL) fakechroot_init();
+ return next___fxstatat(ver, dirfd, pathname, buf, flags);
+}
+int __fxstatat64 (int ver, int dirfd, const char *pathname, struct stat64
*buf, int flags)
+{
+ char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+ expand_chroot_path(pathname, fakechroot_path, fakechroot_ptr,
fakechroot_buf);
+ if (next___fxstatat64 == NULL) fakechroot_init();
+ return next___fxstatat64(ver, dirfd, pathname, buf, flags);
+}
/* #include <sys/types.h> */
/* #include <utime.h> */
signature.asc
Description: Digital signature

