#1071571 mdir: wrong byte count reported in summary

Package:
mtools
Source:
mtools
Description:
Tools for manipulating MSDOS files
Submitter:
g1
Date:
2024-05-21 12:42:04 UTC
Severity:
normal
Tags:
#1071571#5
Date:
2024-05-21 12:31:17 UTC
From:
To:
The overall byte count shown in the summary is truncated (from the left)
to ten effective digits, and is therefore wrong as soon as it reaches
10 GB (10^10 B):

$ mdir f:abc
 Volume in drive F has no label
 Volume Serial Number is 1234-5678
Directory for F:/abc

.            <DIR>     2024-05-21  13:32
..           <DIR>     2024-05-21  13:32
f1          3000000000 2024-05-21  13:32
f2          3000000000 2024-05-21  13:32
f3          3000000000 2024-05-21  13:32
f4          3000000000 2024-05-21  13:32
        6 files       2 000 000 000 bytes ** should be 12 000 000 000 **
                     17 331 192 064 bytes free

I haven't the time to modify dotted_num() to prevent omission of the most
significant digits, but the following patch is a quick fix for sizes up
to 10 TB - 1.

Best regards,
	g.b.
--- mdir.c.old	2021-07-15 14:28:53.000000000 +0200
+++ mdir.c	2024-05-21 13:18:25.079157668 +0200
@@ -229,8 +229,8 @@
 			putchar(' ');
 		else
 			putchar('s');
-		printf("       %s bytes\n",
-		       dotted_num(bytes, 13, &s1));
+		printf("   %s bytes\n",
+		       dotted_num(bytes, 17, &s1));
 		if(s1)
 			free(s1);
 	}