Package: fakeroot
Version: 1.11
Severity: normal

Fakeroot wrapped calls to fchmodat() fail on large (>2gb?) files with EOVERFLOW.

I'm using debian lenny, fakeroot 1.11, in an i386 chroot on a system with an 
amd64 kernel.  An amd64 userspace does not appear to have this issue.

To reproduce, try calling fchmodat() via fakeroot on a 3gb file:

$ cat >test.cpp <<END
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <sys/errno.h>
#include <stdio.h>
#include <string.h>
int main() {
 if(fchmodat(AT_FDCWD, "bigfile", 0777, 0)) {
   printf("failure: %d %s\n", errno, strerror(errno));
 } else {
   printf("ok\n");
} }
END
$ g++ test.cpp -o test
$ dd if=/dev/zero of=bigfile bs=1000 count=3000000
3000000+0 records in
3000000+0 records out
3000000000 bytes (3.0 GB) copied, 38.8445 s, 77.2 MB/s
$ ./test
ok
$ fakeroot ./test
failure: 75 Value too large for defined data type
$
I suspect this is because the wrapper always delegates to fstatat() rather than 
using fstatat64() when available.  This diff appears to resolve the issue:

------------------------------
--- libfakeroot.c.original      2008-08-03 22:26:50.000000000 +0000
+++ libfakeroot.c       2009-05-08 18:53:30.000000000 +0000
@@ -900,11 +900,16 @@
int fchmodat(int dir_fd, const char *path, mode_t mode, int flags) {
/*   (int fd, mode_t mode){*/
  int r;
-  struct stat st;

  /* If AT_SYMLINK_NOFOLLOW is set in the fchownat call it should
     be when we stat it. */
+#ifdef STAT64_SUPPORT
+  struct stat64 st;
+  r=NEXT_FSTATAT64(_STAT_VER, dir_fd, path, &st, flags & AT_SYMLINK_NOFOLLOW);
+#else
+  struct stat st;
  r=NEXT_FSTATAT(_STAT_VER, dir_fd, path, &st, flags & AT_SYMLINK_NOFOLLOW);
+#endif
if(r)
    return(r);
------------------------------

-- System Information:
Debian Release: 5.0.1
 APT prefers stable
 APT policy: (500, 'stable')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=ANSI_X3.4-1968) 
(ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/bash

Versions of packages fakeroot depends on:
ii  libc6                         2.7-18     GNU C Library: Shared libraries

fakeroot recommends no packages.

fakeroot suggests no packages.

-- no debconf information




--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to