From 7fa6ab9a1ff644cdb28ccf756f722704ba0924c1 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Thu, 19 Nov 2009 11:20:11 +0000 Subject: [PATCH] - update to svn snapshot 2009-11-19 - remove upstreamed patches --- .cvsignore | 2 +- smartmontools-5.37-addrinfo.patch | 55 -------------- smartmontools-5.38-cloexec.patch | 62 ---------------- smartmontools-5.38-lowcap.patch | 116 +++++++++++++++--------------- smartmontools.spec | 32 ++++----- smartmontools.sysconf | 2 +- sources | 2 +- 7 files changed, 77 insertions(+), 194 deletions(-) delete mode 100644 smartmontools-5.37-addrinfo.patch delete mode 100644 smartmontools-5.38-cloexec.patch diff --git a/.cvsignore b/.cvsignore index e9657b9..3d1fb32 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -smartmontools-5.38.tar.gz +smartmontools-5.38.snap20091119.tar.gz diff --git a/smartmontools-5.37-addrinfo.patch b/smartmontools-5.37-addrinfo.patch deleted file mode 100644 index 1d01d6b..0000000 --- a/smartmontools-5.37-addrinfo.patch +++ /dev/null @@ -1,55 +0,0 @@ -Written-by: Tomas Smetana -Reviewed-by: Tomas Janousek -Reviewed-by: Karel Zak - ---- smartmontools-5.37/smartd.cpp.addrinfo 2007-10-15 16:53:37.000000000 +0200 -+++ smartmontools-5.37/smartd.cpp 2007-10-15 16:54:18.000000000 +0200 -@@ -498,7 +498,28 @@ - - char* dnsdomain(const char* hostname) { - char *p = NULL; --#ifdef HAVE_GETHOSTBYNAME -+#ifdef HAVE_GETADDRINFO -+ static char canon_name[NI_MAXHOST]; -+ struct addrinfo *info = NULL; -+ struct addrinfo hints; -+ int err; -+ -+ memset(&hints, 0, sizeof(hints)); -+ hints.ai_flags = AI_CANONNAME; -+ if ((err = getaddrinfo(hostname, NULL, &hints, &info)) || (!info)) { -+ PrintOut(LOG_CRIT, "Error retrieving info for %s: %s\n", -+ hostname, gai_strerror(err)); -+ return NULL; -+ } -+ if (info->ai_canonname) { -+ strncpy(canon_name, info->ai_canonname, sizeof(canon_name)); -+ canon_name[NI_MAXHOST - 1] = '\0'; -+ p = canon_name; -+ if((p = strchr(canon_name, '.'))) -+ p++; -+ } -+ freeaddrinfo(info); -+#elif HAVE_GETHOSTBYNAME - struct hostent *hp; - - if ((hp = gethostbyname(hostname))) { -@@ -506,7 +527,7 @@ - // colon/dot notation? [BA] - if ((p = strchr(hp->h_name, '.'))) - p++; // skip "." -- } -+ } - #else - ARGUSED(hostname); - #endif ---- smartmontools-5.37/configure.in.addrinfo 2006-12-20 21:39:25.000000000 +0100 -+++ smartmontools-5.37/configure.in 2007-10-15 16:53:37.000000000 +0200 -@@ -70,6 +70,7 @@ - AC_CHECK_FUNCS([getopt_long]) - AC_CHECK_FUNCS([getdomainname]) - AC_CHECK_FUNCS([gethostname]) -+AC_CHECK_FUNCS([getaddrinfo]) - AC_CHECK_FUNCS([gethostbyname]) - AC_CHECK_FUNCS([sigset]) - AC_CHECK_FUNCS([strtoull]) diff --git a/smartmontools-5.38-cloexec.patch b/smartmontools-5.38-cloexec.patch deleted file mode 100644 index db6aebf..0000000 --- a/smartmontools-5.38-cloexec.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff -up smartmontools-5.38/os_linux.cpp.cloexec smartmontools-5.38/os_linux.cpp ---- smartmontools-5.38/os_linux.cpp.cloexec 2008-03-04 23:09:47.000000000 +0100 -+++ smartmontools-5.38/os_linux.cpp 2008-03-18 08:28:20.000000000 +0100 -@@ -171,14 +171,13 @@ static char prev_scsi_dev[128]; - - // equivalent to open(path, flags) - int deviceopen(const char *pathname, char *type){ -- int fd; -+ int fd = -1; - - if (0 == strcmp(type,"SCSI")) { - strncpy(prev_scsi_dev, pathname, sizeof(prev_scsi_dev) - 1); - fd = open(pathname, O_RDWR | O_NONBLOCK); - if (fd < 0 && errno == EROFS) - fd = open(pathname, O_RDONLY | O_NONBLOCK); -- return fd; - } else if (0 == strcmp(type,"ATA")) { - // smartd re-opens SCSI devices with "type"==ATA for some reason. - // If that was a SCSI generic device (e.g. /dev/sg0) then the -@@ -186,9 +185,9 @@ int deviceopen(const char *pathname, cha - // The purpose of the next code line is to limit the scope of - // this change as a release is pending (and smartd needs a rewrite). - if (0 == strncmp(pathname, prev_scsi_dev, sizeof(prev_scsi_dev))) -- return open(pathname, O_RDWR | O_NONBLOCK); -+ fd = open(pathname, O_RDWR | O_NONBLOCK); - else -- return open(pathname, O_RDONLY | O_NONBLOCK); -+ fd = open(pathname, O_RDONLY | O_NONBLOCK); - } else if (0 == strcmp(type,"ATA_3WARE_9000")) { - // the device nodes for this controller are dynamically assigned, - // so we need to check that they exist with the correct major -@@ -198,7 +197,7 @@ int deviceopen(const char *pathname, cha - errno=ENXIO; - return -1; - } -- return open(pathname, O_RDONLY | O_NONBLOCK); -+ fd = open(pathname, O_RDONLY | O_NONBLOCK); - } - else if (0 == strcmp(type,"ATA_3WARE_678K")) { - // the device nodes for this controller are dynamically assigned, -@@ -209,15 +208,17 @@ int deviceopen(const char *pathname, cha - errno=ENXIO; - return -1; - } -- return open(pathname, O_RDONLY | O_NONBLOCK); -+ fd = open(pathname, O_RDONLY | O_NONBLOCK); - } - else if(0 == strcmp(type, "CCISS")) { - // the device is a cciss smart array device. -- return open(pathname, O_RDWR | O_NONBLOCK); -+ fd = open(pathname, O_RDWR | O_NONBLOCK); - } -- else -- return -1; - -+ if (fd != -1) { -+ fcntl(fd, F_SETFD, FD_CLOEXEC); -+ } -+ return fd; - } - - // equivalent to close(file descriptor) diff --git a/smartmontools-5.38-lowcap.patch b/smartmontools-5.38-lowcap.patch index b3721c7..e3d6d69 100644 --- a/smartmontools-5.38-lowcap.patch +++ b/smartmontools-5.38-lowcap.patch @@ -1,7 +1,7 @@ -diff -up smartmontools-5.38/configure.in.lowcap smartmontools-5.38/configure.in ---- smartmontools-5.38/configure.in.lowcap 2009-10-12 17:00:53.889673785 +0200 -+++ smartmontools-5.38/configure.in 2009-10-12 17:00:53.896678618 +0200 -@@ -143,6 +143,40 @@ if test "$with_selinux" = "yes"; then +diff -up smartmontools-5.39/configure.in.lowcap smartmontools-5.39/configure.in +--- smartmontools-5.39/configure.in.lowcap 2009-11-19 10:54:53.000000000 +0100 ++++ smartmontools-5.39/configure.in 2009-11-19 11:20:54.645701384 +0100 +@@ -219,6 +219,40 @@ if test "$with_selinux" = "yes"; then AC_DEFINE(WITH_SELINUX, [1], [Define to 1 if SELinux support is enabled]) fi @@ -42,10 +42,10 @@ diff -up smartmontools-5.38/configure.in.lowcap smartmontools-5.38/configure.in if test "$prefix" = "NONE"; then dnl no prefix and no mandir, so use ${prefix}/share/man as default if test "$mandir" = '${prefix}/man'; then -diff -up smartmontools-5.38/Makefile.am.lowcap smartmontools-5.38/Makefile.am ---- smartmontools-5.38/Makefile.am.lowcap 2007-04-01 18:49:44.000000000 +0200 -+++ smartmontools-5.38/Makefile.am 2009-10-12 17:00:53.896678618 +0200 -@@ -35,7 +35,7 @@ smartd_SOURCES = smartd.cpp \ +diff -up smartmontools-5.39/Makefile.am.lowcap smartmontools-5.39/Makefile.am +--- smartmontools-5.39/Makefile.am.lowcap 2009-11-19 10:54:53.000000000 +0100 ++++ smartmontools-5.39/Makefile.am 2009-11-19 11:20:54.646634706 +0100 +@@ -45,7 +45,7 @@ smartd_SOURCES = smartd.cpp \ utility.cpp \ utility.h @@ -54,10 +54,10 @@ diff -up smartmontools-5.38/Makefile.am.lowcap smartmontools-5.38/Makefile.am smartd_DEPENDENCIES = @os_deps@ EXTRA_smartd_SOURCES = os_darwin.cpp \ -diff -up smartmontools-5.38/smartd.8.in.lowcap smartmontools-5.38/smartd.8.in ---- smartmontools-5.38/smartd.8.in.lowcap 2008-03-04 23:09:47.000000000 +0100 -+++ smartmontools-5.38/smartd.8.in 2009-10-12 17:00:53.902672971 +0200 -@@ -145,6 +145,12 @@ input. This is useful for commands like: +diff -up smartmontools-5.39/smartd.8.in.lowcap smartmontools-5.39/smartd.8.in +--- smartmontools-5.39/smartd.8.in.lowcap 2009-11-19 10:54:53.000000000 +0100 ++++ smartmontools-5.39/smartd.8.in 2009-11-19 11:20:54.651596342 +0100 +@@ -175,6 +175,12 @@ input. This is useful for commands like: to perform quick and simple checks without a configuration file. .TP @@ -70,10 +70,10 @@ diff -up smartmontools-5.38/smartd.8.in.lowcap smartmontools-5.38/smartd.8.in .B \-d, \-\-debug Runs \fBsmartd\fP in "debug" mode. In this mode, it displays status information to STDOUT rather than logging it to SYSLOG and does not -diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp ---- smartmontools-5.38/smartd.cpp.lowcap 2009-10-12 17:00:53.883672847 +0200 -+++ smartmontools-5.38/smartd.cpp 2009-10-12 17:04:18.600547796 +0200 -@@ -74,6 +74,10 @@ extern "C" int __stdcall FreeConsole(voi +diff -up smartmontools-5.39/smartd.cpp.lowcap smartmontools-5.39/smartd.cpp +--- smartmontools-5.39/smartd.cpp.lowcap 2009-11-19 10:54:53.000000000 +0100 ++++ smartmontools-5.39/smartd.cpp 2009-11-19 11:36:07.123632685 +0100 +@@ -77,6 +77,10 @@ extern "C" int __stdcall FreeConsole(voi #include // setmode() #endif // __CYGWIN__ @@ -84,7 +84,7 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp // locally included files #include "int64.h" #include "atacmds.h" -@@ -179,6 +183,11 @@ static int facility=LOG_DAEMON; +@@ -190,6 +194,11 @@ static int facility=LOG_DAEMON; static bool do_fork=true; #endif @@ -96,7 +96,17 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp // used for control of printing, passing arguments to atacmds.c smartmonctrl *con=NULL; -@@ -613,6 +622,15 @@ void MailWarning(cfgfile *cfg, int which +@@ -875,8 +884,7 @@ static void MailWarning(const dev_config + const char *unknown="[Unknown]"; + + // See if user wants us to send mail +- if (cfg.emailaddress.empty() && cfg.emailcmdline.empty()) +- return; ++ + + std::string address = cfg.emailaddress; + const char * executable = cfg.emailcmdline.c_str(); +@@ -917,6 +925,15 @@ static void MailWarning(const dev_config if (epoch<(mail->lastsent+days)) return; } @@ -112,49 +122,39 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp // record the time of this mail message, and the first mail message if (!mail->logged) -@@ -1239,6 +1257,11 @@ void Usage (void){ - PrintOut(LOG_INFO," Quit on one of: %s\n\n", GetValidArgList('q')); - PrintOut(LOG_INFO," -r, --report=TYPE\n"); - PrintOut(LOG_INFO," Report transactions for one of: %s\n\n", GetValidArgList('r')); +@@ -1464,6 +1481,11 @@ void Usage (void){ + PrintOut(LOG_INFO,"\n"); + PrintOut(LOG_INFO," -c NAME|-, --configfile=NAME|-\n"); + PrintOut(LOG_INFO," Read configuration file NAME or stdin [default is %s]\n\n", configfile); +#ifdef HAVE_LIBCAP_NG -+ PrintOut(LOG_INFO," -C, --usecapabilities\n"); ++ PrintOut(LOG_INFO," -C, --capabilities\n"); + PrintOut(LOG_INFO," Use possix capabilities (EXPERIMENTAL).\n" + " Warning: Mail notification does not work when used.\n\n"); +#endif - #ifdef _WIN32 - PrintOut(LOG_INFO," --service\n"); - PrintOut(LOG_INFO," Running as windows service (see man page), install with:\n"); -@@ -1260,6 +1283,9 @@ void Usage (void){ - PrintOut(LOG_INFO," -p NAME Write PID file NAME\n"); - PrintOut(LOG_INFO," -q WHEN Quit on one of: %s\n", GetValidArgList('q')); - PrintOut(LOG_INFO," -r TYPE Report transactions for one of: %s\n", GetValidArgList('r')); -+#ifdef HAVE_LIBCAP_NG -+ PrintOut(LOG_INFO," -C Use possix capabilities (EXPERIMENTAL)\n"); -+#endif - PrintOut(LOG_INFO," -V Print License, Copyright, and version information\n"); - #endif - } -@@ -3866,7 +3892,7 @@ void ParseOpts(int argc, char **argv){ + PrintOut(LOG_INFO," -d, --debug\n"); + PrintOut(LOG_INFO," Start smartd in debug mode\n\n"); + PrintOut(LOG_INFO," -D, --showdirectives\n"); +@@ -3701,7 +3723,7 @@ void ParseOpts(int argc, char **argv){ char *tailptr; long lchecktime; // Please update GetValidArgList() if you edit shortopts -- const char *shortopts = "c:l:q:dDni:p:r:Vh?"; -+ const char *shortopts = "c:l:q:dDni:p:r:VCh?"; - #ifdef HAVE_GETOPT_LONG +- const char *shortopts = "c:l:q:dDni:p:r:s:A:B:Vh?"; ++ const char *shortopts = "c:l:q:dDni:p:r:s:A:B:VCh?"; char *arg; // Please update GetValidArgList() if you edit longopts -@@ -3890,6 +3916,9 @@ void ParseOpts(int argc, char **argv){ + struct option longopts[] = { +@@ -3727,6 +3749,9 @@ void ParseOpts(int argc, char **argv){ { "copyright", no_argument, 0, 'V' }, { "help", no_argument, 0, 'h' }, { "usage", no_argument, 0, 'h' }, +#ifdef HAVE_LIBCAP_NG -+ { "usecapabilities",no_argument, 0, 'C' }, ++ { "capabilities", no_argument, 0, 'C' }, +#endif { 0, 0, 0, 0 } }; - #endif -@@ -4030,6 +4059,12 @@ void ParseOpts(int argc, char **argv){ - PrintCopyleft(); + +@@ -3885,6 +3910,12 @@ void ParseOpts(int argc, char **argv){ + PrintOut(LOG_INFO, "%s", format_version_info("smartd", true /*full*/).c_str()); EXIT(0); break; +#ifdef HAVE_LIBCAP_NG @@ -166,11 +166,10 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp case 'h': // help: print summary of command-line options debugmode=1; -@@ -4408,6 +4443,16 @@ static int smartd_main(int argc, char ** - - // don't exit on bad checksums - con->checksumfail=0; -+ +@@ -4224,6 +4255,16 @@ int main_worker(int argc, char **argv) + + bool write_states_always = true; + +#ifdef HAVE_LIBCAP_NG + // Drop capabilities + if (enable_capabilities) { @@ -180,20 +179,21 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp + capng_apply(CAPNG_SELECT_BOTH); + } +#endif - ++ // the main loop of the code - while (1){ -@@ -4482,7 +4527,18 @@ static int smartd_main(int argc, char ** - PrintTestSchedule(ATAandSCSIdevlist); + for (;;) { + +@@ -4318,7 +4359,18 @@ int main_worker(int argc, char **argv) + PrintTestSchedule(configs, states, devices); EXIT(0); } - + +#ifdef HAVE_LIBCAP_NG + if (enable_capabilities) { -+ for(int i=0; imailwarn) { -+ PrintOut(LOG_WARNING,"Mail can't be enabled together with --usecapabilities. All mail will be suppressed.\n"); ++ for (unsigned i = 0; i < configs.size(); i++) { ++ if (configs.at(i).emailaddress.empty()) { ++ PrintOut(LOG_WARNING,"Mail can't be enabled together with --capabilities. All mail will be suppressed.\n"); + break; + } + } @@ -202,4 +202,4 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp + // reset signal caughtsigHUP=0; - } + diff --git a/smartmontools.spec b/smartmontools.spec index a12b92f..5395953 100644 --- a/smartmontools.spec +++ b/smartmontools.spec @@ -1,20 +1,17 @@ Summary: Tools for monitoring SMART capable hard disks Name: smartmontools Version: 5.38 -Release: 22%{?dist} +Release: 23.20091119svn%{?dist} Epoch: 1 Group: System Environment/Base License: GPLv2+ URL: http://smartmontools.sourceforge.net/ -Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.snap20091119.tar.gz Source1: smartd.initd Source2: smartmontools.sysconf -Patch1: smartmontools-5.38-cloexec.patch -Patch2: smartmontools-5.37-addrinfo.patch -Patch3: smartmontools-5.38-perc.patch -Patch4: smartmontools-5.38-selinux.patch -Patch5: smartmontools-5.38-defaultconf.patch -Patch6: smartmontools-5.38-lowcap.patch +# fedora specific +Patch1: smartmontools-5.38-defaultconf.patch +Patch2: smartmontools-5.38-lowcap.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Requires: fileutils mailx chkconfig initscripts BuildRequires: readline-devel ncurses-devel /usr/bin/aclocal util-linux groff gettext @@ -29,13 +26,9 @@ utilities will provide advanced warning of disk degradation and failure. %prep -%setup -q -%patch1 -p1 -b .cloexec -%patch2 -p1 -b .addrinfo -%patch3 -p1 -b .perc -%patch4 -p1 -b .selinux -%patch5 -p1 -b .defaultconf -%patch6 -p1 -b .lowcap +%setup -q -n %{name}-5.39 +%patch1 -p1 -b .defaultconf +%patch2 -p1 -b .lowcap # fix encoding for fe in AUTHORS CHANGELOG @@ -47,7 +40,7 @@ done %build ln -s CHANGELOG ChangeLog -autoreconf -i +autoreconf -fiv %configure --with-selinux --with-libcap-ng=yes %ifarch sparc64 make CXXFLAGS="$RPM_OPT_FLAGS -fPIE" LDFLAGS="-pie -Wl,-z,relro,-z,now" @@ -65,6 +58,9 @@ chmod a-x -R examplescripts/* install -D -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/smartd install -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/smartmontools +# TODO: remove once 5.39 is released +rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-5.39 + %clean rm -rf $RPM_BUILD_ROOT @@ -89,6 +85,10 @@ fi %config(noreplace) %{_sysconfdir}/sysconfig/smartmontools %changelog +* Thu Nov 19 2009 Michal Hlavinka - 1:5.38-23.20091119svn +- update to svn snapshot 2009-11-19 +- remove upstreamed patches + * Mon Nov 02 2009 Michal Hlavinka - 1:5.38-22 - spec cleanup diff --git a/smartmontools.sysconf b/smartmontools.sysconf index 75d591c..ff532e1 100644 --- a/smartmontools.sysconf +++ b/smartmontools.sysconf @@ -1,4 +1,4 @@ # command line options for smartd -smartd_opts="-q never" +smartd_opts="-q never -n standby,10,q" # autogenerated config file options # smartd_conf_opts="-H -m root" diff --git a/sources b/sources index 0bd0b62..5e0b142 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a282846532ecbd6b4a28072373b3a70b smartmontools-5.38.tar.gz +a6d75d14c64cb169145b90c7e0afdc96 smartmontools-5.38.snap20091119.tar.gz