rpms/anacron/devel anacron-script.patch, NONE, 1.1 anacron-2.3-memleaking.patch, 1.1, 1.2 anacron.init, 1.8, 1.9 anacron.spec, 1.34, 1.35 anacrontab, 1.4, 1.5 anacron-2.3-hostname.patch, 1.1, NONE anacron-2.3-lock-files.patch, 1.1, NONE anacron-2.3-mailto.patch, 1.1, NONE anacron-2.3-mk-incl.patch, 1.1, NONE anacron-2.3-noconst.patch, 1.1, NONE anacron-2.3-path.patch, 1.1, NONE

Marcela Mašláňová (mmaslano) fedora-extras-commits at redhat.com
Thu Aug 9 13:25:25 UTC 2007


Author: mmaslano

Update of /cvs/pkgs/rpms/anacron/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20264

Modified Files:
	anacron-2.3-memleaking.patch anacron.init anacron.spec 
	anacrontab 
Added Files:
	anacron-script.patch 
Removed Files:
	anacron-2.3-hostname.patch anacron-2.3-lock-files.patch 
	anacron-2.3-mailto.patch anacron-2.3-mk-incl.patch 
	anacron-2.3-noconst.patch anacron-2.3-path.patch 
Log Message:
Add patches.


anacron-script.patch:

--- NEW FILE anacron-script.patch ---
--- anacron-2.3/debian/0anacron.daily.script	2007-08-09 14:08:36.000000000 +0200
+++ anacron-2.3/debian/0anacron.daily	2007-08-09 14:27:22.000000000 +0200
@@ -9,4 +9,8 @@
 # _before_ all other scripts.
 
 test -x /usr/sbin/anacron || exit 0
-anacron -u cron.daily
+AUX1=`cat /var/spool/anacron/cron.daily`
+AUX2=`date +%Y%m%d`
+if [ $AUX1 != $AUX2 ]; then
+    anacron -u cron.daily
+fi

anacron-2.3-memleaking.patch:

Index: anacron-2.3-memleaking.patch
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacron-2.3-memleaking.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- anacron-2.3-memleaking.patch	4 Dec 2006 10:33:33 -0000	1.1
+++ anacron-2.3-memleaking.patch	9 Aug 2007 13:25:22 -0000	1.2
@@ -1,58 +1,7 @@
-diff -ur anacron-2.3.orig/global.h anacron-2.3/global.h
---- anacron-2.3.orig/global.h	2006-10-08 09:58:47.000000000 -0400
-+++ anacron-2.3/global.h	2006-10-08 10:08:18.000000000 -0400
-@@ -108,18 +108,25 @@
- /* main.c */
- int xopen(int fd, const char *file_name, int flags);
- void xclose(int fd);
--pid_t xfork();
-+pid_t xfork(void);
-+
-+#ifdef __GNUC__
-+#define PRINTF_FORMAT(n, m) \
-+   __attribute__ ((format (printf, n, m)))
-+#else
-+#define PRINTF_FORMAT(n, m)
-+#endif
- 
- /* log.c */
--void explain(const char *fmt, ...);
--void explain_e(const char *fmt, ...);
--void complain(const char *fmt, ...);
--void complain_e(const char *fmt, ...);
--void die(const char *fmt, ...);
--void die_e(const char *fmt, ...);
--void xdebug(const char *fmt, ...);
--void xdebug_e(const char *fmt, ...);
--void xcloselog();
-+void explain(const char *fmt, ...)PRINTF_FORMAT(1,2);
-+void explain_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
-+void complain(const char *fmt, ...)PRINTF_FORMAT(1,2);
-+void complain_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
-+void die(const char *fmt, ...)PRINTF_FORMAT(1,2);
-+void die_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
-+void xdebug(const char *fmt, ...)PRINTF_FORMAT(1,2);
-+void xdebug_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
-+void xcloselog(void);
- 
- #ifdef DEBUG
- #define Debug(args) xdebug args
-@@ -130,8 +137,8 @@
- #endif /* not DEBUG */
- 
- /* readtab.c */
--void read_tab();
--void arrange_jobs();
-+void read_tab(void);
-+void arrange_jobs(void);
- 
- /* lock.c */
- int consider_job(job_rec *jr);
-diff -ur anacron-2.3.orig/gregor.c anacron-2.3/gregor.c
---- anacron-2.3.orig/gregor.c	2006-10-08 09:58:47.000000000 -0400
-+++ anacron-2.3/gregor.c	2006-10-08 10:24:05.000000000 -0400
-@@ -25,7 +25,7 @@
- #include <limits.h>
+--- anacron-2.3/gregor.c.mem	2007-08-08 10:02:58.000000000 +0200
++++ anacron-2.3/gregor.c	2007-08-08 10:10:55.000000000 +0200
+@@ -27,7 +27,7 @@
+ #include <time.h>
  #include "gregor.h"
  
 -const static int
