Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package lastlog2 for openSUSE:Factory 
checked in at 2023-03-29 23:28:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lastlog2 (Old)
 and      /work/SRC/openSUSE:Factory/.lastlog2.new.31432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lastlog2"

Wed Mar 29 23:28:15 2023 rev:2 rq:1075214 version:0.6.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/lastlog2/lastlog2.changes        2023-03-26 
20:19:21.071006341 +0200
+++ /work/SRC/openSUSE:Factory/.lastlog2.new.31432/lastlog2.changes     
2023-03-29 23:28:16.419801244 +0200
@@ -1,0 +2,8 @@
+Wed Mar 29 12:19:00 UTC 2023 - Thorsten Kukuk <ku...@suse.com>
+
+- Version 0.6.2
+  - Add more test cases
+  - Add --version option for lastlog2
+  - Fix a Y2038 problem on 32bit architectures
+
+-------------------------------------------------------------------

Old:
----
  lastlog2-0.6.1.tar.xz

New:
----
  lastlog2-0.6.2.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lastlog2.spec ++++++
--- /var/tmp/diff_new_pack.aaGk85/_old  2023-03-29 23:28:17.251805690 +0200
+++ /var/tmp/diff_new_pack.aaGk85/_new  2023-03-29 23:28:17.259805733 +0200
@@ -18,7 +18,7 @@
 
 %define lname   liblastlog2-0
 Name:           lastlog2
-Version:        0.6.1
+Version:        0.6.2
 Release:        0
 Summary:        Reports most recent login of users
 License:        BSD-2-Clause

++++++ lastlog2-0.6.1.tar.xz -> lastlog2-0.6.2.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lastlog2-0.6.1/.github/workflows/meson.yml 
new/lastlog2-0.6.2/.github/workflows/meson.yml
--- old/lastlog2-0.6.1/.github/workflows/meson.yml      2023-03-23 
14:43:04.000000000 +0100
+++ new/lastlog2-0.6.2/.github/workflows/meson.yml      2023-03-29 
14:37:28.000000000 +0200
@@ -7,8 +7,8 @@
 
     runs-on: ubuntu-latest
     steps:
-    - name: Install pam-devel
-      run: sudo apt-get install libpam0g-dev
+    - name: Install build environment
+      run: sudo apt-get install libpam0g-dev xsltproc docbook5-xml 
docbook-xsl-ns
     - uses: actions/checkout@v3
     - uses: BSFishy/meson-build@v1.0.3
       with:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lastlog2-0.6.1/NEWS new/lastlog2-0.6.2/NEWS
--- old/lastlog2-0.6.1/NEWS     2023-03-23 14:43:04.000000000 +0100
+++ new/lastlog2-0.6.2/NEWS     2023-03-29 14:37:28.000000000 +0200
@@ -1,3 +1,8 @@
+Version 0.6.2
+* Add more test cases
+* Add --version option for lastlog2
+* Fix a Y2038 problem on 32bit architectures
+
 Version 0.6.1
 * Use -Wformat-security and fix some warnings
 * Fix not free'd variables in test cases to avoid false positives from tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lastlog2-0.6.1/lib/lastlog2.c 
new/lastlog2-0.6.2/lib/lastlog2.c
--- old/lastlog2-0.6.1/lib/lastlog2.c   2023-03-23 14:43:04.000000000 +0100
+++ new/lastlog2-0.6.2/lib/lastlog2.c   2023-03-29 14:37:28.000000000 +0200
@@ -334,8 +334,8 @@
     }
 
   errno = 0;
-  int64_t ll_time = strtol(argv[1], &endptr, 10);
-  if ((errno == ERANGE && (ll_time == LONG_MAX || ll_time == LONG_MIN))
+  int64_t ll_time = strtoll(argv[1], &endptr, 10);
+  if ((errno == ERANGE && (ll_time == INT64_MAX || ll_time == INT64_MIN))
       || (endptr == argv[1]) || (*endptr != '\0'))
     fprintf (stderr, "Invalid numeric time entry for '%s': '%s'\n", argv[0], 
argv[1]);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lastlog2-0.6.1/meson.build 
new/lastlog2-0.6.2/meson.build
--- old/lastlog2-0.6.1/meson.build      2023-03-23 14:43:04.000000000 +0100
+++ new/lastlog2-0.6.2/meson.build      2023-03-29 14:37:28.000000000 +0200
@@ -11,7 +11,7 @@
                  'b_pie=true',
                  'warning_level=2',],
   license : ['BSD-2-Clause',],
-  version : '0.6.1',
+  version : '0.6.2',
 )
 
 cc = meson.get_compiler('c')
@@ -22,10 +22,10 @@
                       '-DXTSTRINGDEFINES',
                       '-D_FORTIFY_SOURCE=2',
                        '-D_FILE_OFFSET_BITS=64',
