Bug 4920

Summary: Samba dosen't properly count large (> 2GB) filesystems
Product: [Retired] Red Hat Linux Reporter: vectro
Component: sambaAssignee: Trond Eivind Glomsrxd <teg>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-09-19 23:14:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description vectro 1999-09-05 00:21:44 UTC
When performing tar or ls operations, samba uses an int
value to count the number of bytes. An unsigned long long is
more appropriate for this operation, but is not included in
the samba distribution because (AFAIK) it is not a
widely-supported type. It is, however, supported by RH6.0's
version of gcc/egcs/glibc.

This patch will change the type to an unsigned long long and
alleviate the issue:

diff -Naur samba-2.0.3/source/client/client.c
samba-2.0.3-fix/source/client/client.c
--- samba-2.0.3/source/client/client.c  Sat Feb 27 14:08:58
1999
+++ samba-2.0.3-fix/source/client/client.c      Sat Sep  4
16:56:47 1999
@@ -101,7 +101,7 @@
 int put_total_time_ms = 0;

 /* totals globals */
-int dir_total = 0;
+unsigned long long dir_total = 0;

 #define USENMB

@@ -430,7 +430,7 @@

        do_dskattr();

-       DEBUG(3, ("Total bytes listed: %d\n", dir_total));
+       DEBUG(3, ("Total bytes listed: %llu\n", dir_total));
 }


diff -Naur samba-2.0.3/source/client/clitar.c
samba-2.0.3-fix/source/client/clitar.c
--- samba-2.0.3/source/client/clitar.c  Sat Feb 27 14:08:59
1999
+++ samba-2.0.3-fix/source/client/clitar.c      Sat Sep  4
16:57:59 1999
@@ -85,7 +85,8 @@
 #endif

 static char *tarbuf, *buffer_p;
-static int tp, ntarf, tbufsiz, ttarf;
+static int tp, ntarf, tbufsiz;
+static unsigned long long ttarf;
 /* Incremental mode */
 BOOL tar_inc=False;
 /* Reset archive bit */
@@ -1512,7 +1513,7 @@
     free(tarbuf);

     DEBUG(0, ("tar: dumped %d tar files\n", ntarf));
-    DEBUG(0, ("Total bytes written: %d\n", ttarf));
+    DEBUG(0, ("Total bytes written: %llu\n", ttarf));
     break;
   }

And here is the appropriate spec file patch:

--- samba-old.spec      Sat Sep  4 17:09:10 1999
+++ samba.spec  Sat Sep  4 17:00:33 1999
@@ -12,6 +12,7 @@
 Patch1: smbw.patch
 Patch2: samba-glibc21.patch
 Patch3: samba-2.0.3-fixinit.patch
+Patch4: samba-2.0.3-largefs.patch
 Requires: pam >= 0.64
 BuildRoot: /var/tmp/samba-root
 Prereq: chkconfig fileutils
@@ -47,6 +48,7 @@
 %patch1 -p1 -b .smbw
 %patch2 -p1 -b .glibc21
 %patch3 -p1 -b .fixinit
+%patch4 -p1

 %build
 cd source

Comment 1 Michael K. Johnson 1999-09-19 23:14:59 UTC
This appears to be fixed in 2.0.5a, which uses a double instead
of a long long and then formats it appropriately.  2.0.5a is
included in RawHide and will be included in Red Hat Linux 6.1