@@ -60,30 +9,9 @@
  days_in_month[] = {
      31,  /* Jan */
      28,  /* Feb (non-leap) */
-diff -ur anacron-2.3.orig/lock.c anacron-2.3/lock.c
---- anacron-2.3.orig/lock.c	2006-10-08 09:58:47.000000000 -0400
-+++ anacron-2.3/lock.c	2006-10-08 16:14:14.000000000 -0400
-@@ -42,7 +42,7 @@
-     jr->timestamp_fd = open(jr->ident, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
-     if (jr->timestamp_fd == -1)
- 	die_e("Can't open timestamp file for job %s", jr->ident);
--    fcntl(jr->timestamp_fd, F_SETFD, 1);    /* set close-on-exec flag */
-+    fcntl(jr->timestamp_fd, F_SETFD, FD_CLOEXEC);  /* set close-on-exec flag */
-     /* We want to own this file, and set its mode to 0600. This is necessary
-      * in order to prevent other users from putting locks on it. */
-     if (fchown(jr->timestamp_fd, getuid(), getgid()))
-diff -ur anacron-2.3.orig/log.c anacron-2.3/log.c
---- anacron-2.3.orig/log.c	2006-10-08 09:58:47.000000000 -0400
-+++ anacron-2.3/log.c	2006-10-08 10:27:29.000000000 -0400
-@@ -35,6 +35,7 @@
-  */
- 
- #include <unistd.h>
-+#include <stdlib.h>
- #include <syslog.h>
- #include <stdio.h>
- #include <stdarg.h>
-@@ -79,7 +80,7 @@
+--- anacron-2.3/log.c.mem	2007-08-08 10:02:58.000000000 +0200
++++ anacron-2.3/log.c	2007-08-08 10:13:03.000000000 +0200
+@@ -83,7 +83,7 @@
  }
  
  static void
@@ -92,7 +20,7 @@
  /* Log a message, described by "fmt" and "args", with the specified
   * "priority". */
  {
-@@ -97,7 +98,7 @@
+@@ -101,7 +101,7 @@
  
  static void
  log_e(int priority, const char *fmt, va_list args)
@@ -101,7 +29,7 @@
   * to "errno". */
  {
      int saved_errno;
-@@ -123,7 +124,7 @@
+@@ -127,7 +127,7 @@
      va_list args;
  
      va_start(args, fmt);
@@ -110,16 +38,16 @@
      va_end(args);
  }
  
-@@ -145,7 +146,7 @@
+@@ -149,7 +149,7 @@
      va_list args;
  
      va_start(args, fmt);
 -    log(COMPLAIN_LEVEL, fmt, args);
 +    slog(COMPLAIN_LEVEL, fmt, args);
      va_end(args);
- }
  
-@@ -167,7 +168,7 @@
+     complaints += 1;
+@@ -175,7 +175,7 @@
      va_list args;
  
      va_start(args, fmt);
@@ -128,7 +56,7 @@
      va_end(args);
      if (getpid() == primary_pid) complain("Aborted");
  
-@@ -199,7 +200,7 @@
+@@ -207,7 +207,7 @@
      va_list args;
  
      va_start(args, fmt);
@@ -137,9 +65,77 @@
      va_end(args);
  }
  
