Require smartmontools version 5.43 at runtime.

This commit is contained in:
Alexander Shaduri
2017-08-29 15:13:13 +00:00
parent faba9270a0
commit da403b28c9
7 changed files with 34 additions and 21 deletions
+4 -11
View File
@@ -42,6 +42,8 @@ Add ability (through ctrl-C?) to copy individual rows from attributes page,
Require smartctl 5.43 (for --get=all)
Update specs / dsc.
Detect on startup.
Add menu item - "update drive database" (not sure about linux, should
@@ -56,26 +58,17 @@ Testing:
48-bit ATA command support:
Add ability to load --xall output:
--xall for ATA:
--health --info --get=all --capabilities --attributes --format=brief -l xerror,error -l xselftest,selftest
-l selective -l directory -l scttemp -l scterc -l devstat -l sataphy
--xall for SCSI:
--health --info --attributes -l error -l selftest -l background -l sasphy
use --format=brief, which affects --attributes by decoding flags.
Show flag descriptions in tooltips, for each attribute.
There are no TYPE or UPDATED columns in this mode, decode it from flags.
Updated offline: -, Always: O.
Pre-failure: P, old age: -.
Maybe get rid of Type and Updated columns and print only decoded flags?
Add a tab for -l devstat - it shows interesting statistics.
Some of this stuff is better than attributes, maybe show them before attributes.
Also needs the warnings and descriptions.
Add ability to load --xall output.
Document RAID support.
@@ -122,8 +115,8 @@ Add a button (with dropdown) to Info window, to run
-l sataphy (advanced)
-l directory (very advanced)
-l scttemp (rarely supported and difficult to parse)
Just show the output in a text window.
Maybe add -l selective here (and remove it from GUI).
Just show the output in a text window.
"Put this all in Error Log", raname to Logs.
Make it a dropdown combo and "Retrieve" button, showing the output where selective is now.
+1 -2
View File
@@ -9,8 +9,7 @@ Standards-Version: 3.7.3
Package: gsmartcontrol
Architecture: any
#Depends: ${shlibs:Depends}, ${misc:Depends}, smartmontools, menu
Depends: ${shlibs:Depends}, smartmontools, menu
Depends: ${shlibs:Depends}, smartmontools (>= 5.43), menu
Description: Hard disk drive and SSD health inspection tool
GSmartControl is a graphical user interface for smartctl (from smartmontools
package), which is a tool for querying and controlling SMART
+2 -2
View File
@@ -24,7 +24,7 @@ Group: Hardware/Other
# SUSE / OpenSUSE. SLES also defines the correct suse_version.
%if 0%{?suse_version}
Requires: smartmontools, polkit, bash
Requires: smartmontools >= 5.43, polkit, bash
BuildRequires: gcc-c++, libstdc++-devel, pcre-devel, gtkmm3-devel >= 3.4.0
BuildRequires: update-desktop-files
BuildRequires: fdupes
@@ -35,7 +35,7 @@ BuildRequires: fdupes
# Fedora, CentOS, RHEL
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
Requires: smartmontools, polkit, bash
Requires: smartmontools >= 5.43, polkit, bash
BuildRequires: gcc-c++, pcre-devel, gtkmm30-devel >= 3.4.0
%endif
+7 -5
View File
@@ -190,7 +190,7 @@ bool SmartctlParser::parse_full(const std::string& full, StorageAttribute::DiskT
}
}
if (!check_version(version, version_full)) {
if (!check_parsed_version(version, version_full)) {
set_error_msg("Incompatible smartctl version.");
debug_out_warn("app", DBG_FUNC_MSG << "Incompatible smartctl version. Returning.\n");
return false;
@@ -238,7 +238,9 @@ bool SmartctlParser::parse_full(const std::string& full, StorageAttribute::DiskT
// returns false on failure. Non-unix newlines in s are ok.
bool SmartctlParser::parse_version(const std::string& s, std::string& version, std::string& version_full)
{
// e.g. "smartctl version 5.37" or "smartctl 5.39"
// e.g.
// "smartctl version 5.37"
// "smartctl 5.39"
// "smartctl 5.39 2009-06-03 20:10" (cvs versions)
// "smartctl 5.39 2009-08-08 r2873" (svn versions)
if (!app_pcre_match("/^smartctl (?:version )?(([0-9][^ \\t\\n\\r]+)(?: [0-9 r:-]+)?)/mi", s, &version_full, &version)) {
@@ -254,18 +256,18 @@ bool SmartctlParser::parse_version(const std::string& s, std::string& version, s
// check that the version of smartctl output can be parsed with this parser.
bool SmartctlParser::check_version(const std::string& version_str, const std::string& version_full_str)
bool SmartctlParser::check_parsed_version(const std::string& version_str, const std::string& version_full_str)
{
// tested with 5.1-xx versions (1 - 18), and 5.[20 - 38].
// note: 5.1-11 (maybe others too) with scsi disk gives non-parsable output (why?).
// 5.0-24, 5.0-36, 5.0-49 tested with data only, from smartmontool site.
// can't fully test 5.0-xx, they don't support sata and I have only sata.
double minimum_version = 5.0;
const double minimum_req_version = 5.0;
double version = 0;
if (hz::string_is_numeric<double>(version_str, version, false)) {
if (version >= minimum_version)
if (version >= minimum_req_version)
return true;
}
+1 -1
View File
@@ -43,7 +43,7 @@ class SmartctlParser {
/// Check that the version of smartctl output can be parsed with this parser.
static bool check_version(const std::string& version_str, const std::string& version_full_str);
static bool check_parsed_version(const std::string& version_str, const std::string& version_full_str);
/// Convert e.g. "1,000,204,886,016 bytes" to 1.00 TiB [931.51 GB, 1000204886016 bytes]
+12
View File
@@ -129,6 +129,18 @@ GscMainWindow::GscMainWindow(BaseObjectType* gtkcobj, const app_ui_res_ref_t& re
break;
}
{
// We require this version at runtime to support --get=all.
const double minimum_req_version = 5.43;
double version_double = 0;
if (hz::string_is_numeric<double>(version, version_double, false)) {
if (version_double < minimum_req_version) {
error_msg = "Smartctl version " + version + " found, " + hz::number_to_string(minimum_req_version) + " required.";
break;
}
}
}
} while (false);
bool smartctl_valid = error_msg.empty();
+7
View File
@@ -125,7 +125,14 @@ class scoped_ptr { // non-copyable
cleaner->cleanup(ptr);
delete cleaner;
} else {
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdelete-incomplete"
#endif
delete ptr;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
}