Hello community, here is the log from the commit of package tmpwatch for openSUSE:Factory checked in at 2014-02-03 16:41:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tmpwatch (Old) and /work/SRC/openSUSE:Factory/.tmpwatch.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tmpwatch" Changes: -------- --- /work/SRC/openSUSE:Factory/tmpwatch/tmpwatch.changes 2011-09-23 12:48:20.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.tmpwatch.new/tmpwatch.changes 2014-02-03 16:42:00.000000000 +0100 @@ -1,0 +2,20 @@ +Sun Feb 2 14:24:08 UTC 2014 - [email protected] + +- license update: GPL-2.0 + See e.g. tmpwatch.c - tell upstream about this + +------------------------------------------------------------------- +Thu Jan 23 21:46:39 UTC 2014 - [email protected] + +- use %{_sysconfdir} for /etc + +------------------------------------------------------------------- +Fri Aug 10 20:24:34 UTC 2012 - [email protected] + +- update to 2.11 + * INCOMPATIBLE CHANGE: On Linux, sockets that are certainly unused + are now removed by default. +- fix License to be in spdx format + * GPL-2.0+ + +------------------------------------------------------------------- Old: ---- tmpwatch-2.10.3.tar.bz2 New: ---- tmpwatch-2.11.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tmpwatch.spec ++++++ --- /var/tmp/diff_new_pack.z6sFF5/_old 2014-02-03 16:42:01.000000000 +0100 +++ /var/tmp/diff_new_pack.z6sFF5/_new 2014-02-03 16:42:01.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package tmpwatch # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,19 +16,19 @@ # -Summary: Watches file system activity, such as /tmp files - Name: tmpwatch -Version: 2.10.3 -Release: 11 -Url: https://fedorahosted.org/tmpwatch -Source0: https://fedorahosted.org/releases/t/m/tmpwatch/%{name}-%{version}.tar.bz2 -Source1: tmpwatch.daily +Summary: Watches file system activity, such as /tmp files License: GPL-2.0 Group: Productivity/Security +Version: 2.11 +Release: 0 +Url: https://fedorahosted.org/tmpwatch +Source0: https://fedorahosted.org/releases/t/m/tmpwatch/%{name}-%{version}.tar.bz2 +Source1: %{name}.daily BuildRoot: %{_tmppath}/%{name}-%{version}-build -Requires: psmisc cron BuildRequires: psmisc +Requires: cron +Requires: psmisc %description The tmpwatch utility recursively searches through specified directories @@ -39,15 +39,6 @@ There are multiple tools called "tmpwatch", this package contains the Fedora/Red Hat version available at https://fedorahosted.org/tmpwatch - - -Authors: --------- - Erik Troan <[email protected]> - Preston Brown <[email protected]> - Mike A. Harris <[email protected]> - Miloslav Trmac <[email protected]> - %prep %setup -q @@ -56,10 +47,8 @@ %{__make} %install -%{__make} install DESTDIR=%{buildroot} -%{__mkdir_p} %{buildroot}/etc/cron.daily -%{__cp} %{SOURCE1} %{buildroot}/etc/cron.daily/tmpwatch -chmod +x %{buildroot}/etc/cron.daily/tmpwatch +%makeinstall +%{__install} -D -m755 %{S:1} %{buildroot}%{_sysconfdir}/cron.daily/%{name} %clean rm -rf %{buildroot} @@ -67,8 +56,8 @@ %files %defattr(-,root,root) %doc ChangeLog NEWS README COPYING -%{_sbindir}/tmpwatch -%{_mandir}/man8/tmpwatch.8* -%config(noreplace) /etc/cron.daily/tmpwatch +%config(noreplace) %{_sysconfdir}/cron.daily/%{name} +%{_sbindir}/%{name} +%{_mandir}/man8/%{name}.8* %changelog ++++++ tmpwatch-2.10.3.tar.bz2 -> tmpwatch-2.11.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/ChangeLog new/tmpwatch-2.11/ChangeLog --- old/tmpwatch-2.10.3/ChangeLog 2011-07-19 22:47:08.000000000 +0200 +++ new/tmpwatch-2.11/ChangeLog 2012-05-26 01:26:35.000000000 +0200 @@ -1,3 +1,41 @@ +2012-05-26 Miloslav Trmač <[email protected]> + + * configure.ac: Release 2.11. + * NEWS: Update. + + * tmpwatch.c (FLAG_ALLFILES): Update comment. + (socket_kill_time): New variable, taking over FLAG_ALLFILES handling + for sockets. + (cleanupDirectory): Use socket_kill_time for sockets, and depend on it + for FLAG_ALLFILES handling of sockets. + (main): Move kill_time initialization ... + (compute_kill_times): ... to this new function. Set socket_kill_time + to (time of last boot - grace period) on Linux. + * tmpwatch.8: Document that unused socketes may be removed, and that + -a reverts to purely time-based behavior for them. + * m4/gnulib-cache.m4: Add module clock-time. + * Makefile.am (tmpwatch_LDADD): Use libraries necessary for + clock_gettime (). + +2012-05-25 Miloslav Trmač <[email protected]> + + * tmpwatch.c (cleanupDirectory): Simplify control flow a little. + + * tmpwatch.c (check_fuser, cleanupDirectory): Remove unnecessary + parentheses. + + * tmpwatch.c (safe_chdir, cleanupDirectory, main): Replace implicit + comparisions to zero with explicit comparisons. + + * tmpwatch.c (kill_time, config_flags): New variables. + (cleanupDirectory): Use `kill_time' and `config_flags' instead of + passing around parameters `killTime' and `flags'. + (main): Use `kill_time' and `config_flags' instead of local variables + `killTime' and `flags'. + + * bind-mount.c (bind_mount_paths_index): Remove an unused variable. + (is_bind_mount): Stop setting bind_mount_paths_index. + 2011-07-19 Miloslav Trmač <[email protected]> * configure.ac: Release 2.10.3. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/Makefile.am new/tmpwatch-2.11/Makefile.am --- old/tmpwatch-2.10.3/Makefile.am 2011-03-21 20:01:11.000000000 +0100 +++ new/tmpwatch-2.11/Makefile.am 2012-05-25 23:01:10.000000000 +0200 @@ -13,7 +13,7 @@ ## Rules tmpwatch_SOURCES = bind-mount.c bind-mount.h tmpwatch.c -tmpwatch_LDADD = lib/libgnu.a $(LIBINTL) +tmpwatch_LDADD = lib/libgnu.a $(LIBINTL) $(LIB_CLOCK_GETTIME) force-tag: cd $(top_srcdir); hg tag -f $(HGTAG) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/Makefile.in new/tmpwatch-2.11/Makefile.in --- old/tmpwatch-2.10.3/Makefile.in 2011-07-19 22:44:46.000000000 +0200 +++ new/tmpwatch-2.11/Makefile.in 2012-05-26 01:26:42.000000000 +0200 @@ -40,9 +40,10 @@ ChangeLog INSTALL NEWS admin/depcomp admin/install-sh \ admin/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/error.m4 \ - $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/clock_time.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/stdint.m4 \ @@ -65,7 +66,8 @@ am_tmpwatch_OBJECTS = bind-mount.$(OBJEXT) tmpwatch.$(OBJEXT) tmpwatch_OBJECTS = $(am_tmpwatch_OBJECTS) am__DEPENDENCIES_1 = -tmpwatch_DEPENDENCIES = lib/libgnu.a $(am__DEPENDENCIES_1) +tmpwatch_DEPENDENCIES = lib/libgnu.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles @@ -284,6 +286,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -375,7 +378,7 @@ SUBDIRS = lib dist_man8_MANS = tmpwatch.8 tmpwatch_SOURCES = bind-mount.c bind-mount.h tmpwatch.c -tmpwatch_LDADD = lib/libgnu.a $(LIBINTL) +tmpwatch_LDADD = lib/libgnu.a $(LIBINTL) $(LIB_CLOCK_GETTIME) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/NEWS new/tmpwatch-2.11/NEWS --- old/tmpwatch-2.10.3/NEWS 2011-07-19 22:44:26.000000000 +0200 +++ new/tmpwatch-2.11/NEWS 2012-05-26 01:26:14.000000000 +0200 @@ -1,3 +1,7 @@ +2.11 +* INCOMPATIBLE CHANGE: On Linux, sockets that are certainly unused are now + removed by default. + 2.10.3 * Don't report EACCES errors, they can be routinely returned by FUSE mounts. * Minor bug fixes in bind mount handling. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/aclocal.m4 new/tmpwatch-2.11/aclocal.m4 --- old/tmpwatch-2.10.3/aclocal.m4 2011-07-19 22:44:44.000000000 +0200 +++ new/tmpwatch-2.11/aclocal.m4 2012-05-26 01:26:41.000000000 +0200 @@ -949,6 +949,7 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([m4/clock_time.m4]) m4_include([m4/error.m4]) m4_include([m4/exitfail.m4]) m4_include([m4/extensions.m4]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/bind-mount.c new/tmpwatch-2.11/bind-mount.c --- old/tmpwatch-2.10.3/bind-mount.c 2011-04-28 17:28:11.000000000 +0200 +++ new/tmpwatch-2.11/bind-mount.c 2012-05-25 23:13:54.000000000 +0200 @@ -289,9 +289,6 @@ /* Known bind mount paths */ static struct string_list bind_mount_paths; /* = { 0, }; */ -/* Next bind_mount_paths entry */ -static size_t bind_mount_paths_index; /* = 0; */ - static struct obstack bind_mount_paths_obstack; static void *bind_mount_paths_mark; @@ -419,7 +416,6 @@ return false; if ((pfd.revents & POLLPRI) != 0) { rebuild_bind_mount_paths(); - bind_mount_paths_index = 0; } return bsearch(path, bind_mount_paths.entries, bind_mount_paths.len, sizeof (*bind_mount_paths.entries), cmp_string_pointer) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/config.h.in new/tmpwatch-2.11/config.h.in --- old/tmpwatch-2.10.3/config.h.in 2011-07-19 22:44:57.000000000 +0200 +++ new/tmpwatch-2.11/config.h.in 2012-05-26 01:26:46.000000000 +0200 @@ -24,6 +24,12 @@ /* Define to make the limit macros in <stdint.h> visible. */ #undef GL_TRIGGER_STDC_LIMIT_MACROS +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 if you have the `clock_settime' function. */ +#undef HAVE_CLOCK_SETTIME + /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. */ #undef HAVE_DECL_GETENV diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/configure new/tmpwatch-2.11/configure --- old/tmpwatch-2.10.3/configure 2011-07-19 22:44:46.000000000 +0200 +++ new/tmpwatch-2.11/configure 2012-05-26 01:26:42.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for tmpwatch 2.10.3. +# Generated by GNU Autoconf 2.68 for tmpwatch 2.11. # # Report bugs to <https://fedorahosted.org/tmpwatch/>. # @@ -560,8 +560,8 @@ # Identity of this package. PACKAGE_NAME='tmpwatch' PACKAGE_TARNAME='tmpwatch' -PACKAGE_VERSION='2.10.3' -PACKAGE_STRING='tmpwatch 2.10.3' +PACKAGE_VERSION='2.11' +PACKAGE_STRING='tmpwatch 2.11' PACKAGE_BUGREPORT='https://fedorahosted.org/tmpwatch/' PACKAGE_URL='https://fedorahosted.org/tmpwatch/' @@ -739,6 +739,7 @@ LTLIBINTL LIBINTL GETOPT_H +LIB_CLOCK_GETTIME GL_COND_LIBTOOL_FALSE GL_COND_LIBTOOL_TRUE EGREP @@ -1382,7 +1383,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tmpwatch 2.10.3 to adapt to many kinds of systems. +\`configure' configures tmpwatch 2.11 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1448,7 +1449,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tmpwatch 2.10.3:";; + short | recursive ) echo "Configuration of tmpwatch 2.11:";; esac cat <<\_ACEOF @@ -1545,7 +1546,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tmpwatch configure 2.10.3 +tmpwatch configure 2.11 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1844,52 +1845,6 @@ } # ac_fn_c_try_link -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -1957,6 +1912,52 @@ } # ac_fn_c_check_func +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl + # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes @@ -2138,7 +2139,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tmpwatch $as_me 2.10.3, which was +It was created by tmpwatch $as_me 2.11, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2964,7 +2965,7 @@ # Define the identity of the package. PACKAGE='tmpwatch' - VERSION='2.10.3' + VERSION='2.11' # Some tools Automake needs. @@ -5916,6 +5917,88 @@ + # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. + # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. + + # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all* + # programs in the package would end up linked with that potentially-shared + # library, inducing unnecessary run-time overhead. + gl_saved_libs=$LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +$as_echo_n "checking for library containing clock_gettime... " >&6; } +if ${ac_cv_search_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt posix4; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_clock_gettime=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_clock_gettime+:} false; then : + break +fi +done +if ${ac_cv_search_clock_gettime+:} false; then : + +else + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 +$as_echo "$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + test "$ac_cv_search_clock_gettime" = "none required" || + LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime +fi + + + for ac_func in clock_gettime clock_settime +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS=$gl_saved_libs + + + + @@ -8153,7 +8236,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by tmpwatch $as_me 2.10.3, which was +This file was extended by tmpwatch $as_me 2.11, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8220,7 +8303,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -tmpwatch config.status 2.10.3 +tmpwatch config.status 2.11 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/configure.ac new/tmpwatch-2.11/configure.ac --- old/tmpwatch-2.10.3/configure.ac 2011-07-19 22:43:22.000000000 +0200 +++ new/tmpwatch-2.11/configure.ac 2012-05-26 01:24:37.000000000 +0200 @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT([tmpwatch], [2.10.3], [https://fedorahosted.org/tmpwatch/], , +AC_INIT([tmpwatch], [2.11], [https://fedorahosted.org/tmpwatch/], , [https://fedorahosted.org/tmpwatch/]) AC_PREREQ([2.63b]) AC_CONFIG_SRCDIR([tmpwatch.c]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/lib/Makefile.am new/tmpwatch-2.11/lib/Makefile.am --- old/tmpwatch-2.10.3/lib/Makefile.am 2011-03-31 01:44:06.000000000 +0200 +++ new/tmpwatch-2.11/lib/Makefile.am 2012-05-25 22:55:34.000000000 +0200 @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=admin --no-libtool --macro-prefix=gl getopt progname stpcpy strtoimax xalloc +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=admin --no-libtool --macro-prefix=gl clock-time getopt progname stpcpy strtoimax xalloc AUTOMAKE_OPTIONS = 1.5 gnits diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/lib/Makefile.in new/tmpwatch-2.11/lib/Makefile.in --- old/tmpwatch-2.10.3/lib/Makefile.in 2011-07-19 22:44:46.000000000 +0200 +++ new/tmpwatch-2.11/lib/Makefile.in 2012-05-26 01:26:42.000000000 +0200 @@ -24,7 +24,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=admin --no-libtool --macro-prefix=gl getopt progname stpcpy strtoimax xalloc +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=admin --no-libtool --macro-prefix=gl clock-time getopt progname stpcpy strtoimax xalloc @@ -49,9 +49,10 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/error.m4 \ - $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gnulib-comp.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/clock_time.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \ + $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/getopt.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/stdint.m4 \ @@ -222,6 +223,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/m4/clock_time.m4 new/tmpwatch-2.11/m4/clock_time.m4 --- old/tmpwatch-2.10.3/m4/clock_time.m4 1970-01-01 01:00:00.000000000 +0100 +++ new/tmpwatch-2.11/m4/clock_time.m4 2012-05-25 22:55:34.000000000 +0200 @@ -0,0 +1,30 @@ +# clock_time.m4 serial 8 +dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME. +# For a program named, say foo, you should add a line like the following +# in the corresponding Makefile.am file: +# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) + +AC_DEFUN([gl_CLOCK_TIME], +[ + dnl Persuade glibc and Solaris <time.h> to declare these functions. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. + # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. + + # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all* + # programs in the package would end up linked with that potentially-shared + # library, inducing unnecessary run-time overhead. + gl_saved_libs=$LIBS + AC_SEARCH_LIBS(clock_gettime, [rt posix4], + [test "$ac_cv_search_clock_gettime" = "none required" || + LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime]) + AC_SUBST([LIB_CLOCK_GETTIME]) + AC_CHECK_FUNCS(clock_gettime clock_settime) + LIBS=$gl_saved_libs +]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/m4/gnulib-comp.m4 new/tmpwatch-2.11/m4/gnulib-comp.m4 --- old/tmpwatch-2.10.3/m4/gnulib-comp.m4 2011-03-31 01:44:06.000000000 +0200 +++ new/tmpwatch-2.11/m4/gnulib-comp.m4 2012-05-25 22:55:35.000000000 +0200 @@ -40,6 +40,7 @@ gl_libdeps= gl_ltlibdeps= gl_source_base='lib' + gl_CLOCK_TIME gl_ERROR gl_EXITFAIL gl_GETOPT @@ -143,6 +144,7 @@ lib/xalloc.h lib/xmalloc.c m4/absolute-header.m4 + m4/clock_time.m4 m4/error.m4 m4/exitfail.m4 m4/extensions.m4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/tmpwatch.8 new/tmpwatch-2.11/tmpwatch.8 --- old/tmpwatch-2.10.3/tmpwatch.8 2011-03-21 20:37:13.000000000 +0100 +++ new/tmpwatch-2.11/tmpwatch.8 2012-05-26 01:01:32.000000000 +0200 @@ -44,7 +44,8 @@ symbolic link is given as its argument), does not switch filesystems (including non-trivial bind mounts), skips \fIlost+found\fR directories owned by the root user, -and only removes empty directories, regular files, and symbolic links. +and only removes empty directories, regular files, symbolic links, and on some +systems also unused sockets. By default, \fBtmpwatch\fR dates files by their atime (access time), not their mtime (modification time). If files aren't being removed when @@ -105,6 +106,10 @@ .TP \fB-a, -\-all\fR Remove all file types, not just regular files, symbolic links and directories. +On systems where +.B tmpwatch +can remove unused sockets, make the decision only based on file times, +ignoring possible use of the socket. .TP \fB-d, -\-nodirs\fR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tmpwatch-2.10.3/tmpwatch.c new/tmpwatch-2.11/tmpwatch.c --- old/tmpwatch-2.10.3/tmpwatch.c 2011-07-19 22:19:37.000000000 +0200 +++ new/tmpwatch-2.11/tmpwatch.c 2012-05-26 01:11:57.000000000 +0200 @@ -70,7 +70,9 @@ #define LOG_FATAL 6 #define FLAG_FORCE (1 << 0) -#define FLAG_ALLFILES (1 << 1) /* normally just files, dirs are removed */ +/* normally just files, dirs, and sockets older than (boot time - grace period) + are removed */ +#define FLAG_ALLFILES (1 << 1) #define FLAG_TEST (1 << 2) #define FLAG_ATIME (1 << 3) #define FLAG_MTIME (1 << 4) @@ -110,6 +112,11 @@ static struct excluded_uid *excluded_uids /* = NULL */; static struct excluded_uid **excluded_uids_tail = &excluded_uids; +static time_t kill_time; +static time_t socket_kill_time; /* 0 = never */ + +static int config_flags; /* = 0; */ + static int logLevel = LOG_NORMAL; static void attribute__((format(printf, 2, 3))) @@ -181,7 +188,7 @@ return 1; } - if (chdir(reldirname)) { + if (chdir(reldirname) != 0) { if (errno == ENOENT) return 2; message(LOG_ERROR, "chdir to directory %s failed: %s\n", @@ -189,7 +196,7 @@ return 1; } - if (lstat(".", &sb2)) { + if (lstat(".", &sb2) != 0) { message(LOG_ERROR, "second lstat() of directory %s failed: %s\n", fulldirname, strerror(errno)); return 1; @@ -244,7 +251,7 @@ waitpid(pid, &ret, 0); } - return (WIFEXITED(ret) && (WEXITSTATUS(ret) == 0)); + return (WIFEXITED(ret) && WEXITSTATUS(ret) == 0); } #else #define check_fuser(FILENAME) 0 @@ -286,8 +293,8 @@ #endif static int -cleanupDirectory(const char * fulldirname, const char *reldirname, - time_t killTime, int flags, dev_t st_dev, ino_t st_ino) +cleanupDirectory(const char * fulldirname, const char *reldirname, dev_t st_dev, + ino_t st_ino) { DIR *dir; struct dirent *ent; @@ -310,7 +317,7 @@ return 1; } - if (lstat(".", &here)) { + if (lstat(".", &here) != 0) { message(LOG_ERROR, "error stat()ing current directory %s: %s\n", fulldirname, strerror(errno)); return 0; @@ -338,20 +345,21 @@ return 0; } - do { + for (;;) { struct exclusion *e; errno = 0; ent = readdir(dir); - if (errno) { + if (errno != 0) { message(LOG_ERROR, "error reading directory entry: %s\n", strerror(errno)); (void)closedir(dir); return 0; } - if (!ent) break; + if (ent == NULL) + break; - if (lstat(ent->d_name, &sb)) { + if (lstat(ent->d_name, &sb) != 0) { /* FUSE mounts by different users return EACCES by default. */ if (errno != ENOENT && errno != EACCES) message(LOG_ERROR, "failed to lstat %s/%s: %s\n", @@ -360,16 +368,15 @@ } /* don't go crazy with the current directory or its parent */ - if ((strcmp(ent->d_name, ".") == 0) || - (strcmp(ent->d_name, "..") == 0)) + if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; /* * skip over directories named lost+found that are owned by * LOSTFOUND_UID (root) */ - if ((strcmp(ent->d_name, "lost+found") == 0) && - S_ISDIR(sb.st_mode) && (sb.st_uid == LOSTFOUND_UID)) + if (strcmp(ent->d_name, "lost+found") == 0 && S_ISDIR(sb.st_mode) + && sb.st_uid == LOSTFOUND_UID) continue; message(LOG_REALDEBUG, "found directory entry %s\n", ent->d_name); @@ -410,14 +417,14 @@ significant_time = 0; /* Set significant_time to point at the significant field of sb - * either st_atime or st_mtime depending on the flag selected. - alh */ - if ((flags & FLAG_DIRMTIME) && S_ISDIR(sb.st_mode)) + if ((config_flags & FLAG_DIRMTIME) != 0 && S_ISDIR(sb.st_mode)) significant_time = max(significant_time, &sb.st_mtime); /* The else here (and not elsewhere) is intentional */ - else if (flags & FLAG_ATIME) + else if ((config_flags & FLAG_ATIME) != 0) significant_time = max(significant_time, &sb.st_atime); - if (flags & FLAG_MTIME) + if ((config_flags & FLAG_MTIME) != 0) significant_time = max(significant_time, &sb.st_mtime); - if (flags & FLAG_CTIME) { + if ((config_flags & FLAG_CTIME) != 0) { /* Even when we were told to use ctime, for directories we use mtime, because when a file in a directory is deleted, its ctime will change, and there's no way we can change it @@ -438,19 +445,20 @@ message(LOG_REALDEBUG, "taking as significant time: %s", ctime(significant_time)); - if (!sb.st_uid && !(flags & FLAG_FORCE) && !(sb.st_mode & S_IWUSR)) { + if (sb.st_uid == 0 && (config_flags & FLAG_FORCE) == 0 + && (sb.st_mode & S_IWUSR) == 0) { message(LOG_DEBUG, "non-writeable file owned by root " "skipped: %s\n", ent->d_name);; continue; - } else - /* One more check for a different device. Try hard not to go - onto a different device. - */ - if (sb.st_dev != st_dev || here.st_dev != st_dev) { + } + /* One more check for a different device. Try hard not to go onto a + different device. */ + if (sb.st_dev != st_dev || here.st_dev != st_dev) { message(LOG_VERBOSE, "file on different device skipped: %s\n", ent->d_name); continue; - } else if (S_ISDIR(sb.st_mode)) { + } + if (S_ISDIR(sb.st_mode)) { int dd; if ((dd = open(".", O_RDONLY)) != -1) { @@ -464,11 +472,10 @@ strcat(full_subdir, "/"); strcat(full_subdir, ent->d_name); if (!is_bind_mount(full_subdir) - && cleanupDirectory(full_subdir, ent->d_name, killTime, - flags, st_dev, sb.st_ino) == 0) { + && cleanupDirectory(full_subdir, ent->d_name, st_dev, + sb.st_ino) == 0) message(LOG_ERROR, "cleanup failed in %s: %s\n", full_subdir, strerror(errno)); - } free(full_subdir); } if (fchdir(dd) != 0) { @@ -483,10 +490,10 @@ fulldirname, ent->d_name, strerror(errno)); } - if (*significant_time >= killTime) + if (*significant_time >= kill_time) continue; - if ((flags & FLAG_FUSER) && check_fuser(ent->d_name)) { + if ((config_flags & FLAG_FUSER) != 0 && check_fuser(ent->d_name)) { message(LOG_VERBOSE, "file is already in use or open: %s\n", ent->d_name); continue; @@ -495,11 +502,11 @@ /* we should try to remove the directory after cleaning up its contents, as it should contain no files. Skip if we have specified the "no directories" flag. */ - if (!(flags & FLAG_NODIRS)) { + if ((config_flags & FLAG_NODIRS) == 0) { message(LOG_VERBOSE, "removing directory %s/%s if empty\n", fulldirname, ent->d_name); - if (!(flags & FLAG_TEST)) { + if ((config_flags & FLAG_TEST) == 0) { if (rmdir(ent->d_name)) { /* EBUSY is returned for a mount point. */ if (errno != ENOENT && errno != ENOTEMPTY @@ -511,8 +518,14 @@ } } } else { - if (*significant_time >= killTime) - continue; + if (S_ISSOCK(sb.st_mode)) { + if (socket_kill_time == 0 + || *significant_time >= socket_kill_time) + continue; + } else { /* Not a socket */ + if (*significant_time >= kill_time) + continue; + } #ifdef __linux /* check if it is an ext3 journal file */ @@ -543,12 +556,14 @@ } #endif - if ((flags & FLAG_ALLFILES) - || S_ISREG(sb.st_mode) - || (!(flags & FLAG_NOSYMLINKS) && S_ISLNK(sb.st_mode))) { + if ((config_flags & FLAG_ALLFILES) != 0 + || S_ISREG(sb.st_mode) || S_ISSOCK(sb.st_mode) + || ((config_flags & FLAG_NOSYMLINKS) == 0 + && S_ISLNK(sb.st_mode))) { const struct excluded_uid *u; - if ((flags & FLAG_FUSER) && check_fuser(ent->d_name)) { + if ((config_flags & FLAG_FUSER) != 0 + && check_fuser(ent->d_name)) { message(LOG_VERBOSE, "file is already in use or open: %s/%s\n", fulldirname, ent->d_name); continue; @@ -567,14 +582,14 @@ message(LOG_VERBOSE, "removing file %s/%s\n", fulldirname, ent->d_name); - if (!(flags & FLAG_TEST)) { - if (unlink(ent->d_name) && errno != ENOENT) + if ((config_flags & FLAG_TEST) == 0) { + if (unlink(ent->d_name) != 0 && errno != ENOENT) message(LOG_ERROR, "failed to unlink %s: %s\n", fulldirname, ent->d_name); } } } - } while (ent); + } if (closedir(dir) == -1) { message(LOG_ERROR, "closedir of %s failed: %s\n", @@ -622,6 +637,53 @@ exit(1); } +/* Set up kill_time and socket_kill_time for GRACE_MINUTES. + + Connecting to an AF_UNIX socket does not update any of its times, so we + can't blindly remove a socket with old times - but any process listening on + that socket can not survive a reboot, so sockets that predate the time of + our boot are fair game. We still add the grace period, both as a layer of + extra protection, and to let users examine contents of the temporary + directory for at least for some time. + */ +static void +compute_kill_times(int grace_minutes) +{ + int grace_seconds; + + grace_seconds = grace_minutes * 60; + message(LOG_DEBUG, "grace period is %d seconds\n", grace_seconds); + + kill_time = time(NULL) - grace_seconds; + if ((config_flags & FLAG_ALLFILES) != 0) + socket_kill_time = kill_time; + else { +/* We want __linux because the behavior of CLOCK_BOOTTIME is not standardized. + On Linux, it is the time since system boot, including the time spent in + sleep mode or hibernation. */ +#if defined (HAVE_CLOCK_GETTIME) && defined (CLOCK_BOOTTIME) && defined (__linux) + struct timespec real_clock, boot_clock; + time_t boot_time; + + if (clock_gettime(CLOCK_REALTIME, &real_clock) != 0 + || clock_gettime(CLOCK_BOOTTIME, &boot_clock) != 0) + message(LOG_FATAL, "Error determining boot time: %s\n", + strerror(errno)); + boot_time = real_clock.tv_sec - boot_clock.tv_sec; + if (real_clock.tv_nsec < boot_clock.tv_nsec) + boot_time--; + /* We don't get the values of the two clocks at exactly the same moment, + let's add a few seconds to be extra sure. */ + boot_time -= 2; + + socket_kill_time = boot_time - grace_seconds; +#else + socket_kill_time = 0; /* Never remove sockets */ +#endif + } +} + + int main(int argc, char ** argv) { static const struct option options[] = { @@ -648,8 +710,7 @@ int grace; char units, garbage; - time_t killTime; - int flags = 0, orig_dir; + int orig_dir; struct stat sb; set_program_name(argv[0]); @@ -667,25 +728,25 @@ switch (arg) { case 'M': - flags |= FLAG_DIRMTIME; + config_flags |= FLAG_DIRMTIME; break; case 'a': - flags |= FLAG_ALLFILES; + config_flags |= FLAG_ALLFILES; break; case 'd': - flags |= FLAG_NODIRS; + config_flags |= FLAG_NODIRS; break; case 'f': - flags |= FLAG_FORCE; + config_flags |= FLAG_FORCE; break; case 'l': - flags |= FLAG_NOSYMLINKS; + config_flags |= FLAG_NOSYMLINKS; break; case 's': - flags |= FLAG_FUSER; + config_flags |= FLAG_FUSER; break; case 't': - flags |= FLAG_TEST; + config_flags |= FLAG_TEST; /* fallthrough */ case 'v': logLevel > 0 ? logLevel -= 1 : 0; @@ -694,13 +755,13 @@ logLevel = LOG_FATAL; break; case 'u': - flags |= FLAG_ATIME; + config_flags |= FLAG_ATIME; break; case 'm': - flags |= FLAG_MTIME; + config_flags |= FLAG_MTIME; break; case 'c': - flags |= FLAG_CTIME; + config_flags |= FLAG_CTIME; break; case 'U': { struct excluded_uid *u; @@ -767,8 +828,8 @@ } /* Default to atime if neither was specified. - alh */ - if (!(flags & (FLAG_ATIME | FLAG_MTIME | FLAG_CTIME))) - flags |= FLAG_ATIME; + if ((config_flags & (FLAG_ATIME | FLAG_MTIME | FLAG_CTIME)) == 0) + config_flags |= FLAG_ATIME; if (optind == argc) { message(LOG_FATAL, "time (in hours) must be given\n"); @@ -799,17 +860,13 @@ if (grace < 0) message(LOG_FATAL, "bad time argument %s\n", argv[optind]); + compute_kill_times(grace); + optind++; if (optind == argc) { message(LOG_FATAL, "directory name(s) expected\n"); } - grace = grace * 60; /* minutes to seconds */ - - message(LOG_DEBUG, "grace period is %d seconds\n", grace); - - killTime = time(NULL) - grace; - /* set stdout line buffered so it is flushed before each fork */ setvbuf(stdout, NULL, _IOLBF, 0); @@ -820,7 +877,7 @@ char *path; path = absolute_path(argv[optind], 0); - if (lstat(path, &sb)) { + if (lstat(path, &sb) != 0) { message(LOG_ERROR, "lstat() of directory %s failed: %s\n", path, strerror(errno)); exit(1); @@ -830,11 +887,9 @@ message(LOG_DEBUG, "initial directory %s is a symlink -- " "skipping\n", path); } else { - if (cleanupDirectory(path, path, killTime, flags, sb.st_dev, - sb.st_ino) == 0) { + if (cleanupDirectory(path, path, sb.st_dev, sb.st_ino) == 0) message(LOG_ERROR, "cleanup failed in %s: %s\n", path, strerror(errno)); - } if (fchdir(orig_dir) != 0) { message(LOG_FATAL, "can not return to original working " "directory: %s\n", strerror(errno)); -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