-diff -ur anacron-2.3.orig/matchrx.c anacron-2.3/matchrx.c
---- anacron-2.3.orig/matchrx.c	2006-10-08 09:58:47.000000000 -0400
-+++ anacron-2.3/matchrx.c	2006-10-08 10:29:24.000000000 -0400
+--- anacron-2.3/global.h.mem	2007-08-08 10:02:58.000000000 +0200
++++ anacron-2.3/global.h	2007-08-08 10:10:21.000000000 +0200
+@@ -105,18 +105,25 @@
+ /* main.c */
+ int xopen(int fd, const char *file_name, int flags);
+ void xclose(int fd);
+-pid_t xfork();
++pid_t xfork(void);
++
++#ifdef __GNUC__
++#define PRINTF_FORMAT(n, m) \
++   __attribute__ ((format (printf, n, m)))
++#else
++#define PRINTF_FORMAT(n, m)
++#endif
+ 
+ /* log.c */
+-void explain(const char *fmt, ...);
+-void explain_e(const char *fmt, ...);
+-void complain(const char *fmt, ...);
+-void complain_e(const char *fmt, ...);
+-void die(const char *fmt, ...);
+-void die_e(const char *fmt, ...);
+-void xdebug(const char *fmt, ...);
+-void xdebug_e(const char *fmt, ...);
+-void xcloselog();
++void explain(const char *fmt, ...)PRINTF_FORMAT(1,2);
++void explain_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
++void complain(const char *fmt, ...)PRINTF_FORMAT(1,2);
++void complain_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
++void die(const char *fmt, ...)PRINTF_FORMAT(1,2);
++void die_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
++void xdebug(const char *fmt, ...)PRINTF_FORMAT(1,2);
++void xdebug_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
++void xcloselog(void);
+ 
+ #ifdef DEBUG
+ #define Debug(args) xdebug args
+@@ -128,7 +135,7 @@
+ 
+ /* readtab.c */
+ void read_tab(int cwd);
+-void arrange_jobs();
++void arrange_jobs(void);
+ 
+ /* lock.c */
+ int consider_job(job_rec *jr);
+--- anacron-2.3/runjob.c.mem	2007-08-08 10:02:58.000000000 +0200
++++ anacron-2.3/runjob.c	2007-08-08 10:17:44.000000000 +0200
+@@ -64,8 +64,8 @@
+     if (fdin == -1) die_e("Can't open temporary file for reading");
+     if (unlink(name)) die_e("Can't unlink temporary file");
+     free(name);
+-    fcntl(fdout, F_SETFD, 1);    /* set close-on-exec flag */
+-    fcntl(fdin, F_SETFD, 1);    /* set close-on-exec flag */
++    fcntl(fdout, F_SETFD, FD_CLOEXEC);    /* set close-on-exec flag */
++    fcntl(fdin, F_SETFD, FD_CLOEXEC);    /* set close-on-exec flag */
+ 
+     jr->input_fd = fdin;
+     jr->output_fd = fdout;
+@@ -175,8 +175,6 @@
+     pid = xfork();
+     if (pid == 0)
+     {
+-	long fdflags;
+-
+ 	/* child */
+ 	in_background = 1;
+ 	/* set stdin to the job's output */
+--- anacron-2.3/matchrx.c.mem	2000-06-21 01:12:18.000000000 +0200
++++ anacron-2.3/matchrx.c	2007-08-08 10:16:54.000000000 +0200
 @@ -26,6 +26,7 @@
  #include <regex.h>
  #include <stdarg.h>
@@ -148,66 +144,39 @@
  #include "matchrx.h"
  
  int
-@@ -49,11 +50,23 @@
+@@ -49,11 +50,20 @@
  	sub_offsets = malloc(sizeof(regmatch_t) * (n_sub + 1));
  	memset(sub_offsets, 0, sizeof(regmatch_t) * (n_sub + 1));
  
 -	if (regcomp(&crx, rx, REG_EXTENDED)) return - 1;
-+	if (regcomp(&crx, rx, REG_EXTENDED))
-+	{
-+		free(sub_offsets);
-+		return - 1;
++	if (regcomp(&crx, rx, REG_EXTENDED)) {
++	    free(sub_offsets);
++	    return - 1;
 +	}
  	r = regexec(&crx, string, n_sub + 1, sub_offsets, 0);
 -	if (r != 0 && r != REG_NOMATCH) return - 1;
-+	if (r != 0 && r != REG_NOMATCH)
-+	{
-+		free(sub_offsets);
-+		return - 1;
++	if (r != 0 && r != REG_NOMATCH) {
++	   free(sub_offsets);
++	   return - 1;
 +	}
  	regfree(&crx);
 -	if (r == REG_NOMATCH) return 0;
-+	if (r == REG_NOMATCH)
-+	{
-+		free(sub_offsets);
-+		return 0;
++	if (r == REG_NOMATCH) {
++	    free(sub_offsets);
++	    return 0;
 +	}
  
  	va_start(va, n_sub);
  	n = 1;
-@@ -62,7 +75,11 @@
+@@ -62,7 +72,10 @@
  		substring = va_arg(va, char**);
  		if (substring != NULL)
  		{
 -			if (sub_offsets[n].rm_so == -1) return - 1;
-+			if (sub_offsets[n].rm_so == -1)
-+			{
-+				free(sub_offsets);
-+				return - 1;
++			if (sub_offsets[n].rm_so == -1) {
++			    free(sub_offsets);
++			    return - 1;
 +			}
  			*substring = string + sub_offsets[n].rm_so;
  			*(string + sub_offsets[n].rm_eo) = 0;
  		}
-diff -ur anacron-2.3.orig/runjob.c anacron-2.3/runjob.c
---- anacron-2.3.orig/runjob.c	2006-10-08 09:58:47.000000000 -0400
-+++ anacron-2.3/runjob.c	2006-10-08 16:09:37.000000000 -0400
-@@ -64,8 +64,8 @@
-     if (fdin == -1) die_e("Can't open temporary file for reading");
-     if (unlink(name)) die_e("Can't unlink temporary file");
-     free(name);
--    fcntl(fdout, F_SETFD, 1);    /* set close-on-exec flag */
--    fcntl(fdin, F_SETFD, 1);    /* set close-on-exec flag */
-+    fcntl(fdout, F_SETFD, FD_CLOEXEC);    /* set close-on-exec flag */
-+    fcntl(fdin, F_SETFD, FD_CLOEXEC);    /* set close-on-exec flag */
- 
-     jr->input_fd = fdin;
-     jr->output_fd = fdout;
-@@ -178,7 +178,7 @@
-     pid = xfork();
-     if (pid == 0)
-     {
--	long fdflags;
-+	/* long fdflags; */
- 
- 	/* child */
- 	in_background = 1;


Index: anacron.init
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacron.init,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- anacron.init	12 Jul 2007 11:30:22 -0000	1.8
+++ anacron.init	9 Aug 2007 13:25:22 -0000	1.9
@@ -11,20 +11,29 @@
 [ -f /usr/sbin/anacron ] || exit 0
 
 prog="anacron"
-PIDFILE=/var/run/${prog}.pid
+PIDFILE=/var/spool/anacron/cron.daily
 LOCKFILE=/var/lock/subsys/$prog
 #
 #  NOTE: anacron exits after it has determined it has no more work to do.
 #        Hence, its initscript cannot do normal lock file management.
-#        The anacron binary now creates its own /var/run/anacron.pid pid file
-#        and /var/lock/subsys lock files, and removes them automatically at exit,
-#        so at least there will be no more "anacron is dead but subsys locked" 
-#        messages. The pid and lock is existing only, when anacron is running
-#	 (only when cron wake anacron up).
+#        The anacron binary now creates its own timestamps in files 
+#	 /var/spool/anacron/cron.{daily,monthly,weekly}
+#        and /var/lock/subsys lock files. 
 #
 
 start() {
     echo -n $"Starting $prog: " 
+# on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used)
+    if test -x /usr/bin/on_ac_power
+	then
+	/usr/bin/on_ac_power > /dev/null
+        if test $? -eq 1
+	    then
+		echo "deferred while on battery power."
+	        RETVAL=0
+	    exit 0
+        fi
+    fi
     daemon +19 anacron -s
     RETVAL=$?
     if [ $RETVAL -ne 0 ]; then
@@ -59,8 +68,8 @@
 	status)
 	    ## anacron's status is always stopped, because anacron sleep, until 
 	    ## cron wake him
-	    status anacron
-	    RETVAL=1
+	    status $PIDFILE
+	    RETVAL=$?
 	    ;;
 
 	restart)
@@ -68,15 +77,8 @@
 	    start
 	    ;;
 
-	condrestart)
-	    if [ -f $LOCKFILE ]; then
-		stop
-		start
-	    fi
-	    ;;
-	
 	*)
-	    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+	    echo $"Usage: $0 {start|stop|restart|status}"
 	    RETVAL=3
 
 esac


Index: anacron.spec
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacron.spec,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- anacron.spec	12 Jul 2007 11:30:22 -0000	1.34
+++ anacron.spec	9 Aug 2007 13:25:22 -0000	1.35
@@ -1,24 +1,20 @@
 Summary: A cron-like program that can run jobs lost during downtime
 Name: anacron
 Version: 2.3
-Release: 47%{?dist}
+Release: 49%{?dist}
 License: GPL
 Group: System Environment/Base
 URL: http://packages.debian.org/stable/source/anacron
 Source: http://ftp.debian.org/debian/pool/main/a/anacron/%{name}_%{version}.orig.tar.gz
 Source1: anacrontab
 Source2: anacron.init
-Patch0: anacron-2.3-mk-incl.patch
+Patch0: anacron_2.3-13.patch
 Patch1: anacron-2.3-mail-content-type-77108.patch
-Patch2: anacron-2.3-noconst.patch
-Patch3: anacron-2.3-mailto.patch
-Patch4: anacron-2.3-lock-files.patch
-Patch5: anacron-2.3-fdclose.patch
-Patch6: anacron-2.3-hostname.patch
-Patch7: anacron-2.3-pic.patch
-Patch8: anacron-2.3-memleaking.patch
+Patch2: anacron-2.3-fdclose.patch
+Patch3: anacron-2.3-pic.patch
+Patch4: anacron-2.3-memleaking.patch
+Patch5: anacron-script.patch
 
-Requires: /bin/sh
 Requires: crontabs
 Requires: initscripts
 Requires(post): /sbin/chkconfig
@@ -44,15 +40,12 @@
 
 %prep
 %setup -q
-%patch0 -p1 -b .incl
+%patch0 -p1 -b .try
 %patch1 -p1 -b .charset
-%patch2 -p1 -b .noconst
-%patch3 -p1 -b .mailto
-%patch4 -p1 -b .lock-files
-%patch5 -p1 -b .fdclose
-%patch6 -p1 -b .hostname
-%patch7 -p1 -b .pic
-%patch8 -p1 -b .memleaking
+%patch2 -p1 -b .fdclose
+%patch3 -p1 -b .pic
+%patch4 -p1 -b .memleaking
+%patch5 -p1 -b .script
 
 %build
 make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
@@ -70,30 +63,11 @@
 
 for i in cron.daily cron.weekly cron.monthly;do
 mkdir -p $RPM_BUILD_ROOT/etc/$i/
-cat << EOF > $RPM_BUILD_ROOT/etc/$i/0anacron
-#!/bin/sh
-#
-# anacron's cron script
-#
-# This script updates anacron time stamps. It is called through run-parts
-# either by anacron itself or by cron.
-#
-# The script is called "0anacron" to assure that it will be executed
-# _before_ all other scripts.
-
-# Don't run anacron if this script is called by anacron.
-if [ ! -e /var/run/anacron.pid ]; then
-	anacron -u $i
-fi
-
-EOF
-chmod +x $RPM_BUILD_ROOT/etc/$i/0anacron
 done
 
-#
-#for i in `find $RPM_BUILD_ROOT/ -type 'f' -perm '+a=x'`;do
-#	file $i|grep -q "not stripped" && strip $i
-#done
+cp debian/0anacron.daily $RPM_BUILD_ROOT/etc/cron.daily/0anacron
+cp debian/0anacron.monthly $RPM_BUILD_ROOT/etc/cron.monthly/0anacron
+cp debian/0anacron.weekly $RPM_BUILD_ROOT/etc/cron.weekly/0anacron
 
 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
 install -c -m755 %SOURCE2 $RPM_BUILD_ROOT/etc/rc.d/init.d/anacron
@@ -125,12 +99,17 @@
 /%{_mandir}/man5/*
 /%{_mandir}/man8/*
 /usr/sbin/anacron
-##%config(noreplace) /etc/cron.daily/0anacron
 %attr(755,root,root) %dir /etc/cron.daily/0anacron
 %attr(755,root,root) %dir /etc/cron.monthly/0anacron
 %attr(755,root,root) %dir /etc/cron.weekly/0anacron
 
 %changelog
+* Wed Aug 08 2007 Marcela Maslanova <mmaslano at redhat.com> 2.3-49
+- adopt some patches from upstream for better locking
+- add own changes, which resolve problem with two or more run of
+  cron.daily.
+- Resolves: #157448
+
 * Wed Jul 11 2007 Marcela Maslanova <mmaslano at redhat.com> 2.3-48
 - changes in init script (not build)
 


Index: anacrontab
===================================================================
RCS file: /cvs/pkgs/rpms/anacron/devel/anacrontab,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- anacrontab	30 Aug 2006 15:12:59 -0000	1.4
+++ anacrontab	9 Aug 2007 13:25:22 -0000	1.5
@@ -6,6 +6,6 @@
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=root
 
-1	65	cron.daily		run-parts /etc/cron.daily
-7	70	cron.weekly		run-parts /etc/cron.weekly
-30	75	cron.monthly		run-parts /etc/cron.monthly
+1	 65	cron.daily		nice run-parts /etc/cron.daily
+7	 70	cron.weekly		nice run-parts /etc/cron.weekly
+ at monthly 75	cron.monthly		nice run-parts /etc/cron.monthly


--- anacron-2.3-hostname.patch DELETED ---


--- anacron-2.3-lock-files.patch DELETED ---


--- anacron-2.3-mailto.patch DELETED ---


--- anacron-2.3-mk-incl.patch DELETED ---


--- anacron-2.3-noconst.patch DELETED ---


--- anacron-2.3-path.patch DELETED ---




More information about the fedora-extras-commits mailing list