Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package wtmpdb for openSUSE:Factory checked in at 2025-12-02 13:19:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wtmpdb (Old) and /work/SRC/openSUSE:Factory/.wtmpdb.new.14147 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wtmpdb" Tue Dec 2 13:19:04 2025 rev:25 rq:1320664 version:0.75.0+git20251130.0d8fe7a Changes: -------- --- /work/SRC/openSUSE:Factory/wtmpdb/wtmpdb.changes 2025-10-10 17:08:17.190556666 +0200 +++ /work/SRC/openSUSE:Factory/.wtmpdb.new.14147/wtmpdb.changes 2025-12-02 13:19:39.173585254 +0100 @@ -1,0 +2,10 @@ +Sun Nov 30 17:36:17 UTC 2025 - Thorsten Kukuk <[email protected]> + +- Update to version 0.75.0+git20251130.0d8fe7a: + * wtmpdbd: add method Rotate to interface definition + * wtmpdb last: fix --present option + * last -x: apply --since and --until to split entries + * last -x: show shutdown entries before reboot ones + * Fix varlink definition for type WtmpdbEntry + +------------------------------------------------------------------- Old: ---- wtmpdb-0.75.0+git20251009.a6f185a.tar.xz New: ---- wtmpdb-0.75.0+git20251130.0d8fe7a.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wtmpdb.spec ++++++ --- /var/tmp/diff_new_pack.QnrjXc/_old 2025-12-02 13:19:40.045621866 +0100 +++ /var/tmp/diff_new_pack.QnrjXc/_new 2025-12-02 13:19:40.049622034 +0100 @@ -18,7 +18,7 @@ %define lname libwtmpdb0 Name: wtmpdb -Version: 0.75.0+git20251009.a6f185a +Version: 0.75.0+git20251130.0d8fe7a Release: 0 Summary: Database for recording the last logged in users and system reboots License: BSD-2-Clause ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.QnrjXc/_old 2025-12-02 13:19:40.105624385 +0100 +++ /var/tmp/diff_new_pack.QnrjXc/_new 2025-12-02 13:19:40.109624553 +0100 @@ -4,6 +4,6 @@ </service> <service name="tar_scm"> <param name="url">https://github.com/thkukuk/wtmpdb.git</param> - <param name="changesrevision">a6f185a241ee633cbba600029ec153feb2665cf8</param></service></servicedata> + <param name="changesrevision">0d8fe7a1803a71e747ccf172e9c6c16af0ce6688</param></service></servicedata> (No newline at EOF) ++++++ wtmpdb-0.75.0+git20251009.a6f185a.tar.xz -> wtmpdb-0.75.0+git20251130.0d8fe7a.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.75.0+git20251009.a6f185a/NEWS new/wtmpdb-0.75.0+git20251130.0d8fe7a/NEWS --- old/wtmpdb-0.75.0+git20251009.a6f185a/NEWS 2025-10-09 15:18:36.000000000 +0200 +++ new/wtmpdb-0.75.0+git20251130.0d8fe7a/NEWS 2025-11-30 17:20:54.000000000 +0100 @@ -1,3 +1,8 @@ +Version 0.7X.0 +* Fix last --present option +* last -x: apply --since and --until to split entries +* last -x: show shutdown entries before reboot ones + Version 0.75.0 * Use empty memory table instead of failing to read empty file * libwtmpdb: enhance/unify error messages diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.75.0+git20251009.a6f185a/src/varlink-org.openSUSE.wtmpdb.c new/wtmpdb-0.75.0+git20251130.0d8fe7a/src/varlink-org.openSUSE.wtmpdb.c --- old/wtmpdb-0.75.0+git20251009.a6f185a/src/varlink-org.openSUSE.wtmpdb.c 2025-10-09 15:18:36.000000000 +0200 +++ new/wtmpdb-0.75.0+git20251130.0d8fe7a/src/varlink-org.openSUSE.wtmpdb.c 2025-11-30 17:20:54.000000000 +0100 @@ -90,6 +90,8 @@ org_openSUSE_wtmpdb, "org.openSUSE.wtmpdb", SD_VARLINK_INTERFACE_COMMENT("Wtmpdbd control APIs"), + SD_VARLINK_SYMBOL_COMMENT("Wtmpdb entry struct"), + &vl_type_WtmpdbEntry, SD_VARLINK_SYMBOL_COMMENT("Add login entry"), &vl_method_Login, SD_VARLINK_SYMBOL_COMMENT("Close login entry with logout time"), @@ -100,6 +102,8 @@ &vl_method_GetBootTime, SD_VARLINK_SYMBOL_COMMENT("Get all entries from database"), &vl_method_ReadAll, + SD_VARLINK_SYMBOL_COMMENT("Rotate the database"), + &vl_method_Rotate, SD_VARLINK_SYMBOL_COMMENT("Stop the daemon"), &vl_method_Quit, SD_VARLINK_SYMBOL_COMMENT("Checks if the service is running."), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wtmpdb-0.75.0+git20251009.a6f185a/src/wtmpdb.c new/wtmpdb-0.75.0+git20251130.0d8fe7a/src/wtmpdb.c --- old/wtmpdb-0.75.0+git20251009.a6f185a/src/wtmpdb.c 2025-10-09 15:18:36.000000000 +0200 +++ new/wtmpdb-0.75.0+git20251130.0d8fe7a/src/wtmpdb.c 2025-11-30 17:20:54.000000000 +0100 @@ -65,11 +65,11 @@ #define LOGROTATE_DAYS 60 -/* lenght of login string cannot become longer */ +/* length of login string cannot become longer */ #define LAST_TIMESTAMP_LEN 32 static uint64_t wtmp_start = UINT64_MAX; -static int after_reboot = 0; +static uint64_t after_reboot = 0; /* options for last */ static int hostlast = 0; @@ -131,6 +131,12 @@ return is_ip; } +static inline time_t +from_usec(uint64_t usecs) +{ + return (time_t) usecs / USEC_PER_SEC; +} + static int parse_time (const char *str, time_t *arg) { @@ -409,9 +415,11 @@ int argc, char **argv, char **azColName) { char host_buf[NI_MAXHOST]; - char logintime[32]; /* LAST_TIMESTAMP_LEN */ - char logouttime[32]; /* LAST_TIMESTAMP_LEN */ - char length[32]; /* LAST_TIMESTAMP_LEN */ + struct times_buf { + char login[LAST_TIMESTAMP_LEN]; + char logout[LAST_TIMESTAMP_LEN]; + char length[LAST_TIMESTAMP_LEN]; + } times; char *endptr; uint64_t logout_t = 0; static uint64_t newer_boot = 0; @@ -444,17 +452,27 @@ fprintf (stderr, "Invalid numeric time entry for 'login': '%s'\n", argv[3]); + if (argv[4]) + { + logout_t = strtoull(argv[4], &endptr, 10); + if ((errno == ERANGE && logout_t == ULLONG_MAX) + || (endptr == argv[4]) || (*endptr != '\0')) + fprintf (stderr, "Invalid numeric time entry for 'logout': '%s'\n", + argv[4]); + } + if (login_t < wtmp_start) wtmp_start = login_t; - if (since && (since > (time_t)(login_t/USEC_PER_SEC))) - return 0; - - if (until && (until < (time_t)(login_t/USEC_PER_SEC))) - return 0; + int swap = type == xflag && BOOT_TIME && logout_t != 0; - if (present && (present < (time_t)(login_t/USEC_PER_SEC))) - return 0; + if ((since && since > from_usec(swap ? logout_t : login_t)) || + (until && until < from_usec(login_t))) + { + if (xflag && (type == BOOT_TIME)) + newer_boot = login_t; + return 0; + } if (match) { @@ -470,32 +488,22 @@ return 0; } - format_time (login_fmt, logintime, sizeof (logintime), + format_time (login_fmt, times.login, sizeof (times.login), login_t/USEC_PER_SEC); - if (argv[4]) + if (logout_t != 0) { - logout_t = strtoull(argv[4], &endptr, 10); - if ((errno == ERANGE && logout_t == ULLONG_MAX) - || (endptr == argv[4]) || (*endptr != '\0')) - fprintf (stderr, "Invalid numeric time entry for 'logout': '%s'\n", - argv[4]); - - if (present && (0 < (logout_t/USEC_PER_SEC)) && - ((time_t)(logout_t/USEC_PER_SEC) < present)) - return 0; - - format_time (logout_fmt, logouttime, sizeof (logouttime), + format_time (logout_fmt, times.logout, sizeof (times.logout), logout_t/USEC_PER_SEC); - calc_time_length (length, sizeof(length), login_t, logout_t); + calc_time_length (times.length, sizeof(times.length), login_t, logout_t); } else /* login but no logout */ { if (after_reboot) { - snprintf (logouttime, sizeof (logouttime), "crash"); - length[0] = '\0'; + snprintf (times.logout, sizeof (times.logout), "crash"); + times.length[0] = '\0'; } else { @@ -504,41 +512,35 @@ case USER_PROCESS: if (logout_fmt == TIMEFMT_HHMM) { - snprintf (logouttime, sizeof (logouttime), "still"); - snprintf(length, sizeof(length), "logged in"); + snprintf (times.logout, sizeof (times.logout), "still"); + snprintf(times.length, sizeof(times.length), "logged in"); } else { - snprintf (logouttime, sizeof (logouttime), "still logged in"); - length[0] = '\0'; + snprintf (times.logout, sizeof (times.logout), "still logged in"); + times.length[0] = '\0'; } break; case BOOT_TIME: if (logout_fmt == TIMEFMT_HHMM) { - snprintf (logouttime, sizeof (logouttime), "still"); - snprintf(length, sizeof(length), "running"); + snprintf (times.logout, sizeof (times.logout), "still"); + snprintf(times.length, sizeof(times.length), "running"); } else { - snprintf (logouttime, sizeof (logouttime), "still running"); - length[0] = '\0'; + snprintf (times.logout, sizeof (times.logout), "still running"); + times.length[0] = '\0'; } break; default: - snprintf (logouttime, sizeof (logouttime), "ERROR"); - snprintf(length, sizeof(length), "Unknown: %d", type); + snprintf (times.logout, sizeof (times.logout), "ERROR"); + snprintf(times.length, sizeof(times.length), "Unknown: %d", type); break; } } } - if (type == BOOT_TIME) - { - tty = "system boot"; - after_reboot = 1; - } - char *print_service = NULL; if (noservice) print_service = strdup (""); @@ -595,22 +597,47 @@ } } - print_line (user, tty, host, print_service, logintime, logouttime, length); - if (xflag && (type == BOOT_TIME) && newer_boot != 0 && logout_t != 0) { - format_time (login_fmt, logintime, sizeof (logintime), + struct times_buf shutdown; + + format_time (login_fmt, shutdown.login, sizeof (shutdown.login), logout_t/USEC_PER_SEC); - format_time (logout_fmt, logouttime, sizeof (logouttime), + format_time (logout_fmt, shutdown.logout, sizeof (shutdown.logout), newer_boot/USEC_PER_SEC); - calc_time_length (length, sizeof(length), logout_t, newer_boot); + calc_time_length (shutdown.length, sizeof(shutdown.length), logout_t, newer_boot); - print_line ("shutdown", "system down", host, print_service, - logintime, logouttime, length); + if ((!until || until >= from_usec(logout_t)) && + (!since || since <= from_usec(logout_t))) + print_line ("shutdown", "system down", host, print_service, + shutdown.login, shutdown.logout, shutdown.length); } if (xflag && (type == BOOT_TIME)) newer_boot = login_t; + if (type == BOOT_TIME) + { + tty = "system boot"; + after_reboot = login_t; + } + + if (present) + { + if (present < from_usec(login_t)) + return 0; + + if (logout_t > 0 && from_usec(logout_t) < present) + return 0; + + if (logout_t == 0 && after_reboot > 0 && + from_usec(after_reboot) < present) + return 0; + } + + if ((!until || until >= from_usec(login_t)) && + (!since || since <= from_usec(login_t))) + print_line (user, tty, host, print_service, times.login, times.logout, times.length); + free (print_service); currentry++;
