From 7b7d7e9a57b8d44659b025a01f48fd840526a50d Mon Sep 17 00:00:00 2001 From: yopito Date: Sun, 22 Nov 2015 17:38:23 +0100 Subject: [PATCH] New package: gsmartcontrol 0.8.7 --- ...m-gsmartcontrol-0.87-parser_crash_fix.diff | 44 +++++++++++++++++++ srcpkgs/gsmartcontrol/template | 21 +++++++++ 2 files changed, 65 insertions(+) create mode 100644 srcpkgs/gsmartcontrol/patches/upstream-gsmartcontrol-0.87-parser_crash_fix.diff create mode 100644 srcpkgs/gsmartcontrol/template diff --git a/srcpkgs/gsmartcontrol/patches/upstream-gsmartcontrol-0.87-parser_crash_fix.diff b/srcpkgs/gsmartcontrol/patches/upstream-gsmartcontrol-0.87-parser_crash_fix.diff new file mode 100644 index 0000000000..2b0aba87d0 --- /dev/null +++ b/srcpkgs/gsmartcontrol/patches/upstream-gsmartcontrol-0.87-parser_crash_fix.diff @@ -0,0 +1,44 @@ +Fix provided by upstream gsmartcontrol.sf.net, in +HomePage > News > 2015-04-29: + The Linux binary packages have been updated with a patch that fixes crash on + startup for some smartmontools version and system configuration combinations. + The source patch can be downloaded separately as well. Note that he fix has + been included in the SVN version for some time now. + +direct link for this patch: +fix https://build.opensuse.org/source/home:alex_sh/gsmartcontrol/gsmartcontrol_parser_crash_fix.diff?rev=da33e1d56b052b483f576e5e6823da3b + +Index: src/applib/smartctl_parser.cpp +=================================================================== +--- src/applib/smartctl_parser.cpp (revision 106) ++++ src/applib/smartctl_parser.cpp (revision 107) +@@ -201,21 +201,20 @@ + while (section_start_pos != std::string::npos + && (section_start_pos = s.find("===", section_start_pos)) != std::string::npos) { + +- tmp_pos = s.find("\n", section_start_pos); // works with \r\n too. ++ tmp_pos = s.find("\n", section_start_pos); // works with \r\n too. This may be npos if nothing follows the header. + + // trim is needed to remove potential \r in the end + std::string section_header = hz::string_trim_copy(s.substr(section_start_pos, + (tmp_pos == std::string::npos ? tmp_pos : (tmp_pos - section_start_pos)) )); + +- if (tmp_pos != std::string::npos) +- ++tmp_pos; // set to start of the next section +- +- section_end_pos = s.find("===", tmp_pos); // start of the next section +- std::string section_body_str = hz::string_trim_copy(s.substr(tmp_pos, +- (section_end_pos == std::string::npos ? section_end_pos : section_end_pos - tmp_pos))); +- ++ std::string section_body_str; ++ if (tmp_pos != std::string::npos) { ++ section_end_pos = s.find("===", tmp_pos); // start of the next section ++ section_body_str = hz::string_trim_copy(s.substr(tmp_pos, ++ (section_end_pos == std::string::npos ? section_end_pos : section_end_pos - tmp_pos))); ++ } + status = parse_section(section_header, section_body_str) || status; +- section_start_pos = section_end_pos; ++ section_start_pos = (tmp_pos == std::string::npos ? std::string::npos : section_end_pos); + } + + if (!status) { diff --git a/srcpkgs/gsmartcontrol/template b/srcpkgs/gsmartcontrol/template new file mode 100644 index 0000000000..60443a1a1a --- /dev/null +++ b/srcpkgs/gsmartcontrol/template @@ -0,0 +1,21 @@ +# Template file for 'gsmartcontrol' +pkgname=gsmartcontrol +version=0.8.7 +revision=1 +build_style=gnu-configure +hostmakedepends="pkg-config" +makedepends="gtkmm2-devel pcre-devel desktop-file-utils" +depends="smartmontools hicolor-icon-theme" +short_desc="GUI to smartmontools" +maintainer="yopito " +license="GPL-3" +homepage="http://gsmartcontrol.sourceforge.net/" +distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version}.tar.bz2" +checksum=708fa803243abb852ed52050fc82cd3592a798c02743342441996e77f19ffec6 + +CXXFLAGS="-std=c++11" + +post_install() { + # license files uneeded + rm -f ${PKGDESTDIR}/usr/share/doc/${pkgname}/LICENSE_* +}