Merge pull request #3034 from yopito/gsmartcontrol

New package: gsmartcontrol 0.8.7
This commit is contained in:
Juan RP 2015-11-25 07:13:20 +01:00
commit 07eb3ea86f
2 changed files with 65 additions and 0 deletions

View File

@ -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) {

View File

@ -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 <pierre.bourgin@free.fr>"
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_*
}