- update to svn snapshot 2009-11-19

- remove upstreamed patches
This commit is contained in:
Michal Hlavinka 2009-11-19 11:20:11 +00:00
parent 0c4121fef6
commit 7fa6ab9a1f
7 changed files with 77 additions and 194 deletions

View File

@ -1 +1 @@
smartmontools-5.38.tar.gz smartmontools-5.38.snap20091119.tar.gz

View File

@ -1,55 +0,0 @@
Written-by: Tomas Smetana <tsmetana@redhat.com>
Reviewed-by: Tomas Janousek <tjanouse@redhat.com>
Reviewed-by: Karel Zak <kzak@redhat.com>
--- 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])

View File

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

View File

@ -1,7 +1,7 @@
diff -up smartmontools-5.38/configure.in.lowcap smartmontools-5.38/configure.in diff -up smartmontools-5.39/configure.in.lowcap smartmontools-5.39/configure.in
--- smartmontools-5.38/configure.in.lowcap 2009-10-12 17:00:53.889673785 +0200 --- smartmontools-5.39/configure.in.lowcap 2009-11-19 10:54:53.000000000 +0100
+++ smartmontools-5.38/configure.in 2009-10-12 17:00:53.896678618 +0200 +++ smartmontools-5.39/configure.in 2009-11-19 11:20:54.645701384 +0100
@@ -143,6 +143,40 @@ if test "$with_selinux" = "yes"; then @@ -219,6 +219,40 @@ if test "$with_selinux" = "yes"; then
AC_DEFINE(WITH_SELINUX, [1], [Define to 1 if SELinux support is enabled]) AC_DEFINE(WITH_SELINUX, [1], [Define to 1 if SELinux support is enabled])
fi fi
@ -42,10 +42,10 @@ diff -up smartmontools-5.38/configure.in.lowcap smartmontools-5.38/configure.in
if test "$prefix" = "NONE"; then if test "$prefix" = "NONE"; then
dnl no prefix and no mandir, so use ${prefix}/share/man as default dnl no prefix and no mandir, so use ${prefix}/share/man as default
if test "$mandir" = '${prefix}/man'; then if test "$mandir" = '${prefix}/man'; then
diff -up smartmontools-5.38/Makefile.am.lowcap smartmontools-5.38/Makefile.am diff -up smartmontools-5.39/Makefile.am.lowcap smartmontools-5.39/Makefile.am
--- smartmontools-5.38/Makefile.am.lowcap 2007-04-01 18:49:44.000000000 +0200 --- smartmontools-5.39/Makefile.am.lowcap 2009-11-19 10:54:53.000000000 +0100
+++ smartmontools-5.38/Makefile.am 2009-10-12 17:00:53.896678618 +0200 +++ smartmontools-5.39/Makefile.am 2009-11-19 11:20:54.646634706 +0100
@@ -35,7 +35,7 @@ smartd_SOURCES = smartd.cpp \ @@ -45,7 +45,7 @@ smartd_SOURCES = smartd.cpp \
utility.cpp \ utility.cpp \
utility.h utility.h
@ -54,10 +54,10 @@ diff -up smartmontools-5.38/Makefile.am.lowcap smartmontools-5.38/Makefile.am
smartd_DEPENDENCIES = @os_deps@ smartd_DEPENDENCIES = @os_deps@
EXTRA_smartd_SOURCES = os_darwin.cpp \ EXTRA_smartd_SOURCES = os_darwin.cpp \
diff -up smartmontools-5.38/smartd.8.in.lowcap smartmontools-5.38/smartd.8.in diff -up smartmontools-5.39/smartd.8.in.lowcap smartmontools-5.39/smartd.8.in
--- smartmontools-5.38/smartd.8.in.lowcap 2008-03-04 23:09:47.000000000 +0100 --- smartmontools-5.39/smartd.8.in.lowcap 2009-11-19 10:54:53.000000000 +0100
+++ smartmontools-5.38/smartd.8.in 2009-10-12 17:00:53.902672971 +0200 +++ smartmontools-5.39/smartd.8.in 2009-11-19 11:20:54.651596342 +0100
@@ -145,6 +145,12 @@ input. This is useful for commands like: @@ -175,6 +175,12 @@ input. This is useful for commands like:
to perform quick and simple checks without a configuration file. to perform quick and simple checks without a configuration file.
.TP .TP
@ -70,10 +70,10 @@ diff -up smartmontools-5.38/smartd.8.in.lowcap smartmontools-5.38/smartd.8.in
.B \-d, \-\-debug .B \-d, \-\-debug
Runs \fBsmartd\fP in "debug" mode. In this mode, it displays status Runs \fBsmartd\fP in "debug" mode. In this mode, it displays status
information to STDOUT rather than logging it to SYSLOG and does not 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 diff -up smartmontools-5.39/smartd.cpp.lowcap smartmontools-5.39/smartd.cpp
--- smartmontools-5.38/smartd.cpp.lowcap 2009-10-12 17:00:53.883672847 +0200 --- smartmontools-5.39/smartd.cpp.lowcap 2009-11-19 10:54:53.000000000 +0100
+++ smartmontools-5.38/smartd.cpp 2009-10-12 17:04:18.600547796 +0200 +++ smartmontools-5.39/smartd.cpp 2009-11-19 11:36:07.123632685 +0100
@@ -74,6 +74,10 @@ extern "C" int __stdcall FreeConsole(voi @@ -77,6 +77,10 @@ extern "C" int __stdcall FreeConsole(voi
#include <io.h> // setmode() #include <io.h> // setmode()
#endif // __CYGWIN__ #endif // __CYGWIN__
@ -84,7 +84,7 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp
// locally included files // locally included files
#include "int64.h" #include "int64.h"
#include "atacmds.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; static bool do_fork=true;
#endif #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 // used for control of printing, passing arguments to atacmds.c
smartmonctrl *con=NULL; 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)) if (epoch<(mail->lastsent+days))
return; 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 // record the time of this mail message, and the first mail message
if (!mail->logged) if (!mail->logged)
@@ -1239,6 +1257,11 @@ void Usage (void){ @@ -1464,6 +1481,11 @@ void Usage (void){
PrintOut(LOG_INFO," Quit on one of: %s\n\n", GetValidArgList('q')); PrintOut(LOG_INFO,"\n");
PrintOut(LOG_INFO," -r, --report=TYPE\n"); PrintOut(LOG_INFO," -c NAME|-, --configfile=NAME|-\n");
PrintOut(LOG_INFO," Report transactions for one of: %s\n\n", GetValidArgList('r')); PrintOut(LOG_INFO," Read configuration file NAME or stdin [default is %s]\n\n", configfile);
+#ifdef HAVE_LIBCAP_NG +#ifdef HAVE_LIBCAP_NG
+ PrintOut(LOG_INFO," -C, --usecapabilities\n"); + PrintOut(LOG_INFO," -C, --capabilities\n");
+ PrintOut(LOG_INFO," Use possix capabilities (EXPERIMENTAL).\n" + PrintOut(LOG_INFO," Use possix capabilities (EXPERIMENTAL).\n"
+ " Warning: Mail notification does not work when used.\n\n"); + " Warning: Mail notification does not work when used.\n\n");
+#endif +#endif
#ifdef _WIN32 PrintOut(LOG_INFO," -d, --debug\n");
PrintOut(LOG_INFO," --service\n"); PrintOut(LOG_INFO," Start smartd in debug mode\n\n");
PrintOut(LOG_INFO," Running as windows service (see man page), install with:\n"); PrintOut(LOG_INFO," -D, --showdirectives\n");
@@ -1260,6 +1283,9 @@ void Usage (void){ @@ -3701,7 +3723,7 @@ void ParseOpts(int argc, char **argv){
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){
char *tailptr; char *tailptr;
long lchecktime; long lchecktime;
// Please update GetValidArgList() if you edit shortopts // 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:s:A:B:Vh?";
+ const char *shortopts = "c:l:q:dDni:p:r:VCh?"; + const char *shortopts = "c:l:q:dDni:p:r:s:A:B:VCh?";
#ifdef HAVE_GETOPT_LONG
char *arg; char *arg;
// Please update GetValidArgList() if you edit longopts // 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' }, { "copyright", no_argument, 0, 'V' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, 0, 'h' },
{ "usage", no_argument, 0, 'h' }, { "usage", no_argument, 0, 'h' },
+#ifdef HAVE_LIBCAP_NG +#ifdef HAVE_LIBCAP_NG
+ { "usecapabilities",no_argument, 0, 'C' }, + { "capabilities", no_argument, 0, 'C' },
+#endif +#endif
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
#endif
@@ -4030,6 +4059,12 @@ void ParseOpts(int argc, char **argv){ @@ -3885,6 +3910,12 @@ void ParseOpts(int argc, char **argv){
PrintCopyleft(); PrintOut(LOG_INFO, "%s", format_version_info("smartd", true /*full*/).c_str());
EXIT(0); EXIT(0);
break; break;
+#ifdef HAVE_LIBCAP_NG +#ifdef HAVE_LIBCAP_NG
@ -166,11 +166,10 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp
case 'h': case 'h':
// help: print summary of command-line options // help: print summary of command-line options
debugmode=1; debugmode=1;
@@ -4408,6 +4443,16 @@ static int smartd_main(int argc, char ** @@ -4224,6 +4255,16 @@ int main_worker(int argc, char **argv)
bool write_states_always = true;
// don't exit on bad checksums
con->checksumfail=0;
+
+#ifdef HAVE_LIBCAP_NG +#ifdef HAVE_LIBCAP_NG
+ // Drop capabilities + // Drop capabilities
+ if (enable_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); + capng_apply(CAPNG_SELECT_BOTH);
+ } + }
+#endif +#endif
+
// the main loop of the code // the main loop of the code
while (1){ for (;;) {
@@ -4482,7 +4527,18 @@ static int smartd_main(int argc, char **
PrintTestSchedule(ATAandSCSIdevlist); @@ -4318,7 +4359,18 @@ int main_worker(int argc, char **argv)
PrintTestSchedule(configs, states, devices);
EXIT(0); EXIT(0);
} }
- -
+ +
+#ifdef HAVE_LIBCAP_NG +#ifdef HAVE_LIBCAP_NG
+ if (enable_capabilities) { + if (enable_capabilities) {
+ for(int i=0; i<numdevata+numdevscsi; i++) { + for (unsigned i = 0; i < configs.size(); i++) {
+ if (ATAandSCSIdevlist[i]->mailwarn) { + if (configs.at(i).emailaddress.empty()) {
+ PrintOut(LOG_WARNING,"Mail can't be enabled together with --usecapabilities. All mail will be suppressed.\n"); + PrintOut(LOG_WARNING,"Mail can't be enabled together with --capabilities. All mail will be suppressed.\n");
+ break; + break;
+ } + }
+ } + }
@ -202,4 +202,4 @@ diff -up smartmontools-5.38/smartd.cpp.lowcap smartmontools-5.38/smartd.cpp
+ +
// reset signal // reset signal
caughtsigHUP=0; caughtsigHUP=0;
}

View File

@ -1,20 +1,17 @@
Summary: Tools for monitoring SMART capable hard disks Summary: Tools for monitoring SMART capable hard disks
Name: smartmontools Name: smartmontools
Version: 5.38 Version: 5.38
Release: 22%{?dist} Release: 23.20091119svn%{?dist}
Epoch: 1 Epoch: 1
Group: System Environment/Base Group: System Environment/Base
License: GPLv2+ License: GPLv2+
URL: http://smartmontools.sourceforge.net/ 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 Source1: smartd.initd
Source2: smartmontools.sysconf Source2: smartmontools.sysconf
Patch1: smartmontools-5.38-cloexec.patch # fedora specific
Patch2: smartmontools-5.37-addrinfo.patch Patch1: smartmontools-5.38-defaultconf.patch
Patch3: smartmontools-5.38-perc.patch Patch2: smartmontools-5.38-lowcap.patch
Patch4: smartmontools-5.38-selinux.patch
Patch5: smartmontools-5.38-defaultconf.patch
Patch6: smartmontools-5.38-lowcap.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires: fileutils mailx chkconfig initscripts Requires: fileutils mailx chkconfig initscripts
BuildRequires: readline-devel ncurses-devel /usr/bin/aclocal util-linux groff gettext 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. failure.
%prep %prep
%setup -q %setup -q -n %{name}-5.39
%patch1 -p1 -b .cloexec %patch1 -p1 -b .defaultconf
%patch2 -p1 -b .addrinfo %patch2 -p1 -b .lowcap
%patch3 -p1 -b .perc
%patch4 -p1 -b .selinux
%patch5 -p1 -b .defaultconf
%patch6 -p1 -b .lowcap
# fix encoding # fix encoding
for fe in AUTHORS CHANGELOG for fe in AUTHORS CHANGELOG
@ -47,7 +40,7 @@ done
%build %build
ln -s CHANGELOG ChangeLog ln -s CHANGELOG ChangeLog
autoreconf -i autoreconf -fiv
%configure --with-selinux --with-libcap-ng=yes %configure --with-selinux --with-libcap-ng=yes
%ifarch sparc64 %ifarch sparc64
make CXXFLAGS="$RPM_OPT_FLAGS -fPIE" LDFLAGS="-pie -Wl,-z,relro,-z,now" 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 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/smartd
install -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/smartmontools 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 %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
@ -89,6 +85,10 @@ fi
%config(noreplace) %{_sysconfdir}/sysconfig/smartmontools %config(noreplace) %{_sysconfdir}/sysconfig/smartmontools
%changelog %changelog
* Thu Nov 19 2009 Michal Hlavinka <mhlavink@redhat.com> - 1:5.38-23.20091119svn
- update to svn snapshot 2009-11-19
- remove upstreamed patches
* Mon Nov 02 2009 Michal Hlavinka <mhlavink@redhat.com> - 1:5.38-22 * Mon Nov 02 2009 Michal Hlavinka <mhlavink@redhat.com> - 1:5.38-22
- spec cleanup - spec cleanup

View File

@ -1,4 +1,4 @@
# command line options for smartd # command line options for smartd
smartd_opts="-q never" smartd_opts="-q never -n standby,10,q"
# autogenerated config file options # autogenerated config file options
# smartd_conf_opts="-H -m root" # smartd_conf_opts="-H -m root"

View File

@ -1 +1 @@
a282846532ecbd6b4a28072373b3a70b smartmontools-5.38.tar.gz a6d75d14c64cb169145b90c7e0afdc96 smartmontools-5.38.snap20091119.tar.gz