summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2017-01-27 14:26:07 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2017-01-27 14:27:50 +0100
commit7cd51d36c05a66555b07a7fa850b21686ded2e1a (patch)
tree39f136f82cc1dd6c63efc13e588f8f812fe6878c
parent28118f7127a2bef9d56a1ae618bcc1ed6b9e23c3 (diff)
downloaddrakx-7cd51d36c05a66555b07a7fa850b21686ded2e1a.tar
drakx-7cd51d36c05a66555b07a7fa850b21686ded2e1a.tar.gz
drakx-7cd51d36c05a66555b07a7fa850b21686ded2e1a.tar.bz2
drakx-7cd51d36c05a66555b07a7fa850b21686ded2e1a.tar.xz
drakx-7cd51d36c05a66555b07a7fa850b21686ded2e1a.zip
lsparts: fix reporting half sizes
The issue is that lsparts is relying on fs::proc_partitions::read_raw(), which reads /proc/partition which reports size of devices in 1kb blocks instead of expected 512b sectors elsewhere... The size is adjusted by *2 in read() but lsparts only used the lower level interface. This bug was introduced in commit 20e553d8f0ead3d5de1fb61d1aa255dd35549cf2
-rw-r--r--rescue/NEWS2
-rwxr-xr-xrescue/bin/lsparts2
2 files changed, 3 insertions, 1 deletions
diff --git a/rescue/NEWS b/rescue/NEWS
index 07d4225bc..d85502b05 100644
--- a/rescue/NEWS
+++ b/rescue/NEWS
@@ -1,3 +1,5 @@
+- lsparts: fix reporting half sizes
+
Version 1.54 - 20 June 2016 by Thierry Vignaud
- do not run shells uselessly
diff --git a/rescue/bin/lsparts b/rescue/bin/lsparts
index cba9c6cb8..72f1c4cee 100755
--- a/rescue/bin/lsparts
+++ b/rescue/bin/lsparts
@@ -40,7 +40,7 @@ foreach (fs::proc_partitions::read_raw()) {
$_->{device} = $_->{dev};
local $::isStandalone = 1; # silent run_program
if (my $type = fs::type::type_subpart_from_magic($_)) {
- printf "$_->{dev}: %6s, fs %s (%s) [%s]\n", formatXiB($_->{size} * 512), $type->{fs_type}, fs::type::part2type_name($type), $type->{device_LABEL};
+ printf "$_->{dev}: %6s, fs %s (%s) [%s] (%s sectors)\n", formatXiB($_->{size} * 1024), $type->{fs_type}, fs::type::part2type_name($type), $type->{device_LABEL}, $_->{size};
}
}
}