Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package wtmpdb for openSUSE:Factory checked in at 2023-08-17 19:42:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wtmpdb (Old) and /work/SRC/openSUSE:Factory/.wtmpdb.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wtmpdb" Thu Aug 17 19:42:40 2023 rev:8 rq:1104166 version:0.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/wtmpdb/wtmpdb.changes 2023-08-10 15:33:08.515879929 +0200 +++ /work/SRC/openSUSE:Factory/.wtmpdb.new.1766/wtmpdb.changes 2023-08-17 19:42:41.514693585 +0200 @@ -1,0 +2,7 @@ +Mon Aug 14 15:04:26 UTC 2023 - Thorsten Kukuk <ku...@suse.com> + +- Update to version 0.9.0 + - Try to detect systemctl soft-reboot + - Many conversation warning/error fixes + +------------------------------------------------------------------- Old: ---- wtmpdb-0.8.0.tar.xz New: ---- wtmpdb-0.9.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wtmpdb.spec ++++++ --- /var/tmp/diff_new_pack.5t5uVT/_old 2023-08-17 19:42:43.030696420 +0200 +++ /var/tmp/diff_new_pack.5t5uVT/_new 2023-08-17 19:42:43.042696442 +0200 @@ -18,7 +18,7 @@ %define lname libwtmpdb0 Name: wtmpdb -Version: 0.8.0 +Version: 0.9.0 Release: 0 Summary: Database for recording the last logged in users and system reboots License: BSD-2-Clause ++++++ wtmpdb-0.8.0.tar.xz -> wtmpdb-0.9.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/INSTALL.md new/wtmpdb-0.9.0/INSTALL.md --- old/wtmpdb-0.8.0/INSTALL.md 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/INSTALL.md 2023-08-14 17:03:04.000000000 +0200 @@ -9,7 +9,7 @@ ```shell $ meson setup build $ meson compile -C build -$ meson compile -C build test +$ meson test -C build $ sudo meson install -C build ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/NEWS new/wtmpdb-0.9.0/NEWS --- old/wtmpdb-0.8.0/NEWS 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/NEWS 2023-08-14 17:03:04.000000000 +0200 @@ -1,3 +1,8 @@ +Version 0.9.0 +* Fix lot of 32bit/64bit signed/unsiged int conversations +* Try to autodetect systemctl soft-reboot and use current + time instead of kernel boot time. + Version 0.8.0 * Fix linking with clang * wtmdb boottime: show boot time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/README.md new/wtmpdb-0.9.0/README.md --- old/wtmpdb-0.8.0/README.md 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/README.md 2023-08-14 17:03:04.000000000 +0200 @@ -17,7 +17,7 @@ The main features of `wtmpdb` are: * It's using sqlite3 as database backend. -* Data is mainly collected via a PAM module, so that every tools can make use of it, without modifying existing packages. For cases where this is not possible, there is a library `libwtmpdb`. +* Data is mainly collected via a PAM module, so that every tool can make use of it, without modifying existing packages. For cases where this is not possible, there is a library `libwtmpdb`. * The `wtmpdb last` output is as compatible as possible with the old `last` implementation, but not all options are yet supported. For compatibility reasons, a symlink `last` pointing to `wtmpdb` can be created. **IMPORTANT** To be Y2038 safe on 32bit architectures, the binaries needs to be build with a **64bit time_t**. This should be the standard on 64bit architectures. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/lib/logwtmpdb.c new/wtmpdb-0.9.0/lib/logwtmpdb.c --- old/wtmpdb-0.8.0/lib/logwtmpdb.c 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/lib/logwtmpdb.c 2023-08-14 17:03:04.000000000 +0200 @@ -57,7 +57,7 @@ clock_gettime (CLOCK_REALTIME, &ts); - int64_t time = wtmpdb_timespec2usec (ts); + uint64_t time = wtmpdb_timespec2usec (ts); if (error) *error = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/lib/sqlite.c new/wtmpdb-0.9.0/lib/sqlite.c --- old/wtmpdb-0.8.0/lib/sqlite.c 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/lib/sqlite.c 2023-08-14 17:03:04.000000000 +0200 @@ -59,7 +59,7 @@ static const int max_ext_len = 4; /* Check chars starting at end of string to find last '.' */ - for (ssize_t i = strlen(in_str); i > (name_min_len + max_ext_len); i--) + for (size_t i = strlen(in_str); i > (name_min_len + max_ext_len); i--) { if (in_str[i] == '.') { @@ -397,7 +397,7 @@ wtmpdb_get_id (const char *db_path, const char *tty, char **error) { sqlite3 *db; - int retval; + int64_t retval; if ((db = open_database_ro (db_path?db_path:_PATH_WTMPDB, error)) == NULL) return -1; @@ -424,7 +424,7 @@ if ((db = open_database_ro (db_path?db_path:_PATH_WTMPDB, error)) == NULL) return -1; - char *sql = "SELECT * FROM wtmp ORDER BY Login DESC"; + char *sql = "SELECT * FROM wtmp ORDER BY Login DESC, Logout ASC"; if (sqlite3_exec (db, sql, cb_func, NULL, &err_msg) != SQLITE_OK) { @@ -458,20 +458,14 @@ fprintf (stderr, "Invalid numeric time entry for 'login': '%s'\n", sqlite3_column_text( sqlStatement, 5 )); - int id = add_entry (db_dest, - type, - user, - login_t, - tty, - host, - service, - error); + int64_t id = add_entry (db_dest, type, user, login_t, tty, host, + service, error); if (id >=0) { const char *logout = (const char*)sqlite3_column_text( sqlStatement, 4 ); if (logout) { - int64_t logout_t = strtoul(logout, &endptr, 10); + uint64_t logout_t = strtoul(logout, &endptr, 10); if ((errno == ERANGE && logout_t == INT64_MAX) || (endptr == logout) || (*endptr != '\0')) { @@ -665,13 +659,13 @@ sqlite3_errmsg (db)) < 0) *error = strdup ("Out of memory"); - return -1; + return 0; } int step = sqlite3_step (res); if (step == SQLITE_ROW) - boottime = sqlite3_column_int64 (res, 0); + boottime = (uint64_t)sqlite3_column_int64 (res, 0); else { if (error) @@ -679,7 +673,7 @@ *error = strdup("Out of memory"); sqlite3_finalize (res); - return -1; + return 0; } sqlite3_finalize (res); @@ -694,7 +688,7 @@ uint64_t retval; if ((db = open_database_ro (db_path?db_path:_PATH_WTMPDB, error)) == NULL) - return -1; + return 0; retval = search_boottime (db, error); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/man/wtmpdb.8.xml new/wtmpdb-0.9.0/man/wtmpdb.8.xml --- old/wtmpdb-0.8.0/man/wtmpdb.8.xml 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/man/wtmpdb.8.xml 2023-08-14 17:03:04.000000000 +0200 @@ -216,6 +216,16 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term> + <option>-q, --quiet</option> + </term> + <listitem> + <para> + Don't print informative messages. + </para> + </listitem> + </varlistentry> </listitem> </varlistentry> <varlistentry> @@ -305,7 +315,7 @@ <title>FILES</title> <variablelist> <varlistentry> - <term>/var/lib/lastlog/wtmpdb.db</term> + <term>/var/lib/wtmpdb/wtmpdb.db</term> <listitem> <para>Wtmpdb logging database file</para> </listitem> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/meson.build new/wtmpdb-0.9.0/meson.build --- old/wtmpdb-0.8.0/meson.build 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/meson.build 2023-08-14 17:03:04.000000000 +0200 @@ -11,7 +11,7 @@ 'b_pie=true', 'warning_level=3',], license : ['BSD-2-Clause',], - version : '0.8.0', + version : '0.9.0', ) conf = configuration_data() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/src/wtmpdb.c new/wtmpdb-0.9.0/src/wtmpdb.c --- old/wtmpdb-0.8.0/src/wtmpdb.c 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/src/wtmpdb.c 2023-08-14 17:03:04.000000000 +0200 @@ -70,8 +70,8 @@ static int logout_fmt = TIMEFMT_HHMM; static int logout_len = 5; /* 5 = short, 24 = full */ static const int host_len = 16; /* LAST_DOMAIN_LEN */ -static unsigned int maxentries = 0; /* max number of entries to show */ -static unsigned int currentry = 0; /* number of entries already printed */ +static unsigned long maxentries = 0; /* max number of entries to show */ +static unsigned long currentry = 0; /* number of entries already printed */ static time_t present = 0; /* Who was present at the specified time */ static time_t since = 0; /* Who was logged in after this time? */ static time_t until = 0; /* Who was logged in until this time? */ @@ -152,22 +152,27 @@ } static void -format_time (int fmt, char *dst, size_t dstlen, time_t t) +format_time (int fmt, char *dst, size_t dstlen, uint64_t time) { switch (fmt) { case TIMEFMT_CTIME: - snprintf (dst, dstlen, "%s", ctime (&t)); - dst[strlen (dst)-1] = '\0'; /* Remove trailing '\n' */ - break; + { + time_t t = (time_t)time; + snprintf (dst, dstlen, "%s", ctime (&t)); + dst[strlen (dst)-1] = '\0'; /* Remove trailing '\n' */ + break; + } case TIMEFMT_SHORT: { + time_t t = (time_t)time; struct tm *tm = localtime (&t); strftime (dst, dstlen, "%a %b %e %H:%M", tm); break; } case TIMEFMT_HHMM: { + time_t t = (time_t)time; struct tm *tm = localtime (&t); strftime (dst, dstlen, "%H:%M", tm); break; @@ -178,19 +183,19 @@ } static void -calc_time_length(char *dst, size_t dstlen, int64_t start, int64_t stop) +calc_time_length(char *dst, size_t dstlen, uint64_t start, uint64_t stop) { - int64_t secs = (stop - start)/USEC_PER_SEC; - int mins = (secs / 60) % 60; - int hours = (secs / 3600) % 24; - int days = secs / 86400; + uint64_t secs = (stop - start)/USEC_PER_SEC; + uint64_t mins = (secs / 60) % 60; + uint64_t hours = (secs / 3600) % 24; + uint64_t days = secs / 86400; if (days) - snprintf (dst, dstlen, "(%d+%02d:%02d)", days, hours, mins); + snprintf (dst, dstlen, "(%ld+%02ld:%02ld)", days, hours, mins); else if (hours) - snprintf (dst, dstlen, " (%02d:%02d)", hours, mins); + snprintf (dst, dstlen, " (%02ld:%02ld)", hours, mins); else - snprintf (dst, dstlen, " (00:%02d)", mins); + snprintf (dst, dstlen, " (00:%02ld)", mins); } static void @@ -255,8 +260,8 @@ char logouttime[32]; /* LAST_TIMESTAMP_LEN */ char length[32]; /* LAST_TIMESTAMP_LEN */ char *endptr; - int64_t logout_t = -1; - static int64_t newer_boot = -1; + uint64_t logout_t = 0; + static uint64_t newer_boot = 0; /* Yes, it's waste of time to let sqlite iterate through all entries even if we don't need more anymore, but telling sqlite we don't @@ -425,7 +430,7 @@ print_line (user, tty, host, print_service, logintime, logouttime, length); - if (xflag && (type == BOOT_TIME) && newer_boot != -1 && logout_t != -1) + if (xflag && (type == BOOT_TIME) && newer_boot != 0 && logout_t != 0) { format_time (login_fmt, logintime, sizeof (logintime), logout_t/USEC_PER_SEC); @@ -601,7 +606,7 @@ iflag = 1; break; case 'n': - maxentries = atoi (optarg); + maxentries = strtoul (optarg, NULL, 10); break; case 'p': if (parse_time (optarg, &present) < 0) @@ -730,18 +735,23 @@ { struct option const longopts[] = { {"file", required_argument, NULL, 'f'}, + {"quiet", no_argument, NULL, 'q'}, {NULL, 0, NULL, '\0'} }; char *error = NULL; int c; + int quiet = 0; - while ((c = getopt_long (argc, argv, "f:", longopts, NULL)) != -1) + while ((c = getopt_long (argc, argv, "f:q", longopts, NULL)) != -1) { switch (c) { case 'f': wtmpdb_path = optarg; break; + case 'q': + quiet = 1; + break; default: usage (EXIT_FAILURE); break; @@ -759,9 +769,27 @@ struct timespec ts_now; struct timespec ts_boot; + struct timespec ts_empty = { .tv_sec = 0, .tv_nsec = 0 }; clock_gettime (CLOCK_REALTIME, &ts_now); clock_gettime (CLOCK_BOOTTIME, &ts_boot); - int64_t time = wtmpdb_timespec2usec (diff_timespec(&ts_now, &ts_boot)); + uint64_t time = wtmpdb_timespec2usec (diff_timespec(&ts_now, &ts_boot)); + uint64_t now = wtmpdb_timespec2usec (diff_timespec(&ts_now, &ts_empty)); + + if ((now - time) > 300 * USEC_PER_SEC /* 5 minutes */) + { + if (!quiet) + { + char timebuf[32]; + printf ("Boot time too far in the past, using current time:\n"); + format_time (TIMEFMT_CTIME, timebuf, sizeof (timebuf), + time/USEC_PER_SEC); + printf ("Boot time: %s\n", timebuf); + format_time (TIMEFMT_CTIME, timebuf, sizeof (timebuf), + now/USEC_PER_SEC); + printf ("Current time: %s\n", timebuf); + } + time = now; + } #if HAVE_AUDIT log_audit (AUDIT_SYSTEM_BOOT); @@ -880,7 +908,7 @@ struct timespec ts; clock_gettime (CLOCK_REALTIME, &ts); - int64_t time = wtmpdb_timespec2usec (ts); + uint64_t time = wtmpdb_timespec2usec (ts); if (wtmpdb_logout (wtmpdb_path, id, time, &error) < 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.8.0/tests/tst-login-logout.c new/wtmpdb-0.9.0/tests/tst-login-logout.c --- old/wtmpdb-0.8.0/tests/tst-login-logout.c 2023-08-09 16:12:24.000000000 +0200 +++ new/wtmpdb-0.9.0/tests/tst-login-logout.c 2023-08-14 17:03:04.000000000 +0200 @@ -46,8 +46,8 @@ char *error = NULL; int64_t id; struct timespec ts; - int64_t login_t = -1; - int64_t logout_t = -1; + uint64_t login_t; + uint64_t logout_t; clock_gettime (CLOCK_REALTIME, &ts); ts.tv_sec -= 259200; /* three days behind */