amanda is not localized, it doesn't understand the french date.

The attached patch fit it by using a not localized time
This patch works only run done with the patch.

Jean-Louis

Thomas Ginestet wrote:
Hi list,

When using amstatus this morning (february the first) and I've got the folllowing error:

Using /var/log/amanda/week/amdump.1 from mercredi 31 janvier 2007, 23:45:01 (UTC+0100)
Day '31' out of range 1..28 at /usr/local/sbin/amstatus line 1350

The dump was started january 31st but is it possible that amstatus looks for a february 31st instead ?


Cheers,


Thomas Ginestet




diff -u -r --show-c-function --new-file --exclude-from=/home/martinea/src.orig/amanda.diff --ignore-matching-lines='$Id:' amanda-2.5.1p2.new/server-src/amdump.sh.in amanda-2.5.1p2.new.date/server-src/amdump.sh.in
--- amanda-2.5.1p2.new/server-src/amdump.sh.in	2007-01-26 09:43:38.000000000 -0500
+++ amanda-2.5.1p2.new.date/server-src/amdump.sh.in	2007-02-01 07:57:15.000000000 -0500
@@ -112,6 +112,7 @@ exit_code=$?
 [ $exit_code -ne 0 ] && exit_status=$exit_code
 echo "amdump: start at `date`"
 echo "amdump: datestamp `date +%Y%m%d`"
+echo "amdump: starttime `date +%Y%m%d%H%M%S`"
 $libexecdir/planner$SUF $conf "$@" | $libexecdir/driver$SUF $conf "$@"
 exit_code=$?
 [ $exit_code -ne 0 ] && exit_status=$exit_code
diff -u -r --show-c-function --new-file --exclude-from=/home/martinea/src.orig/amanda.diff --ignore-matching-lines='$Id:' amanda-2.5.1p2.new/server-src/amflush.c amanda-2.5.1p2.new.date/server-src/amflush.c
--- amanda-2.5.1p2.new/server-src/amflush.c	2006-11-29 07:36:16.000000000 -0500
+++ amanda-2.5.1p2.new.date/server-src/amflush.c	2007-02-01 07:57:08.000000000 -0500
@@ -299,6 +299,7 @@ main(
 	error("BAD DATE"); /* should never happen */
     fprintf(stderr, "amflush: start at %s\n", date_string);
     fprintf(stderr, "amflush: datestamp %s\n", amflush_timestamp);
+    fprintf(stderr, "amflush: starttime %s\n", construct_timestamp(NULL));
     log_add(L_START, "date %s", amflush_timestamp);
 
     /* START DRIVER */
diff -u -r --show-c-function --new-file --exclude-from=/home/martinea/src.orig/amanda.diff --ignore-matching-lines='$Id:' amanda-2.5.1p2.new/server-src/amstatus.pl.in amanda-2.5.1p2.new.date/server-src/amstatus.pl.in
--- amanda-2.5.1p2.new/server-src/amstatus.pl.in	2007-01-26 08:02:33.000000000 -0500
+++ amanda-2.5.1p2.new.date/server-src/amstatus.pl.in	2007-02-01 07:58:14.000000000 -0500
@@ -181,14 +181,17 @@ while(<AMDUMP>) {
 	chomp;
 	if(/(amdump|amflush): start at (.*)/) {
 		print " from $2\n";
-		$starttime=&unctime(split(/[ 	]+/,$2));
 	}
-	elsif(/amdump: datestamp (\S+)/) {
-		$gdatestamp = $1;
+	elsif(/(amdump|amflush): datestamp (\S+)/) {
+		$gdatestamp = $2;
 		if(!defined $datestamp{$gdatestamp}) {
 			$datestamp{$gdatestamp} = 1;
 			push @datestamp, $gdatestamp;
 		}
+		$starttime=&set_starttime($2);
+	}
+	elsif(/(amdump|amflush): starttime (\S+)/) {
+		$starttime=&set_starttime($2);
 	}
 	elsif(/planner: timestamp (\S+)/) {
 		$gdatestamp = $1;
@@ -1410,6 +1413,30 @@ sub unctime() {
 	return $time;
 }
 
+sub set_starttime() {
+	my (@tl);
+	my ($time);
+	my ($date);
+
+	# Preset an array of values in case some parts are not passed as
+	# arguments.  This lets the date, etc, be omitted and default to
+	# today.
+
+	($date)[EMAIL PROTECTED];
+	@tl = localtime;
+
+	$tl[5] = substr($date,  0, 4)   if(length($date) >= 4);
+	$tl[4] = substr($date,  4, 2)-1 if(length($date) >= 6);
+	$tl[3] = substr($date,  6, 2)   if(length($date) >= 8);
+	$tl[2] = substr($date,  8, 2)   if(length($date) >= 10);
+	$tl[1] = substr($date, 10, 2)   if(length($date) >= 12);
+	$tl[0] = substr($date, 12, 2)   if(length($date) >= 14);
+
+	$time = &timelocal (@tl);
+
+	return $time;
+}
+
 sub showtime() {
 	my($delta)=shift;
 	my($oneday)=24*60*60;

Reply via email to