fix rounding in size_to_human_string()
This commit is contained in:
parent
b9253e5c2b
commit
f546b1ae23
156
backpaort-fix-rounding-in-size_to_human_string.patch
Normal file
156
backpaort-fix-rounding-in-size_to_human_string.patch
Normal file
@ -0,0 +1,156 @@
|
||||
From b38c20e13a51acb7e3bb388e9cc17d5fc905e7d9 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Wed, 15 Apr 2020 15:01:12 +0200
|
||||
Subject: [PATCH] ilib/strutils: fix rounding in size_to_human_string()
|
||||
|
||||
Thanks to bub75 for the idea.
|
||||
|
||||
The patch adds SIZE_DECIMAL_2DIGITS into regression tests.
|
||||
|
||||
Addresses: https://github.com/karelzak/util-linux/issues/998
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
lib/strutils.c | 43 +++++++++++++++++++++--------
|
||||
tests/expected/misc/strtosize | 52 +++++++++++++++++------------------
|
||||
2 files changed, 58 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/lib/strutils.c b/lib/strutils.c
|
||||
index be404e703b..ccf48919bd 100644
|
||||
--- a/lib/strutils.c
|
||||
+++ b/lib/strutils.c
|
||||
@@ -602,24 +602,41 @@ char *size_to_human_string(int options, uint64_t bytes)
|
||||
|
||||
/* round */
|
||||
if (frac) {
|
||||
+ /* get 3 digits after decimal point */
|
||||
+ frac = (frac * 1000) / (1ULL << exp);
|
||||
+
|
||||
if (options & SIZE_DECIMAL_2DIGITS) {
|
||||
- frac = (frac / (1ULL << (exp - 10)) + 5) / 10;
|
||||
- if (frac % 10 == 0)
|
||||
- frac /= 10; /* convert N.90 to N.9 */
|
||||
+ /* round 4/5 and keep 2 digits after decimal point */
|
||||
+ frac = (frac + 5) / 10 ;
|
||||
} else {
|
||||
- frac = (frac / (1ULL << (exp - 10)) + 50) / 100;
|
||||
- if (frac == 10)
|
||||
- dec++, frac = 0;
|
||||
+ /* round 4/5 and keep 1 digit after decimal point */
|
||||
+ frac = ((frac + 50) / 100) * 10 ;
|
||||
+ }
|
||||
+
|
||||
+ /* rounding could have overflowed */
|
||||
+ if (frac == 100) {
|
||||
+ dec++;
|
||||
+ frac = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (frac) {
|
||||
struct lconv const *l = localeconv();
|
||||
char *dp = l ? l->decimal_point : NULL;
|
||||
+ int len;
|
||||
|
||||
if (!dp || !*dp)
|
||||
dp = ".";
|
||||
- snprintf(buf, sizeof(buf), "%d%s%" PRIu64 "%s", dec, dp, frac, suffix);
|
||||
+
|
||||
+ len = snprintf(buf, sizeof(buf), "%d%s%02" PRIu64, dec, dp, frac);
|
||||
+ if (len > 0 && (size_t) len < sizeof(buf)) {
|
||||
+ /* remove potential extraneous zero */
|
||||
+ if (buf[len - 1] == '0')
|
||||
+ buf[len--] = '\0';
|
||||
+ /* append suffix */
|
||||
+ xstrncpy(buf+len, suffix, sizeof(buf) - len);
|
||||
+ } else
|
||||
+ *buf = '\0'; /* snprintf error */
|
||||
} else
|
||||
snprintf(buf, sizeof(buf), "%d%s", dec, suffix);
|
||||
|
||||
@@ -1051,7 +1068,7 @@ static int test_strdup_to_member(int argc, char *argv[])
|
||||
static int test_strutils_sizes(int argc, char *argv[])
|
||||
{
|
||||
uintmax_t size = 0;
|
||||
- char *hum, *hum2;
|
||||
+ char *hum1, *hum2, *hum3;
|
||||
|
||||
if (argc < 2)
|
||||
return EXIT_FAILURE;
|
||||
@@ -1059,13 +1076,17 @@ static int test_strutils_sizes(int argc, char *argv[])
|
||||
if (strtosize(argv[1], &size))
|
||||
errx(EXIT_FAILURE, "invalid size '%s' value", argv[1]);
|
||||
|
||||
- hum = size_to_human_string(SIZE_SUFFIX_1LETTER, size);
|
||||
+ hum1 = size_to_human_string(SIZE_SUFFIX_1LETTER, size);
|
||||
hum2 = size_to_human_string(SIZE_SUFFIX_3LETTER |
|
||||
SIZE_SUFFIX_SPACE, size);
|
||||
+ hum3 = size_to_human_string(SIZE_SUFFIX_3LETTER |
|
||||
+ SIZE_SUFFIX_SPACE |
|
||||
+ SIZE_DECIMAL_2DIGITS, size);
|
||||
|
||||
- printf("%25s : %20ju : %8s : %12s\n", argv[1], size, hum, hum2);
|
||||
- free(hum);
|
||||
+ printf("%25s : %20ju : %8s : %12s : %13s\n", argv[1], size, hum1, hum2, hum3);
|
||||
+ free(hum1);
|
||||
free(hum2);
|
||||
+ free(hum3);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
diff --git a/tests/expected/misc/strtosize b/tests/expected/misc/strtosize
|
||||
index 8d93e142d3..abda45a575 100644
|
||||
--- a/tests/expected/misc/strtosize
|
||||
+++ b/tests/expected/misc/strtosize
|
||||
@@ -1,26 +1,26 @@
|
||||
- 0 : 0 : 0B : 0 B
|
||||
- 1 : 1 : 1B : 1 B
|
||||
- 123 : 123 : 123B : 123 B
|
||||
- 18446744073709551615 : 18446744073709551615 : 16E : 16 EiB
|
||||
- 1K : 1024 : 1K : 1 KiB
|
||||
- 1KiB : 1024 : 1K : 1 KiB
|
||||
- 1M : 1048576 : 1M : 1 MiB
|
||||
- 1MiB : 1048576 : 1M : 1 MiB
|
||||
- 1G : 1073741824 : 1G : 1 GiB
|
||||
- 1GiB : 1073741824 : 1G : 1 GiB
|
||||
- 1T : 1099511627776 : 1T : 1 TiB
|
||||
- 1TiB : 1099511627776 : 1T : 1 TiB
|
||||
- 1P : 1125899906842624 : 1P : 1 PiB
|
||||
- 1PiB : 1125899906842624 : 1P : 1 PiB
|
||||
- 1E : 1152921504606846976 : 1E : 1 EiB
|
||||
- 1EiB : 1152921504606846976 : 1E : 1 EiB
|
||||
- 1KB : 1000 : 1000B : 1000 B
|
||||
- 1MB : 1000000 : 976.6K : 976.6 KiB
|
||||
- 1GB : 1000000000 : 953.7M : 953.7 MiB
|
||||
- 1TB : 1000000000000 : 931.3G : 931.3 GiB
|
||||
- 1PB : 1000000000000000 : 909.5T : 909.5 TiB
|
||||
- 1EB : 1000000000000000000 : 888.2P : 888.2 PiB
|
||||
- 1 : 1 : 1B : 1 B
|
||||
- 0x0a : 10 : 10B : 10 B
|
||||
- 0xff00 : 65280 : 63.8K : 63.8 KiB
|
||||
- 0x80000000 : 2147483648 : 2G : 2 GiB
|
||||
+ 0 : 0 : 0B : 0 B : 0 B
|
||||
+ 1 : 1 : 1B : 1 B : 1 B
|
||||
+ 123 : 123 : 123B : 123 B : 123 B
|
||||
+ 18446744073709551615 : 18446744073709551615 : 15E : 15 EiB : 15.01 EiB
|
||||
+ 1K : 1024 : 1K : 1 KiB : 1 KiB
|
||||
+ 1KiB : 1024 : 1K : 1 KiB : 1 KiB
|
||||
+ 1M : 1048576 : 1M : 1 MiB : 1 MiB
|
||||
+ 1MiB : 1048576 : 1M : 1 MiB : 1 MiB
|
||||
+ 1G : 1073741824 : 1G : 1 GiB : 1 GiB
|
||||
+ 1GiB : 1073741824 : 1G : 1 GiB : 1 GiB
|
||||
+ 1T : 1099511627776 : 1T : 1 TiB : 1 TiB
|
||||
+ 1TiB : 1099511627776 : 1T : 1 TiB : 1 TiB
|
||||
+ 1P : 1125899906842624 : 1P : 1 PiB : 1 PiB
|
||||
+ 1PiB : 1125899906842624 : 1P : 1 PiB : 1 PiB
|
||||
+ 1E : 1152921504606846976 : 1E : 1 EiB : 1 EiB
|
||||
+ 1EiB : 1152921504606846976 : 1E : 1 EiB : 1 EiB
|
||||
+ 1KB : 1000 : 1000B : 1000 B : 1000 B
|
||||
+ 1MB : 1000000 : 976.6K : 976.6 KiB : 976.56 KiB
|
||||
+ 1GB : 1000000000 : 953.7M : 953.7 MiB : 953.67 MiB
|
||||
+ 1TB : 1000000000000 : 931.3G : 931.3 GiB : 931.32 GiB
|
||||
+ 1PB : 1000000000000000 : 909.5T : 909.5 TiB : 909.49 TiB
|
||||
+ 1EB : 1000000000000000000 : 888.2P : 888.2 PiB : 888.18 PiB
|
||||
+ 1 : 1 : 1B : 1 B : 1 B
|
||||
+ 0x0a : 10 : 10B : 10 B : 10 B
|
||||
+ 0xff00 : 65280 : 63.8K : 63.8 KiB : 63.75 KiB
|
||||
+ 0x80000000 : 2147483648 : 2G : 2 GiB : 2 GiB
|
||||
41
backpaort-fix-uint64_t-overflow.patch
Normal file
41
backpaort-fix-uint64_t-overflow.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From f12d5ad279f248b2fb63394331010f2c835b1a74 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Fri, 17 Apr 2020 10:21:56 +0200
|
||||
Subject: [PATCH] lib/strutils: fix uint64_t overflow
|
||||
|
||||
Addresses: https://github.com/karelzak/util-linux/issues/998
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
lib/strutils.c | 5 ++++-
|
||||
tests/expected/misc/strtosize | 2 +-
|
||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/strutils.c b/lib/strutils.c
|
||||
index ccf48919bd..b76ab99520 100644
|
||||
--- a/lib/strutils.c
|
||||
+++ b/lib/strutils.c
|
||||
@@ -603,7 +603,10 @@ char *size_to_human_string(int options, uint64_t bytes)
|
||||
/* round */
|
||||
if (frac) {
|
||||
/* get 3 digits after decimal point */
|
||||
- frac = (frac * 1000) / (1ULL << exp);
|
||||
+ if (frac >= UINT64_MAX / 1000)
|
||||
+ frac = ((frac / 1024) * 1000) / (1ULL << (exp - 10)) ;
|
||||
+ else
|
||||
+ frac = (frac * 1000) / (1ULL << (exp)) ;
|
||||
|
||||
if (options & SIZE_DECIMAL_2DIGITS) {
|
||||
/* round 4/5 and keep 2 digits after decimal point */
|
||||
diff --git a/tests/expected/misc/strtosize b/tests/expected/misc/strtosize
|
||||
index abda45a575..0f912f7229 100644
|
||||
--- a/tests/expected/misc/strtosize
|
||||
+++ b/tests/expected/misc/strtosize
|
||||
@@ -1,7 +1,7 @@
|
||||
0 : 0 : 0B : 0 B : 0 B
|
||||
1 : 1 : 1B : 1 B : 1 B
|
||||
123 : 123 : 123B : 123 B : 123 B
|
||||
- 18446744073709551615 : 18446744073709551615 : 15E : 15 EiB : 15.01 EiB
|
||||
+ 18446744073709551615 : 18446744073709551615 : 16E : 16 EiB : 16 EiB
|
||||
1K : 1024 : 1K : 1 KiB : 1 KiB
|
||||
1KiB : 1024 : 1K : 1 KiB : 1 KiB
|
||||
1M : 1048576 : 1M : 1 MiB : 1 MiB
|
||||
@ -0,0 +1,290 @@
|
||||
From 316617e84848da418aee413abe1d26a2f6a8fde7 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Thu, 16 Apr 2020 12:19:16 +0200
|
||||
Subject: [PATCH] tests: update fdisk outputs due to sizes rounding change
|
||||
|
||||
References: b38c20e13a51acb7e3bb388e9cc17d5fc905e7d9
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
tests/expected/blkid/md-raid0-whole | 2 +-
|
||||
tests/expected/blkid/md-raid1-whole | 2 +-
|
||||
tests/expected/fdisk/align-512-4K-md | 2 +-
|
||||
tests/expected/fdisk/bsd_0_64.BE | 4 ++--
|
||||
tests/expected/fdisk/bsd_0_64.LE | 4 ++--
|
||||
tests/expected/fdisk/bsd_0_64_alpha.LE | 4 ++--
|
||||
tests/expected/fdisk/bsd_1_0.BE | 4 ++--
|
||||
tests/expected/fdisk/bsd_1_0.LE | 4 ++--
|
||||
tests/expected/fdisk/mbr-dos-mode | 10 +++++-----
|
||||
tests/expected/fdisk/sunlabel | 18 +++++++++---------
|
||||
tests/expected/partx/partx-image-dos+bsd | 2 +-
|
||||
11 files changed, 28 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/tests/expected/blkid/md-raid0-whole b/tests/expected/blkid/md-raid0-whole
|
||||
index cc0b17f..475eb05 100644
|
||||
--- a/tests/expected/blkid/md-raid0-whole
|
||||
+++ b/tests/expected/blkid/md-raid0-whole
|
||||
@@ -19,7 +19,7 @@ Command (m for help): Partition type
|
||||
Select (default p): Partition number (2-4, default 2): First sector (22528-204543, default 22528): Last sector, +/-sectors or +/-size{K,M,G,T,P} (22528-204543, default 204543):
|
||||
Created a new <removed>.
|
||||
|
||||
-Command (m for help): Disk <removed>: 99.9 MiB, 104726528 bytes, 204544 sectors
|
||||
+Command (m for help): Disk <removed>: 99.88 MiB, 104726528 bytes, 204544 sectors
|
||||
Units: sectors of 1 * 512 = 512 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
I/O size (minimum/optimal): 65536 bytes / <removed> bytes
|
||||
diff --git a/tests/expected/blkid/md-raid1-whole b/tests/expected/blkid/md-raid1-whole
|
||||
index 6334ae1..891778c 100644
|
||||
--- a/tests/expected/blkid/md-raid1-whole
|
||||
+++ b/tests/expected/blkid/md-raid1-whole
|
||||
@@ -19,7 +19,7 @@ Command (m for help): Partition type
|
||||
Select (default p): Partition number (2-4, default 2): First sector (22528-102271, default 22528): Last sector, +/-sectors or +/-size{K,M,G,T,P} (22528-102271, default 102271):
|
||||
Created a new <removed>.
|
||||
|
||||
-Command (m for help): Disk /dev/md8: 49.96 MiB, 52363264 bytes, 102272 sectors
|
||||
+Command (m for help): Disk /dev/md8: 49.94 MiB, 52363264 bytes, 102272 sectors
|
||||
Units: sectors of 1 * 512 = 512 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
I/O size (minimum/optimal): <removed> bytes / <removed> bytes
|
||||
diff --git a/tests/expected/fdisk/align-512-4K-md b/tests/expected/fdisk/align-512-4K-md
|
||||
index ce9b3e7..c69e72f 100644
|
||||
--- a/tests/expected/fdisk/align-512-4K-md
|
||||
+++ b/tests/expected/fdisk/align-512-4K-md
|
||||
@@ -59,7 +59,7 @@ Command (m for help): Partition type
|
||||
Select (default p): Partition number (2-4, default 2): First sector (22528-97791, default 22528): Last sector, +/-sectors or +/-size{K,M,G,T,P} (22528-97791, default 97791):
|
||||
Created a new <removed>.
|
||||
|
||||
-Command (m for help): Disk <removed>: 47.77 MiB, 50069504 bytes, 97792 sectors
|
||||
+Command (m for help): Disk <removed>: 47.75 MiB, 50069504 bytes, 97792 sectors
|
||||
Units: sectors of 1 * 512 = 512 bytes
|
||||
Sector size (logical/physical): 512 bytes / 4096 bytes
|
||||
I/O size (minimum/optimal): 65536 bytes / <removed> bytes
|
||||
diff --git a/tests/expected/fdisk/bsd_0_64.BE b/tests/expected/fdisk/bsd_0_64.BE
|
||||
index 3a79c49..fd78576 100644
|
||||
--- a/tests/expected/fdisk/bsd_0_64.BE
|
||||
+++ b/tests/expected/fdisk/bsd_0_64.BE
|
||||
@@ -132,7 +132,7 @@ Disklabel type: bsd
|
||||
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
@@ -186,7 +186,7 @@ Disklabel type: bsd
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
a 4096 6144 2049 1M 4.2BSD 0 0 0
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
diff --git a/tests/expected/fdisk/bsd_0_64.LE b/tests/expected/fdisk/bsd_0_64.LE
|
||||
index d673d04..fe6e042 100644
|
||||
--- a/tests/expected/fdisk/bsd_0_64.LE
|
||||
+++ b/tests/expected/fdisk/bsd_0_64.LE
|
||||
@@ -132,7 +132,7 @@ Disklabel type: bsd
|
||||
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
@@ -186,7 +186,7 @@ Disklabel type: bsd
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
a 4096 6144 2049 1M 4.2BSD 0 0 0
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
diff --git a/tests/expected/fdisk/bsd_0_64_alpha.LE b/tests/expected/fdisk/bsd_0_64_alpha.LE
|
||||
index 1c2a368..a675e98 100644
|
||||
--- a/tests/expected/fdisk/bsd_0_64_alpha.LE
|
||||
+++ b/tests/expected/fdisk/bsd_0_64_alpha.LE
|
||||
@@ -134,7 +134,7 @@ Disklabel type: bsd
|
||||
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
@@ -190,7 +190,7 @@ Disklabel type: bsd
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
a 4096 6144 2049 1M 4.2BSD 0 0 0
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
diff --git a/tests/expected/fdisk/bsd_1_0.BE b/tests/expected/fdisk/bsd_1_0.BE
|
||||
index 2c46abd..13a5cfe 100644
|
||||
--- a/tests/expected/fdisk/bsd_1_0.BE
|
||||
+++ b/tests/expected/fdisk/bsd_1_0.BE
|
||||
@@ -132,7 +132,7 @@ Disklabel type: bsd
|
||||
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
@@ -186,7 +186,7 @@ Disklabel type: bsd
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
a 4096 6144 2049 1M 4.2BSD 0 0 0
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
diff --git a/tests/expected/fdisk/bsd_1_0.LE b/tests/expected/fdisk/bsd_1_0.LE
|
||||
index 5f3b838..b6e3661 100644
|
||||
--- a/tests/expected/fdisk/bsd_1_0.LE
|
||||
+++ b/tests/expected/fdisk/bsd_1_0.LE
|
||||
@@ -132,7 +132,7 @@ Disklabel type: bsd
|
||||
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
@@ -186,7 +186,7 @@ Disklabel type: bsd
|
||||
Slice Start End Sectors Size Type Fsize Bsize Cpg
|
||||
a 4096 6144 2049 1M 4.2BSD 0 0 0
|
||||
c 4096 20479 16384 8M unused 0 0 0
|
||||
-d 0 16064 16065 7.9M unused 0 0 0
|
||||
+d 0 16064 16065 7.8M unused 0 0 0
|
||||
|
||||
Partition table entries are not in disk order.
|
||||
|
||||
diff --git a/tests/expected/fdisk/mbr-dos-mode b/tests/expected/fdisk/mbr-dos-mode
|
||||
index 6560099..5bc1fbf 100644
|
||||
--- a/tests/expected/fdisk/mbr-dos-mode
|
||||
+++ b/tests/expected/fdisk/mbr-dos-mode
|
||||
@@ -98,7 +98,7 @@ Create logical partitions
|
||||
a1cd6708e4a6d2e5f6bc9d5c0da0cf3b mbr-dos-mode.img
|
||||
|
||||
---layout----------
|
||||
-Disk <removed>: 54.93 MiB, 57577472 bytes, 112456 sectors
|
||||
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
|
||||
Geometry: 255 heads, 63 sectors/track, 1024 cylinders
|
||||
Units: cylinders of 16065 * 512 = 8225280 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
@@ -119,7 +119,7 @@ Delete logical partitions
|
||||
4c6937d529ace5661fb82efb9394154a mbr-dos-mode.img
|
||||
|
||||
---layout----------
|
||||
-Disk <removed>: 54.93 MiB, 57577472 bytes, 112456 sectors
|
||||
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
|
||||
Geometry: 255 heads, 63 sectors/track, 1024 cylinders
|
||||
Units: cylinders of 16065 * 512 = 8225280 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
@@ -137,7 +137,7 @@ Create another logical partition
|
||||
9589eaaed698d2402945ab3e513c1eb4 mbr-dos-mode.img
|
||||
|
||||
---layout----------
|
||||
-Disk <removed>: 54.93 MiB, 57577472 bytes, 112456 sectors
|
||||
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
|
||||
Geometry: 255 heads, 63 sectors/track, 1024 cylinders
|
||||
Units: cylinders of 16065 * 512 = 8225280 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
@@ -158,7 +158,7 @@ Delete primary partition
|
||||
1e6d646e5df66a2664cfbbb13fa9a08a mbr-dos-mode.img
|
||||
|
||||
---layout----------
|
||||
-Disk <removed>: 54.93 MiB, 57577472 bytes, 112456 sectors
|
||||
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
|
||||
Geometry: 255 heads, 63 sectors/track, 1024 cylinders
|
||||
Units: cylinders of 16065 * 512 = 8225280 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
@@ -178,7 +178,7 @@ Delete extended partition
|
||||
fc3cdb12326656d7996b09b6f76973e7 mbr-dos-mode.img
|
||||
|
||||
---layout----------
|
||||
-Disk <removed>: 54.93 MiB, 57577472 bytes, 112456 sectors
|
||||
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
|
||||
Geometry: 255 heads, 63 sectors/track, 1024 cylinders
|
||||
Units: cylinders of 16065 * 512 = 8225280 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
diff --git a/tests/expected/fdisk/sunlabel b/tests/expected/fdisk/sunlabel
|
||||
index 5ada4fa..2f47208 100644
|
||||
--- a/tests/expected/fdisk/sunlabel
|
||||
+++ b/tests/expected/fdisk/sunlabel
|
||||
@@ -17,8 +17,8 @@ Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
I/O size (minimum/optimal): 512 bytes / <removed> bytes
|
||||
Disklabel type: sun
|
||||
|
||||
-Device Start End Cylinders Size Id Type Flags
|
||||
-<removed>1 1 128 129 4M 83 Linux native
|
||||
+Device Start End Cylinders Size Id Type Flags
|
||||
+<removed>1 1 128 129 3.9M 83 Linux native
|
||||
Set partition sysid
|
||||
df75defdb97fbd56222aed18631a22d0 sunlabel.img
|
||||
Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
|
||||
@@ -28,8 +28,8 @@ Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
I/O size (minimum/optimal): 512 bytes / <removed> bytes
|
||||
Disklabel type: sun
|
||||
|
||||
-Device Start End Cylinders Size Id Type Flags
|
||||
-<removed>1 1 128 129 4M 4 SunOS usr
|
||||
+Device Start End Cylinders Size Id Type Flags
|
||||
+<removed>1 1 128 129 3.9M 4 SunOS usr
|
||||
Set first partition readonly
|
||||
da23f66698d9a553162887621d4c7490 sunlabel.img
|
||||
Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
|
||||
@@ -39,8 +39,8 @@ Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
I/O size (minimum/optimal): 512 bytes / <removed> bytes
|
||||
Disklabel type: sun
|
||||
|
||||
-Device Start End Cylinders Size Id Type Flags
|
||||
-<removed>1 1 128 129 4M 4 SunOS usr r
|
||||
+Device Start End Cylinders Size Id Type Flags
|
||||
+<removed>1 1 128 129 3.9M 4 SunOS usr r
|
||||
Set first partition mountable
|
||||
3ab76e8491b103eab52b2ae1856c1e30 sunlabel.img
|
||||
Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
|
||||
@@ -50,8 +50,8 @@ Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
I/O size (minimum/optimal): 512 bytes / <removed> bytes
|
||||
Disklabel type: sun
|
||||
|
||||
-Device Start End Cylinders Size Id Type Flags
|
||||
-<removed>1 1 128 129 4M 4 SunOS usr ur
|
||||
+Device Start End Cylinders Size Id Type Flags
|
||||
+<removed>1 1 128 129 3.9M 4 SunOS usr ur
|
||||
Create second partition
|
||||
|
||||
Welcome to fdisk <removed>.
|
||||
@@ -74,7 +74,7 @@ I/O size (minimum/optimal): 512 bytes / <removed> bytes
|
||||
Disklabel type: sun
|
||||
|
||||
Device Start End Cylinders Size Id Type Flags
|
||||
-<removed>1 1 128 129 4M 4 SunOS usr ur
|
||||
+<removed>1 1 128 129 3.9M 4 SunOS usr ur
|
||||
<removed>2 129 325 198 6.1M 83 Linux native
|
||||
Delete all partitions
|
||||
502ba7a0cfdce2849c3a99881f0590c3 sunlabel.img
|
||||
diff --git a/tests/expected/partx/partx-image-dos+bsd b/tests/expected/partx/partx-image-dos+bsd
|
||||
index 379633d..ae5f314 100644
|
||||
--- a/tests/expected/partx/partx-image-dos+bsd
|
||||
+++ b/tests/expected/partx/partx-image-dos+bsd
|
||||
@@ -1,5 +1,5 @@
|
||||
NR START END SECTORS SIZE NAME UUID
|
||||
- 1 32 7679 7648 3.8M 8f8378c0-01
|
||||
+ 1 32 7679 7648 3.7M 8f8378c0-01
|
||||
2 7680 16383 8704 4.3M 8f8378c0-02
|
||||
5 7936 12799 4864 2.4M
|
||||
6 12544 16127 3584 1.8M
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
Name: util-linux
|
||||
Version: 2.35.2
|
||||
Release: 6
|
||||
Release: 7
|
||||
Summary: A random collection of Linux utilities
|
||||
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
|
||||
URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
|
||||
@ -54,6 +54,9 @@ Patch15: backport-libmount-fix-tab-parser-for-badly-terminated-lines.patc
|
||||
Patch16: backport-clang-tidy-fix-wrong-cmp-usage.patch
|
||||
Patch17: backport-libblkid-improve-debug-for-proc-partitions.patch
|
||||
Patch18: backport-libblkid-use-sys-to-read-all-block-devices.patch
|
||||
Patch19: backpaort-fix-rounding-in-size_to_human_string.patch
|
||||
Patch20: backpaort-fix-uint64_t-overflow.patch
|
||||
Patch21: backpaort-update-fdisk-outputs-due-to-sizes-rounding-change.patch
|
||||
|
||||
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
|
||||
|
||||
@ -403,6 +406,12 @@ fi
|
||||
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
|
||||
|
||||
%changelog
|
||||
* Wed Jul 28 2021 shangyibin<shangyibin1@huawei.com> - 2.35.2-7
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:fix rounding in size_to_human_string()
|
||||
|
||||
* Thu May 06 2021 tianwei<tianwei12@huawei.com> - 2.35.2-6
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user