Bug#561991: patch for debian bug #561991

2010-08-13 Thread Piotr Roszatycki
tags 561991 pending
thanks

Already applied to git repository with proper test unit.

Thank you very much for fixing that.

2010/7/7 Guido Günther a...@sigxcpu.org

 Hi,
 On Thu, May 20, 2010 at 10:29:44PM -0400, Daniel Kahn Gillmor wrote:
  tags 561991 + patch
  thanks
 
  The attached patch should resolve debian bug 561991 by aligning the
  value stored by fakechrooted lstat() in buf.st_size with the length
  returned by the fakechroot'ed readlink().
 
  This is the resolution option i numbered as 1 in my previous e-mail.
 
  hope this helps,
 Daniel's patch looks good to me. Will this be fixed?
 Cheers,
  -- Guido




-- 
 .''`.Piotr Roszatycki
: :' :mailto:piotr.roszaty...@gmail.com
`. `' mailto:dex...@debian.org
  `-


Bug#561991: patch for debian bug #561991

2010-07-07 Thread Guido Günther
Hi,
On Thu, May 20, 2010 at 10:29:44PM -0400, Daniel Kahn Gillmor wrote:
 tags 561991 + patch
 thanks
 
 The attached patch should resolve debian bug 561991 by aligning the
 value stored by fakechrooted lstat() in buf.st_size with the length
 returned by the fakechroot'ed readlink().
 
 This is the resolution option i numbered as 1 in my previous e-mail.
 
 hope this helps,
Daniel's patch looks good to me. Will this be fixed?
Cheers,
 -- Guido



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#561991: patch for debian bug #561991

2010-05-20 Thread Daniel Kahn Gillmor
tags 561991 + patch
thanks

The attached patch should resolve debian bug 561991 by aligning the
value stored by fakechrooted lstat() in buf.st_size with the length
returned by the fakechroot'ed readlink().

This is the resolution option i numbered as 1 in my previous e-mail.

hope this helps,

--dkg
commit c4dda5ab637a9d9b38f1b9c09b5d23cb07a8a7f7
Author: Daniel Kahn Gillmor d...@fifthhorseman.net
Date:   Thu May 20 22:24:57 2010 -0400

aligning st_size in lstat() calls with size ultimately returned by fakechrooted readlink

diff --git a/src/libfakechroot.c b/src/libfakechroot.c
index 427dfde..1a6c93c 100644
--- a/src/libfakechroot.c
+++ b/src/libfakechroot.c
@@ -896,10 +896,19 @@ int __fxstatat64 (int ver, int dirfd, const char *pathname, struct stat64 *buf,
 /* #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 +918,19 @@ int __lxstat (int ver, const char *filename, struct stat *buf)
 /* #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
 
@@ -2203,10 +2221,19 @@ int lsetxattr (const char *path, const char *name, const void *value, size_t siz
 /* #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];
+int retval;
+READLINK_TYPE_RETURN status;
+const char* orig;
+orig = file_name;
 expand_chroot_path(file_name, fakechroot_path, fakechroot_ptr, fakechroot_buf);
 if (next_lstat == NULL) fakechroot_init();
-return next_lstat(file_name, buf);
+retval = next_lstat(file_name, 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
 
@@ -2217,10 +2244,19 @@ int lstat (const char *file_name, struct stat *buf)
 /* #include unistd.h */
 int lstat64 (const char *file_name, 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 = file_name;
 expand_chroot_path(file_name, fakechroot_path, fakechroot_ptr, fakechroot_buf);
 if (next_lstat64 == NULL) fakechroot_init();
-return next_lstat64(file_name, buf);
+retval = next_lstat64(file_name, 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
 #endif


signature.asc
Description: OpenPGP digital signature