expose and fix 2Gb file bug, RT #32639, RT #33903
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 16 Mar 2008 13:34:34 +0000 (13:34 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 16 Mar 2008 13:34:34 +0000 (13:34 +0000)
git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/fuse/perl-llin@119 6e4b0b00-1209-0410-87b2-b275959b5705

Fuse.xs
test/getattr.t

diff --git a/Fuse.xs b/Fuse.xs
index 9e1d671..3a07821 100644 (file)
--- a/Fuse.xs
+++ b/Fuse.xs
@@ -64,7 +64,7 @@ int _PLfuse_getattr(const char *file, struct stat *result) {
                result->st_ctime = POPi;
                result->st_mtime = POPi;
                result->st_atime = POPi;
-               result->st_size = POPi;
+               result->st_size = (size_t)POPi;
                result->st_rdev = POPi;
                result->st_gid = POPi;
                result->st_uid = POPi;
index 2e6f017..62e3670 100644 (file)
@@ -2,9 +2,14 @@
 use test::helper qw($_real $_point);
 use Test::More;
 use Data::Dumper;
-plan tests => 28;
+plan tests => 29;
 my ($a, $b) = ("$_real/wibble","$_point/wibble");
-`touch $b`;
+# create 3G file to expose 2G bug
+open(my $fh, '>', $a) || die "can't open $b: $!";
+seek($fh, 3 * 1024 * 1024 * 1024, 0);
+print $fh ' ';
+close($fh);
+diag "size $b = ",-s $b;
 is(-A "$a", -A "$b", '-A'); # 1
 is(-B "$a", -B "$b", '-B'); # 2
 is(-C "$a", -C "$b", '-C'); # 3
@@ -39,4 +44,4 @@ my (@astat, @bstat);
 @astat = @astat[2..10,12];
 @bstat = @bstat[2..10,12];
 is(join(" ",@astat),join(" ",@bstat),"stat()");
-`rm -f $a`;
+ok( unlink($a), 'unlink' );