-                       '-D_TIME_BITS=64'], language : 'c')
+                       '-D_TIME_BITS=64',
+                       
'-DPROJECT_VERSION="@0@"'.format(meson.project_version()) ], language : 'c')
 
 possible_cc_flags = [
-                  '-Dwerror=true',
                   '-flto=auto',
                   '-ffat-lto-objects',
                  '-fstack-protector-strong',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lastlog2-0.6.1/src/lastlog2.c 
new/lastlog2-0.6.2/src/lastlog2.c
--- old/lastlog2-0.6.1/src/lastlog2.c   2023-03-23 14:43:04.000000000 +0100
+++ new/lastlog2-0.6.2/src/lastlog2.c   2023-03-29 14:37:28.000000000 +0200
@@ -103,6 +103,7 @@
   fputs ("  -S, --set             Set lastlog record to current time (requires 
-u)\n", output);
   fputs ("  -t, --time DAYS       Print only lastlog records more recent than 
DAYS\n", output);
   fputs ("  -u, --user LOGIN      Print lastlog record of the specified 
LOGIN\n", output);
+  fputs ("  -v, --version         Print version number and exit\n", output);
   fputs ("\n", output);
   exit (retval);
 }
@@ -130,6 +131,7 @@
     {"set",      no_argument,       NULL, 'S'},
     {"time",     required_argument, NULL, 't'},
     {"user",     required_argument, NULL, 'u'},
+    {"version",  no_argument,       NULL, 'v'},
     {NULL, 0, NULL, '\0'}
   };
   char *error = NULL;
@@ -143,7 +145,7 @@
   const char *lastlog_file = NULL;
   int c;
 
-  while ((c = getopt_long (argc, argv, "b:Cd:hi:r:St:u:", longopts, NULL)) != 
-1)
+  while ((c = getopt_long (argc, argv, "b:Cd:hi:r:St:u:v", longopts, NULL)) != 
-1)
     {
       switch (c)
        {
@@ -206,6 +208,10 @@
          uflg = 1;
          user = optarg;
          break;
+       case 'v':
+         printf ("lastlog2 %s\n", PROJECT_VERSION);
+         exit (EXIT_SUCCESS);
+         break;
        default:
          usage (EXIT_FAILURE);
          break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lastlog2-0.6.1/tests/meson.build 
new/lastlog2-0.6.2/tests/meson.build
--- old/lastlog2-0.6.1/tests/meson.build        2023-03-23 14:43:04.000000000 
+0100
+++ new/lastlog2-0.6.2/tests/meson.build        2023-03-29 14:37:28.000000000 
+0200
@@ -37,3 +37,9 @@
                         link_with : liblastlog2)
 test('tst-write-read-user', tst_write_read_user)
 
+tst_y2038_ll2_read_all = executable('tst-y2038-ll2_read_all',
+                        'tst-y2038-ll2_read_all.c',
+                        include_directories : inc,
+                        link_with : liblastlog2)
+test('tst-y2038-ll2_read_all', tst_y2038_ll2_read_all)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lastlog2-0.6.1/tests/tst-y2038-ll2_read_all.c 
new/lastlog2-0.6.2/tests/tst-y2038-ll2_read_all.c
--- old/lastlog2-0.6.1/tests/tst-y2038-ll2_read_all.c   1970-01-01 
01:00:00.000000000 +0100
+++ new/lastlog2-0.6.2/tests/tst-y2038-ll2_read_all.c   2023-03-29 
14:37:28.000000000 +0200
@@ -0,0 +1,121 @@
+/* SPDX-License-Identifier: BSD-2-Clause
+
+  Copyright (c) 2023, Thorsten Kukuk <ku...@suse.com>
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+
+  1. Redistributions of source code must retain the above copyright notice,
+     this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Test case:
+   Create an entry with an 3*INT32_MAX timestamp, store that,
+   read that via ll2_read_all callback again and make sure the
+   timestamp is correct.
+*/
+
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "lastlog2.h"
+
+#define BIG_TIME_VALUE ((int64_t)3*INT32_MAX)
+
+const char *user = "y2038";
+const char *tty = "pts/test";
+const char *rhost = NULL;
+
+static int
+check_y2038 (const char *res_user, time_t ll_time, const char *res_tty,
+            const char *res_rhost)
+{
+
+  if (strcmp (user, res_user) != 0)
+    {
+      fprintf (stderr, "write/read entry user mismatch: written: %s, got: 
%s\n",
+              user, res_user);
+      exit (1);
+    }
+
+  if (ll_time != BIG_TIME_VALUE)
+    {
+      fprintf (stderr, "write/read entry time mismatch: written: %lld, got: 
%lld\n",
+              (long long int)BIG_TIME_VALUE, (long long int)ll_time);
+      exit (1);
+    }
+
+  if (strcmp (tty, res_tty) != 0)
+    {
+      fprintf (stderr, "write/read entry tty mismatch: written: %s, got: %s\n",
+              tty, res_tty);
+      exit (1);
+    }
+
+  if (rhost != NULL)
+    {
+      fprintf (stderr, "write/read entry rhost mismatch: written: NULL, got: 
%s\n",
+              res_rhost);
+      exit (1);
+    }
+
+
+  return 0;
+}
+
+int
+main(void)
+{
+  const char *db_path = "y2038-ll2_read_all.db";
+  char *error = NULL;
+
+  remove (db_path);
+
+  printf ("Big time value is: %lld\n", (long long int)BIG_TIME_VALUE);
+
+  if (ll2_write_entry (db_path, user, BIG_TIME_VALUE, tty, rhost, &error) != 0)
+    {
+      if (error)
+        {
+          fprintf (stderr, "%s\n", error);
+          free (error);
+        }
+      else
+       fprintf (stderr, "ll2_write_entry failed\n");
+      return 1;
+    }
+
+  if (ll2_read_all (db_path, check_y2038, &error) != 0)
+    {
+      if (error)
+        {
+          fprintf (stderr, "%s\n", error);
+          free (error);
+        }
+      else
+        fprintf (stderr, "Couldn't read entries for all users\n");
+
+      return 1;
+    }
+
+  return 0;
+}

Reply via email to