Bug#515653: database corruption detection patch works

2011-11-02 Thread Martin Steigerwald
Am Montag, 31. Oktober 2011 schrieb Thibaut VARENE:
 Hi Radek,

Hi Thibaut,

 Not that I particularly bitch about who did what, but I think it's
 good practice to credit the right people. The patch you merged in [1]
 was developped by me (Thibaut VARENE t-b...@parisc-linux.org), and
 tested by Martin. I shall mention that I still consider it a dirty
 hack (see [2] for references).

And its exactly like that in the changelog:

  * Add database corruption detection/recovery patch (Closes: #515653)
- Authored by Thibaut VARENE, tested by Martin Steigerwald

Ciao,
Martin

 
 HTH
 
 T-Bone
 
 [1] http://hg.podgorny.cz/uptimed/rev/bbe117e5
 [2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515653#79
 
 On Thu, Oct 6, 2011 at 3:36 PM, Radek Podgorny ra...@podgorny.cz 
wrote:
  Hello again,
  
  merged without problems. Now dwells in main repo, waiting for the
  next release.
  
  Thanks a lot again for your contribution!
  
  Radek Podgorny
  
  On 10/05/2011 06:49 PM, Martin Steigerwald wrote:
  Am Mittwoch, 5. Oktober 2011 schrieb Radek Podgorny:
  Hello Martin,
  
  Hi Radek,
  
  will take a look at it and will try to merge during this week.
  Thanks a lot for you effort!
  
  Thanks. I appreciate it.
  
  Ciao,


-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#515653: database corruption detection patch works

2011-11-02 Thread Thibaut VARENE
As usual your comments are completely out of place.
From http://hg.podgorny.cz/uptimed/rev/bbe117e5

Backup database logic from Martin Steigerwald.

The email was addressed to *upstream*, because upstream's attribution
*is* incorrect.

Thank you.

On Wed, Nov 2, 2011 at 9:26 AM, Martin Steigerwald mar...@lichtvoll.de wrote:
 Am Montag, 31. Oktober 2011 schrieb Thibaut VARENE:
 Hi Radek,

 Hi Thibaut,

 Not that I particularly bitch about who did what, but I think it's
 good practice to credit the right people. The patch you merged in [1]
 was developped by me (Thibaut VARENE t-b...@parisc-linux.org), and
 tested by Martin. I shall mention that I still consider it a dirty
 hack (see [2] for references).

 And its exactly like that in the changelog:

  * Add database corruption detection/recovery patch (Closes: #515653)
    - Authored by Thibaut VARENE, tested by Martin Steigerwald

 Ciao,
 Martin


 HTH

 T-Bone

 [1] http://hg.podgorny.cz/uptimed/rev/bbe117e5
 [2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515653#79




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#515653: database corruption detection patch works

2011-11-02 Thread Radek Podgorny

Hello Thibaut!

Please accept my sincere apologies for the wrong attribution. Martin's 
inline attachment tricked me into wrongly thinking it was a whole 
different patch. Fixed in the CREDITS file now.


Sorry again and keep up the good work!

Radek P.


On 10/31/2011 09:42 PM, Thibaut VARENE wrote:

Hi Radek,

Not that I particularly bitch about who did what, but I think it's
good practice to credit the right people. The patch you merged in [1]
was developped by me (Thibaut VARENEt-b...@parisc-linux.org), and
tested by Martin. I shall mention that I still consider it a dirty
hack (see [2] for references).

HTH

T-Bone

[1] http://hg.podgorny.cz/uptimed/rev/bbe117e5
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515653#79

On Thu, Oct 6, 2011 at 3:36 PM, Radek Podgornyra...@podgorny.cz  wrote:

Hello again,

merged without problems. Now dwells in main repo, waiting for the next
release.

Thanks a lot again for your contribution!

Radek Podgorny


On 10/05/2011 06:49 PM, Martin Steigerwald wrote:


Am Mittwoch, 5. Oktober 2011 schrieb Radek Podgorny:


Hello Martin,


Hi Radek,


will take a look at it and will try to merge during this week. Thanks a
lot for you effort!


Thanks. I appreciate it.

Ciao,













--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#515653: database corruption detection patch works

2011-11-02 Thread Thibaut VARENE
No problem, thanks for your quick response!

On Wed, Nov 2, 2011 at 6:07 PM, Radek Podgorny ra...@podgorny.cz wrote:

 Hello Thibaut!

 Please accept my sincere apologies for the wrong attribution. Martin's
 inline attachment tricked me into wrongly thinking it was a whole different
 patch. Fixed in the CREDITS file now.

 Sorry again and keep up the good work!

 Radek P.



 On 10/31/2011 09:42 PM, Thibaut VARENE wrote:

 Hi Radek,

 Not that I particularly bitch about who did what, but I think it's
 good practice to credit the right people. The patch you merged in [1]
 was developped by me (Thibaut VARENEt-b...@parisc-linux.org**), and
 tested by Martin. I shall mention that I still consider it a dirty
 hack (see [2] for references).

 HTH

 T-Bone

 [1] 
 http://hg.podgorny.cz/uptimed/**rev/bbe117e5http://hg.podgorny.cz/uptimed/rev/bbe117e5
 [2] 
 http://bugs.debian.org/cgi-**bin/bugreport.cgi?bug=515653#**79http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515653#79

 On Thu, Oct 6, 2011 at 3:36 PM, Radek Podgornyra...@podgorny.cz  wrote:

 Hello again,

 merged without problems. Now dwells in main repo, waiting for the next
 release.

 Thanks a lot again for your contribution!

 Radek Podgorny


 On 10/05/2011 06:49 PM, Martin Steigerwald wrote:


 Am Mittwoch, 5. Oktober 2011 schrieb Radek Podgorny:


 Hello Martin,


 Hi Radek,

  will take a look at it and will try to merge during this week. Thanks a
 lot for you effort!


 Thanks. I appreciate it.

 Ciao,











-- 
Thibaut VARENE
http://www.parisc-linux.org/~varenet/


Bug#515653: database corruption detection patch works

2011-10-31 Thread Thibaut VARENE
Hi Radek,

Not that I particularly bitch about who did what, but I think it's
good practice to credit the right people. The patch you merged in [1]
was developped by me (Thibaut VARENE t-b...@parisc-linux.org), and
tested by Martin. I shall mention that I still consider it a dirty
hack (see [2] for references).

HTH

T-Bone

[1] http://hg.podgorny.cz/uptimed/rev/bbe117e5
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515653#79

On Thu, Oct 6, 2011 at 3:36 PM, Radek Podgorny ra...@podgorny.cz wrote:
 Hello again,

 merged without problems. Now dwells in main repo, waiting for the next
 release.

 Thanks a lot again for your contribution!

 Radek Podgorny


 On 10/05/2011 06:49 PM, Martin Steigerwald wrote:

 Am Mittwoch, 5. Oktober 2011 schrieb Radek Podgorny:

 Hello Martin,

 Hi Radek,

 will take a look at it and will try to merge during this week. Thanks a
 lot for you effort!

 Thanks. I appreciate it.

 Ciao,







-- 
Thibaut VARENE
http://www.parisc-linux.org/~varenet/



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#515653: database corruption detection patch works

2011-10-06 Thread Radek Podgorny

Hello again,

merged without problems. Now dwells in main repo, waiting for the next 
release.


Thanks a lot again for your contribution!

Radek Podgorny


On 10/05/2011 06:49 PM, Martin Steigerwald wrote:

Am Mittwoch, 5. Oktober 2011 schrieb Radek Podgorny:

Hello Martin,


Hi Radek,


will take a look at it and will try to merge during this week. Thanks a
lot for you effort!


Thanks. I appreciate it.

Ciao,




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#515653: database corruption detection patch works

2011-10-05 Thread Radek Podgorny

Hello Martin,

will take a look at it and will try to merge during this week. Thanks a 
lot for you effort!


Sincerely,
Radek Podgorny


On 07/26/2011 10:50 AM, Martin Steigerwald wrote:

Hi Thibaut and Radek!

 From all my testing on three different ThinkPads I can say: Thibaut, your
database corruption detection patch appears to work just fine!

On my T520 it received the heaviest testing. Due to Sandybridge gfx lockup
problems in 2.6.39 as well as some other issues and testing, I had a lots
of unclean shutdowns. The uptime database is intact.

So, you provided a solution that works. Please apply it to the package
officially.

Attached is your patch with the filesize comparison fix you proposed later
on.

Thanks,




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#515653: database corruption detection patch works

2011-10-05 Thread Martin Steigerwald
Am Mittwoch, 5. Oktober 2011 schrieb Radek Podgorny:
 Hello Martin,

Hi Radek,

 will take a look at it and will try to merge during this week. Thanks a
 lot for you effort!

Thanks. I appreciate it.

Ciao,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#515653: database corruption detection patch works

2011-07-26 Thread Martin Steigerwald
Hi Thibaut and Radek!

From all my testing on three different ThinkPads I can say: Thibaut, your 
database corruption detection patch appears to work just fine!

On my T520 it received the heaviest testing. Due to Sandybridge gfx lockup 
problems in 2.6.39 as well as some other issues and testing, I had a lots 
of unclean shutdowns. The uptime database is intact.

So, you provided a solution that works. Please apply it to the package 
officially.

Attached is your patch with the filesize comparison fix you proposed later 
on.

Thanks,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7
diff -Nru uptimed-0.3.16.orig/libuptimed/urec.c uptimed-0.3.16/libuptimed/urec.c
--- uptimed-0.3.16.orig/libuptimed/urec.c	2009-01-02 00:46:00.0 +0100
+++ uptimed-0.3.16/libuptimed/urec.c	2011-03-06 21:01:28.0 +0100
@@ -215,20 +215,46 @@
 	time_t utime, btime;
 	long l_utime, l_btime;
 	char buf[256], sys[SYSMAX+1];
+	struct stat filestat, filestatold;
+	int useold = 0;
 	
-	f = fopen(FILE_RECORDS, r);
-	if (!f) {
-		f = fopen(FILE_RECORDS.old, r);
-		if (!f) return;
+	if (stat(FILE_RECORDS, filestat))
+		useold = 1;
+	if (stat(FILE_RECORDS.old, filestatold))
+		useold = -1;
+
+	/* assume that backupdb larger than normal db means normal is corrupted */
+	if (!useold  (filestat.st_size  filestatold.st_size))
+		useold = 1;
 
-		printf(uptimed: reading from backup database %s.old\n, FILE_RECORDS);
+dbtry:
+	switch (useold) {
+		case 0:
+			f = fopen(FILE_RECORDS, r);
+			break;
+		case 1:
+			f = fopen(FILE_RECORDS.old, r);
+			printf(uptimed: reading from backup database %s.old\n, FILE_RECORDS);
+			break;
+		default:
+			/* this should probably terminate uptimed somehow */
+			printf(uptimed: no useable database found.\n);
+			return;
+	}
+			
+	if (!f) {
+		printf(uptimed: error opening database for reading.\n);
+		return;
 	}
 	
 	fgets(str, sizeof(str), f);
 	while (!feof(f)) {
 		/* Check for validity of input string. */
 		if (sscanf(str, %ld:%ld:%[^]\n], l_utime, l_btime, buf) != 3) {
-			/* Skip this entry. Do we want feedback here? */
+			/* database is corrupted */
+			fclose(f);
+			useold++;
+			goto dbtry;
 		} else {
 			utime = (time_t)l_utime;
 			btime = (time_t)l_btime;
diff -Nru uptimed-0.3.16.orig/libuptimed/urec.h uptimed-0.3.16/libuptimed/urec.h
--- uptimed-0.3.16.orig/libuptimed/urec.h	2009-01-02 00:46:00.0 +0100
+++ uptimed-0.3.16/libuptimed/urec.h	2011-03-06 20:48:49.0 +0100
@@ -21,6 +21,7 @@
 #include string.h
 #include stdlib.h
 #include sys/types.h
+#include sys/stat.h
 
 #ifdef PLATFORM_LINUX
 #include sys/sysinfo.h


signature.asc
Description: This is a digitally signed message part.