gsmartcontrol shows capacity wrongly (truncating)

Bug #1463108 reported by Aapo Rantalainen
6
This bug affects 1 person
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]
-----------------------------------------------------

Revision history for this message
Aapo Rantalainen (aapo-rantalainen) wrote :

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:
--- gsmartcontrol-0.8.7.orig/src/applib/smartctl_parser.cpp
+++ gsmartcontrol-0.8.7/src/applib/smartctl_parser.cpp
@@ -289,6 +289,7 @@ std::string SmartctlParser::parse_byte_s
        to_replace.push_back(",");
        to_replace.push_back(".");
        to_replace.push_back(std::string(1, 0xa0));
+ to_replace.push_back(std::string(1, 0xc2));

 #ifdef _WIN32
        // if current locale is C, then probably we didn't change it at application

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gsmartcontrol - 1.0.2-1

---------------
gsmartcontrol (1.0.2-1) unstable; urgency=medium

  * New upstream release.
  * Handle Finnish separators; thanks to Aapo Rantalainen for the patch!
    LP: #1463108.
  * Fix a spelling mistake and override a Lintian spelling false-
    positive.

 -- Stephen Kitt <email address hidden> Mon, 21 Aug 2017 09:42:52 +0200

Changed in gsmartcontrol (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.