Hello! Since there's been no reply for some weeks (and the last upload was a NMU as well), I'll assume you're very busy at the moment so I've prepared another NMU.
Please notify me within the next 10 days if you'd like me to cancel the upload! You'll find the debdiff attached to this mail. (Please ask me if you'd like to get the changes in separate patches, rather then a big debdiff. I have a git history of the changes to export if you wish.) PS. I noticed that uptimed actually already used the btime from /proc/stat on linux, but (redundantly) copied it to /var/spool/uptimed/bootid. I changed the code to be more similar to the BSD case where createbootid does nothing and readbootid reads directly from the systems bootid. As a bonus BSD should now get a properly working "uptimed -b" (which does nothing and exits, rather then spawning uptimed). I preserved this behaviour on linux to avoid potential problem with old scripts executing "uptimed -b".... -- Andreas Henriksson
diff -u uptimed-0.3.16/debian/changelog uptimed-0.3.16/debian/changelog --- uptimed-0.3.16/debian/changelog +++ uptimed-0.3.16/debian/changelog @@ -1,3 +1,28 @@ +uptimed (1:0.3.16-3.2) unstable; urgency=low + + * Non-maintainer upload. + * fix uptimed purge failure (Closes: #636596) + * Change default recipient of milestone mails to root (Closes: #629322) + * fix uptimed debconf backup/cancel handling (Closes: #500497) + * Fix lintian error weak-library-dev-dependency + * Fix lintian warning for uprecords-cgi short description + * Don't install uptimed.sh in rcS + * Remove old uptimed.sh conffiles on upgrade + * Add quilt patch system + * Add patch to avoid the need to create a bootid file + + no-bootid-file-on-linux.patch + (The above four changes Closes: #626687) + * Convert direct source edits to patches + + uprecords-cgi-header-path.patch + + uprecords-cgi-header-text-color.patch + * Revert direct source edits since they are now patches + - also remove src/test + * Remove debian/foo + * Add database corruption detection/recovery patch (Closes: #515653) + - Authored by Thibaut VARENE, tested by Martin Steigerwald + + -- Andreas Henriksson <[email protected]> Sat, 27 Aug 2011 08:35:45 +0200 + uptimed (1:0.3.16-3.1) unstable; urgency=low * Non-maintainer upload. diff -u uptimed-0.3.16/debian/uptimed.templates uptimed-0.3.16/debian/uptimed.templates --- uptimed-0.3.16/debian/uptimed.templates +++ uptimed-0.3.16/debian/uptimed.templates @@ -32,7 +32,7 @@ Template: uptimed/mail/address Type: string -Default: root@localhost +Default: root _Description: Where should uptimed send its mails to? Since you have chosen to be sent emails, you should specify where to send these mails. The default "root@localhost" makes sort of sense, but if you diff -u uptimed-0.3.16/debian/control uptimed-0.3.16/debian/control --- uptimed-0.3.16/debian/control +++ uptimed-0.3.16/debian/control @@ -2,7 +2,7 @@ Section: utils Priority: extra Maintainer: Thibaut VARENE <[email protected]> -Build-Depends: debhelper (>= 7), automake, libtool +Build-Depends: debhelper (>= 7), quilt, automake, libtool Standards-Version: 3.8.0 Package: uptimed @@ -33,7 +33,7 @@ Package: libuptimed-dev Section: libdevel Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, perl, libuptimed0 +Depends: ${shlibs:Depends}, ${misc:Depends}, perl, libuptimed0 (= ${binary:Version}) Replaces: libuptimed Description: Development files for uptimed Uptimed allows you to track your highest uptimes via boot IDs. @@ -46,7 +46,7 @@ Architecture: all Depends: uptimed (>= ${source:Version}), ${misc:Depends}, Recommends: apache | httpd -Description: A CGI script to show the world your highest uptimes +Description: CGI script to show the world your highest uptimes This CGI script produces a HTML report containing all your highest uptimes from the uptimed database. . diff -u uptimed-0.3.16/debian/uptimed.config uptimed-0.3.16/debian/uptimed.config --- uptimed-0.3.16/debian/uptimed.config +++ uptimed-0.3.16/debian/uptimed.config @@ -57,8 +57,9 @@ input('medium', 'uptimed/mail/milestones_info'); ($state == 5) && input('low', 'uptimed/interval'); - go; - if($? == 30) { + my @ret = go; + + if($ret[0] == 30) { $state -= 1; } else { $state += 1; diff -u uptimed-0.3.16/debian/uptimed.postinst uptimed-0.3.16/debian/uptimed.postinst --- uptimed-0.3.16/debian/uptimed.postinst +++ uptimed-0.3.16/debian/uptimed.postinst @@ -50,11 +50,8 @@ mv $TEMPFILE /etc/uptimed.conf NEEDRESTART=yes fi - if [ ! -f /var/spool/uptimed/bootid ]; then - if [ ! -d /var/spool/uptimed ]; then - mkdir /var/spool/uptimed - fi - /etc/init.d/uptimed.sh start + if [ ! -d /var/spool/uptimed ]; then + mkdir /var/spool/uptimed fi if [ "$NEEDRESTART" = "yes" ]; then /etc/init.d/uptimed restart-if-running @@ -71,2 +68,7 @@ +# remove old bootid creating script. +if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then + dpkg-maintscript-helper rm_conffile /etc/init.d/uptimed.sh 1:0.3.16-3.1 -- "$@" +fi + #DEBHELPER# reverted: --- uptimed-0.3.16/debian/foo +++ uptimed-0.3.16.orig/debian/foo @@ -1,3 +0,0 @@ -Template: uptimed/mail/do_mail -Type: select -_Choices: Never, Record, Milestone, Both diff -u uptimed-0.3.16/debian/rules uptimed-0.3.16/debian/rules --- uptimed-0.3.16/debian/rules +++ uptimed-0.3.16/debian/rules @@ -25,6 +25,7 @@ endif +include /usr/share/quilt/quilt.make configure: configure-stamp configure-stamp: @@ -36,12 +37,12 @@ touch configure-stamp build: build-stamp -build-stamp: configure-stamp +build-stamp: $(QUILT_STAMPFN) configure-stamp dh_testdir $(MAKE) touch build-stamp -clean: +clean: unpatch dh_testdir dh_testroot rm -f build-stamp configure-stamp @@ -103,7 +104,6 @@ # dh_installpam -a # dh_installmime -a dh_installinit -a -- defaults 99 - dh_installinit -a --name=uptimed.sh --no-start -- start 60 S . # dh_installcron -a dh_installman -a # dh_installinfo -a diff -u uptimed-0.3.16/debian/uptimed.postrm uptimed-0.3.16/debian/uptimed.postrm --- uptimed-0.3.16/debian/uptimed.postrm +++ uptimed-0.3.16/debian/uptimed.postrm @@ -1,5 +1,10 @@ #!/bin/sh +# remove old bootid creating script. +if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then + dpkg-maintscript-helper rm_conffile /etc/init.d/uptimed.sh 1:0.3.16-3.1 -- "$@" +fi + #DEBHELPER# if [ "$1" = "purge" ]; then @@ -9,9 +14,8 @@ echo "done." fi - if [ -f /var/spool/uptimed/bootid ]; then - rm -f /var/spool/uptimed/bootid - fi + rm -f /var/spool/uptimed/records.old + rm -f /var/spool/uptimed/bootid if [ -d /var/spool/uptimed ]; then - rmdir /var/spool/uptimed + rmdir /var/spool/uptimed || true fi fi reverted: --- uptimed-0.3.16/debian/uptimed.uptimed.sh.init +++ uptimed-0.3.16.orig/debian/uptimed.uptimed.sh.init @@ -1,28 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: uptimed-init -# Required-Start: $remote_fs -# Required-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Uptime daemon initialization -### END INIT INFO - -# /etc/init.d/uptimed.sh: initialize uptimed - -test -x /usr/sbin/uptimed || exit 0 - -case "$1" in - start) - /usr/sbin/uptimed -b - ;; - - stop|force-reload|restart) - ;; - - *) - echo "Usage: $0 {start|stop|restart|force-reload}" - exit 1 -esac - -exit 0 reverted: --- uptimed-0.3.16/src/uprecords.c +++ uptimed-0.3.16.orig/src/uprecords.c @@ -61,7 +61,7 @@ /* Print header file. */ if (runas_cgi) + cat("uprecords.header"); - cat("/etc/uprecords-cgi/uprecords.header"); /* Read current uptime and entries from logfile. */ u_current=add_urec(read_uptime(), readbootid(), read_sysinfo()); @@ -88,7 +88,7 @@ /* Print footer file. */ if (runas_cgi) + cat("uprecords.footer"); - cat("/etc/uprecords-cgi/uprecords.footer"); return 0; } @@ -287,7 +287,7 @@ FILE *f; char str[256]; + f=fopen("uprecords.conf", "r"); - f=fopen("/etc/uprecords-cgi/uprecords.conf", "r"); if (!f) return; reverted: --- uptimed-0.3.16/src/test +++ uptimed-0.3.16.orig/src/test @@ -1,13 +0,0 @@ - # Uptime | System Boot up -----------------------------+------------------------------------------------- - 1 0 days, 14:50:38 | Linux 2.6.19-ck2 Sat Dec 30 11:31:09 2006 - 2 0 days, 14:08:56 | Linux 2.6.19-ck2 Thu Dec 28 12:06:20 2006 - 3 0 days, 09:47:25 | Linux 2.6.19-ck2 Fri Dec 29 15:44:22 2006 -[1m-> 4 0 days, 07:09:14 [0m|[1m Linux 2.6.19-ck2 Sun Dec 31 19:14:29 2006[0m - 5 0 days, 02:00:19 | Linux 2.6.19-ck2 Fri Dec 29 02:21:26 2006 - 6 0 days, 01:06:31 | Linux 2.6.19-ck2 Sun Dec 31 02:32:19 2006 - 7 0 days, 00:03:06 | Linux 2.6.19-ck2 Fri Dec 29 02:17:49 2006 - 8 0 days, 00:02:46 | Linux 2.6.19-ck2 Sun Dec 31 02:25:24 2006 -----------------------------+------------------------------------------------- -1up in 0 days, 02:38:12 | at Mon Jan 1 05:01:54 2007 -no1 in 0 days, 07:41:25 | at Mon Jan 1 10:05:07 2007 reverted: --- uptimed-0.3.16/sample-cgi/uprecords.header +++ uptimed-0.3.16.orig/sample-cgi/uprecords.header @@ -2,7 +2,7 @@ <head> <title>Uptime records for this host</title> </head> +<body bgcolor="#ffffff"> -<body bgcolor="#ffffff" text="#000000"> <h1>Uptime records for this host</h1> This host runs a cool program called <b>uptimed</b> to log uptime records. It comes with a nice program to examine the logs and display them in a only in patch2: unchanged: --- uptimed-0.3.16.orig/debian/uptimed.preinst +++ uptimed-0.3.16/debian/uptimed.preinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +# remove old bootid creating script and symlinks from rcS. +if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then + update-rc.d -f uptimed.sh remove + dpkg-maintscript-helper rm_conffile /etc/init.d/uptimed.sh 1:0.3.16-3.1 -- "$@" +fi + +#DEBHELPER# only in patch2: unchanged: --- uptimed-0.3.16.orig/debian/patches/no-bootid-file-on-linux.patch +++ uptimed-0.3.16/debian/patches/no-bootid-file-on-linux.patch @@ -0,0 +1,93 @@ +diff -uriNp uptimed-0.3.16/libuptimed/urec.c uptimed-0.3.16-nobootidfile//libuptimed/urec.c +--- uptimed-0.3.16/libuptimed/urec.c 2009-01-02 00:46:00.000000000 +0100 ++++ uptimed-0.3.16-nobootidfile//libuptimed/urec.c 2011-08-26 16:53:58.000000000 +0200 +@@ -268,34 +268,11 @@ void save_records(int max, time_t log_th + rename(FILE_RECORDS".tmp", FILE_RECORDS); + } + +-#ifdef PLATFORM_LINUX ++#if defined(PLATFORM_LINUX) || defined(PLATFORM_BSD) + int createbootid(void) { +- FILE *f; +- char str[256]; +- time_t bootid = 0; +- +- f=fopen("/proc/stat", "r"); +- if (!f) { +- printf ("Error opening /proc file. Can not determine bootid, exiting!\n"); exit(-1); +- } else { +- fgets(str, sizeof(str), f); +- while (!feof(f)) { +- if (strstr(str, "btime")) { +- bootid=atoi(str+6); +- break; +- } +- fgets(str, sizeof(str), f); +- } +- fclose(f); +- } +- +- f = fopen(FILE_BOOTID, "w"); +- if (!f) { +- printf("Error writing bootid file, exiting!\n"); exit(-1); +- } else { +- fprintf(f, "%ld\n", bootid); +- fclose(f); +- } ++ /* these platforms doesn't need to create a bootid file. ++ * readbootid() fetches it directly from the system every time. ++ */ + return 0; + } + #endif +@@ -384,6 +361,31 @@ time_t readbootid(void) { + } + + return bootid; ++#elif PLATFORM_LINUX ++ FILE *f; ++ char str[256]; ++ time_t bootid = 0; ++ ++ f=fopen("/proc/stat", "r"); ++ if (!f) { ++ printf ("Error opening /proc/stat file. Can not determine bootid, exiting!\n"); ++ exit(-1); ++ } else { ++ fgets(str, sizeof(str), f); ++ while (!feof(f)) { ++ if (strstr(str, "btime")) { ++ bootid=atoi(str+6); ++ break; ++ } ++ fgets(str, sizeof(str), f); ++ } ++ fclose(f); ++ } ++ if (bootid == 0) { ++ printf ("Parsing btime from /proc/stat failed. Can not determine bootid, exiting!\n"); ++ exit(-1); ++ } ++ return bootid; + #else + FILE *f; + char str[256]; +diff -uriNp uptimed-0.3.16/src/uptimed.c uptimed-0.3.16-nobootidfile//src/uptimed.c +--- uptimed-0.3.16/src/uptimed.c 2009-01-02 00:46:00.000000000 +0100 ++++ uptimed-0.3.16-nobootidfile//src/uptimed.c 2011-08-26 16:48:00.000000000 +0200 +@@ -75,7 +75,6 @@ int main(int argc, char *argv[]) + } + } + +-#ifndef PLATFORM_BSD + /* Create bootid and exit. Should be done once on startup. */ + if (create_bootid) + { +@@ -83,7 +82,6 @@ int main(int argc, char *argv[]) + syslog(LOG_INFO, SYSLOG_PREFIX "created bootid: %d", readbootid()); + exit(0); + } +-#endif + + if (update_interval<1) + update_interval=1; only in patch2: unchanged: --- uptimed-0.3.16.orig/debian/patches/uprecords-cgi-header-path.patch +++ uptimed-0.3.16/debian/patches/uprecords-cgi-header-path.patch @@ -0,0 +1,29 @@ +--- uptimed-0.3.16.orig/src/uprecords.c ++++ uptimed-0.3.16/src/uprecords.c +@@ -61,7 +61,7 @@ + + /* Print header file. */ + if (runas_cgi) +- cat("uprecords.header"); ++ cat("/etc/uprecords-cgi/uprecords.header"); + + /* Read current uptime and entries from logfile. */ + u_current=add_urec(read_uptime(), readbootid(), read_sysinfo()); +@@ -88,7 +88,7 @@ + + /* Print footer file. */ + if (runas_cgi) +- cat("uprecords.footer"); ++ cat("/etc/uprecords-cgi/uprecords.footer"); + + return 0; + } +@@ -287,7 +287,7 @@ + FILE *f; + char str[256]; + +- f=fopen("uprecords.conf", "r"); ++ f=fopen("/etc/uprecords-cgi/uprecords.conf", "r"); + if (!f) + return; + only in patch2: unchanged: --- uptimed-0.3.16.orig/debian/patches/thibaut-truc-detect-corrupt-configuration-file-fixed-filesize-comparison.patch +++ uptimed-0.3.16/debian/patches/thibaut-truc-detect-corrupt-configuration-file-fixed-filesize-comparison.patch @@ -0,0 +1,67 @@ +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.000000000 +0100 ++++ uptimed-0.3.16/libuptimed/urec.c 2011-03-06 21:01:28.000000000 +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.000000000 +0100 ++++ uptimed-0.3.16/libuptimed/urec.h 2011-03-06 20:48:49.000000000 +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> only in patch2: unchanged: --- uptimed-0.3.16.orig/debian/patches/series +++ uptimed-0.3.16/debian/patches/series @@ -0,0 +1,4 @@ +no-bootid-file-on-linux.patch +uprecords-cgi-header-path.patch +uprecords-cgi-header-text-color.patch +thibaut-truc-detect-corrupt-configuration-file-fixed-filesize-comparison.patch only in patch2: unchanged: --- uptimed-0.3.16.orig/debian/patches/uprecords-cgi-header-text-color.patch +++ uptimed-0.3.16/debian/patches/uprecords-cgi-header-text-color.patch @@ -0,0 +1,11 @@ +--- uptimed-0.3.16.orig/sample-cgi/uprecords.header ++++ uptimed-0.3.16/sample-cgi/uprecords.header +@@ -2,7 +2,7 @@ + <head> + <title>Uptime records for this host</title> + </head> +-<body bgcolor="#ffffff"> ++<body bgcolor="#ffffff" text="#000000"> + <h1>Uptime records for this host</h1> + This host runs a cool program called <b>uptimed</b> to log uptime records. + It comes with a nice program to examine the logs and display them in a
signature.asc
Description: Digital signature

