debootstrap --variant=fakechroot does not currently work on squeeze.
It fails with error messages like:
W: Failure while unpacking required packages. This will be attempted up to
five times.
These errors appear to be due to two distinct bugs: #561991 and #588508
Maybe a targeted patch of these two bugs in fakechroot is a good
candidate for the next point release of squeeze?
I'm attaching a debdiff against what is currently in stable (2.9-1.1).
i tested this as a non-privileged user on an i386 squeeze environment with:
mkdir root
PATH=/sbin:/usr/sbin:$PATH fakeroot \
-i $(pwd)/fakeroot.state \
-s $(pwd)/fakeroot.state \
fakechroot \
debootstrap --variant=fakechroot squeeze root
Without these patches applied, the base fakechroot does not succeed.
With these patches applied, it completes successfully.
I also tried fixing only one bug or the other, but debootstrap failed to
complete without both fixes together, so i think they are both necessary.
I ran into these bugs while building debirf images. It would be nice
for users of debian stable to not have to use a backported fakechroot
for debirf.
I do not believe these fixes have any adverse affect on other uses of
fakechroot.
Is there anything else you need from me in order to consider this
request for a future point release?
Regards,
--dkg
PS i am not subscribed to debian-release -- please CC me on replies.
thanks!
diff -u fakechroot-2.9/configure.ac fakechroot-2.9/configure.ac
--- fakechroot-2.9/configure.ac
+++ fakechroot-2.9/configure.ac
@@ -172,6 +172,7 @@
unlinkat \
ulckpwdf \
utime \
+utimensat \
utimes \
])
diff -u fakechroot-2.9/config.h.in fakechroot-2.9/config.h.in
--- fakechroot-2.9/config.h.in
+++ fakechroot-2.9/config.h.in
@@ -368,6 +368,9 @@
/* Define to 1 if you have the `utimes' function. */
#undef HAVE_UTIMES
+/* Define to 1 if you have the `utimensat' function. */
+#undef HAVE_UTIMENSAT
+
/* Define to 1 if you have the utime.h header file. */
#undef HAVE_UTIME_H
diff -u fakechroot-2.9/configure fakechroot-2.9/configure
--- fakechroot-2.9/configure
+++ fakechroot-2.9/configure
@@ -12458,6 +12458,7 @@
unlinkat \
ulckpwdf \
utime \
+utimensat \
utimes \
do :
diff -u fakechroot-2.9/src/libfakechroot.c fakechroot-2.9/src/libfakechroot.c
--- fakechroot-2.9/src/libfakechroot.c
+++ fakechroot-2.9/src/libfakechroot.c
@@ -543,6 +543,9 @@
/* static int (*next_ulckpwdf) (void) = NULL; */
#endif
static int (*next_utime) (const char *filename, const struct utimbuf *buf)
= NULL;
+#ifdef HAVE_UTIMENSAT
+static int (*next_utimensat) (int dirfd, const char *pathname, const
struct timespec times[2], int flags) = NULL;
+#endif
static int (*next_utimes) (const char *filename, const struct timeval
tv[2]) = NULL;
@@ -821,6 +824,9 @@
/*nextsym(ulckpwdf, ulckpwdf); */
#endif
nextsym(utime, utime);
+#ifdef HAVE_UTIMENSAT
+nextsym(utimensat, utimensat);
+#endif
nextsym(utimes, utimes);
}
@@ -896,10 +902,19 @@
/* #include unistd.h */
int __lxstat (int ver, const char *filename, struct stat *buf)
{
-char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+char *fakechroot_path, *fakechroot_ptr,
fakechroot_buf[FAKECHROOT_MAXPATH], tmp[FAKECHROOT_MAXPATH];
+int retval;
+READLINK_TYPE_RETURN status;
+const char* orig;
+orig = filename;
expand_chroot_path(filename, fakechroot_path, fakechroot_ptr,
fakechroot_buf);
if (next___lxstat == NULL) fakechroot_init();
-return next___lxstat(ver, filename, buf);
+retval = next___lxstat(ver, filename, buf);
+/* deal with http://bugs.debian.org/561991 */
+if ((buf-st_mode S_IFMT) == S_IFLNK)
+ if ((status = readlink(orig, tmp, sizeof(tmp)-1)) != -1)
+buf-st_size = status;
+return retval;
}
#endif
@@ -909,10 +924,19 @@
/* #include unistd.h */
int __lxstat64 (int ver, const char *filename, struct stat64 *buf)
{
-char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+char *fakechroot_path, *fakechroot_ptr,
fakechroot_buf[FAKECHROOT_MAXPATH], tmp[FAKECHROOT_MAXPATH];
+int retval;
+READLINK_TYPE_RETURN status;
+const char* orig;
+orig = filename;
expand_chroot_path(filename, fakechroot_path, fakechroot_ptr,
fakechroot_buf);
if (next___lxstat64 == NULL) fakechroot_init();
-return next___lxstat64(ver, filename, buf);
+retval = next___lxstat64(ver, filename, buf);
+/* deal with http://bugs.debian.org/561991 */
+if ((buf-st_mode S_IFMT) == S_IFLNK)
+ if ((status = readlink(orig, tmp, sizeof(tmp)-1)) != -1)
+buf-st_size = status;
+return retval;
}
#endif
@@ -2158,10 +2182,19 @@
/* #include unistd.h */
int lstat (const char *file_name, struct stat *buf)
{
-char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_MAXPATH];
+char *fakechroot_path, *fakechroot_ptr,
fakechroot_buf[FAKECHROOT_MAXPATH], tmp[FAKECHROOT_MAXPATH];
+