gsmartcontrol shows capacity wrongly (truncating)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gsmartcontrol (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Ubuntu 14.04.2 LTS
gsmartcontrol (0.8.7-1)
-------
smartctl shows
User Capacity: 500 107 862 016 bytes [500 GB]
gsmartcontrol
"Drive information" (one-liner in main-menu) shows "500 B"
And "View details" -> "Identity" shows "Capacity 500 B [500 B, 500 bytes]"
-------
Another drive:
smartctl
User Capacity: 60 022 480 896 bytes [60,0 GB]
gsmartcontrol
Capacity 60 B [60 B, 60 bytes]
-------
And one drive more:
smartctl
User Capacity: 1 000 204 886 016 bytes [1,00 TB]
gsmartcontrol
Capacity 1 B [1 B, 1 bytes]
-------
This seems to be locale issue. Mine is "LANG=fi_FI.UTF-8".
In case somebody encounters same issue with another locale, solution:
sudo smartctl -a /dev/sda | grep Capacity | hexdump -C
00000000 55 73 65 72 20 43 61 70 61 63 69 74 79 3a 20 20 |User Capacity: |
00000010 20 20 36 30 c2 a0 30 32 32 c2 a0 34 38 30 c2 a0 | 60..022..480..|
00000020 38 39 36 20 62 79 74 65 73 20 5b 36 30 2c 30 20 |896 bytes [60,0 |
00000030 47 42 5d 0a |GB].|
00000034
-> Code already handles 'French separator' = "a0". So add "c2" too.
Patch: 0.8.7.orig/ src/applib/ smartctl_ parser. cpp 0.8.7/src/ applib/ smartctl_ parser. cpp :parse_ byte_s
to_replace. push_back( ",");
to_replace. push_back( ".");
to_replace. push_back( std::string( 1, 0xa0)); push_back( std::string( 1, 0xc2));
--- gsmartcontrol-
+++ gsmartcontrol-
@@ -289,6 +289,7 @@ std::string SmartctlParser:
+ to_replace.
#ifdef _WIN32
// if current locale is C, then probably we didn't change it at application