This is an automated email from the git hooks/post-receive script.

guix_mirror_bot pushed a commit to branch core-packages-team
in repository guix.

The following commit(s) were added to refs/heads/core-packages-team by this 
push:
     new b70ba1b36b gnu: gdbm: Add upstream patch for test issues.
b70ba1b36b is described below

commit b70ba1b36b5cfbf5b0044d84abb8aaf67abf44d1
Author: Yelninei <yelni...@tutamail.com>
AuthorDate: Sun May 25 16:43:18 2025 +0000

    gnu: gdbm: Add upstream patch for test issues.
    
    * gnu/packages/patches/gdbm-lockwait-test.patch: New patch.
    * gnu/packages/dbm.scm (gdbm): Add it.
    * gnu/local.mk: Register it.
    
    Change-Id: I991df13d66ad3cf1b567ee3b3d337215c70be2c6
---
 gnu/local.mk                                  |   1 +
 gnu/packages/dbm.scm                          |   4 +-
 gnu/packages/patches/gdbm-lockwait-test.patch | 198 ++++++++++++++++++++++++++
 3 files changed, 202 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index bd17d816de..0d9711b866 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1407,6 +1407,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/gd-brect-bounds.patch                   \
   %D%/packages/patches/gdb-hurd64.patch                                \
   %D%/packages/patches/gdb-16-hurd64.patch                             \
+  %D%/packages/patches/gdbm-lockwait-test.patch                        \
   %D%/packages/patches/gdk-pixbuf-honor-GUIX_GDK_PIXBUF_MODULE_FILES.patch     
\
   %D%/packages/patches/gdm-default-session.patch               \
   %D%/packages/patches/gdm-remove-hardcoded-xwayland-path.patch        \
diff --git a/gnu/packages/dbm.scm b/gnu/packages/dbm.scm
index 883c867dff..f4a0c06857 100644
--- a/gnu/packages/dbm.scm
+++ b/gnu/packages/dbm.scm
@@ -189,7 +189,9 @@ SQL, Key/Value, XML/XQuery or Java Object storage for their 
data model.")
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1v4kycs1n9x0pczm9ny6m16gfgpmj8gwv0bvh7w7gn3fjb2v6bfh"))))
+                "1v4kycs1n9x0pczm9ny6m16gfgpmj8gwv0bvh7w7gn3fjb2v6bfh"))
+              (patches
+               (search-patches "gdbm-lockwait-test.patch"))))
     (arguments `(#:configure-flags '("--enable-libgdbm-compat"
                                      "--disable-static")
                  ,@(if (target-loongarch64?)
diff --git a/gnu/packages/patches/gdbm-lockwait-test.patch 
b/gnu/packages/patches/gdbm-lockwait-test.patch
new file mode 100644
index 0000000000..95c0ffb225
--- /dev/null
+++ b/gnu/packages/patches/gdbm-lockwait-test.patch
@@ -0,0 +1,198 @@
+Taken from
+https://git.savannah.gnu.org/cgit/gdbm.git/commit/?id=5be83b4c5da7c6a68817908b19f8925af09e9b2c
+https://git.savannah.gnu.org/cgit/gdbm.git/commit/?id=6f165a8e1745dbd9b88f6fb6882dff7997cfdf74
+https://git.savannah.gnu.org/cgit/gdbm.git/commit/?id=aa9baca52ad155ae501ba586ff7b08f4b08e5434
+Can be removed with 1.26.
+
+From 5be83b4c5da7c6a68817908b19f8925af09e9b2c Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <g...@gnu.org>
+Date: Thu, 10 Apr 2025 17:31:56 +0300
+Subject: Fix timeout calculation in lockwait signal test.
+
+* tests/t_lockwait.c (runtest_signal): mark start time right
+after setting alarm, not before it.
+---
+ tests/t_lockwait.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/tests/t_lockwait.c b/tests/t_lockwait.c
+index a5e74c8..3547af7 100644
+--- a/tests/t_lockwait.c
++++ b/tests/t_lockwait.c
+@@ -323,9 +323,6 @@ runtest_signal (struct timespec *ts)
+       struct sigaction act;
+       struct timeval now;
+ 
+-      gettimeofday (&now, NULL);
+-      start = tv_to_ms (&now);
+-
+       if (pipe (sig_fd))
+       {
+         perror ("pipe");
+@@ -341,6 +338,8 @@ runtest_signal (struct timespec *ts)
+         return -1;
+       }
+       alarm (ts_to_ms (&ts[1]) / MILLI);
++      gettimeofday (&now, NULL);
++      start = tv_to_ms (&now);
+     }
+ 
+   op.lock_wait = GDBM_LOCKWAIT_SIGNAL;
+-- 
+cgit v1.1
+
+From 6f165a8e1745dbd9b88f6fb6882dff7997cfdf74 Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <g...@gnu.org>
+Date: Thu, 10 Apr 2025 21:07:41 +0300
+Subject: More fixes to lockwait test
+
+* tests/t_lockwait.c (sighan): Close fd.
+(runtest_signal): compensate for alarm(2) second precision
+---
+ tests/t_lockwait.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/t_lockwait.c b/tests/t_lockwait.c
+index 3547af7..b378819 100644
+--- a/tests/t_lockwait.c
++++ b/tests/t_lockwait.c
+@@ -170,6 +170,7 @@ static void
+ sighan (int sig)
+ {
+   write (sig_fd[1], &sig, sizeof (sig));
++  close (sig_fd[1]);
+ }
+ 
+ static int runtest_retry (struct timespec *ts);
+@@ -364,7 +365,8 @@ runtest_signal (struct timespec *ts)
+ 
+       pfd.fd = sig_fd[0];
+       pfd.events = POLLIN;
+-      switch (poll (&pfd, 1, ts_to_ms (&ts[1]) - tv_to_ms (&now) + start)) {
++      switch (poll (&pfd, 1,
++                  ts_to_ms (&ts[1]) - tv_to_ms (&now) + start + MILLI)) {
+       case 1:
+       break;
+ 
+-- 
+cgit v1.1
+
+From aa9baca52ad155ae501ba586ff7b08f4b08e5434 Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <g...@gnu.org>
+Date: Fri, 11 Apr 2025 07:53:58 +0300
+Subject: Adjust timeouts for setitimer interface in lockwait test.
+
+* tests/t_lockwait.c: Setitimer (at least on some systems) restarts
+the timer set by alarm(2). To calculate the ETA of SIGALRM, call
+alarm after gdbm_open_ext returns.
+---
+ tests/t_lockwait.c | 66 ++++++++++++++++++++++++++++++++----------------------
+ 1 file changed, 39 insertions(+), 27 deletions(-)
+
+diff --git a/tests/t_lockwait.c b/tests/t_lockwait.c
+index b378819..dfae838 100644
+--- a/tests/t_lockwait.c
++++ b/tests/t_lockwait.c
+@@ -322,7 +322,6 @@ runtest_signal (struct timespec *ts)
+   if (!(ts[1].tv_sec == 0 && ts[1].tv_nsec == 0))
+     {
+       struct sigaction act;
+-      struct timeval now;
+ 
+       if (pipe (sig_fd))
+       {
+@@ -338,9 +337,6 @@ runtest_signal (struct timespec *ts)
+         fprintf (stderr, "%s: sigaction: %s", progname, strerror (errno));
+         return -1;
+       }
+-      alarm (ts_to_ms (&ts[1]) / MILLI);
+-      gettimeofday (&now, NULL);
+-      start = tv_to_ms (&now);
+     }
+ 
+   op.lock_wait = GDBM_LOCKWAIT_SIGNAL;
+@@ -354,42 +350,58 @@ runtest_signal (struct timespec *ts)
+     }
+   gdbm_close (dbf);
+ 
+-  if (start > 0)
++  if (!(ts[1].tv_sec == 0 && ts[1].tv_nsec == 0))
+     {
+       struct pollfd pfd;
+       struct timeval now;
+-      int sig;
++      int n, t, sig;
+ 
+-    restart:
++      alarm (ts_to_ms (&ts[1]) / MILLI);
+       gettimeofday (&now, NULL);
++      start = tv_to_ms (&now);
+ 
+       pfd.fd = sig_fd[0];
+       pfd.events = POLLIN;
+-      switch (poll (&pfd, 1,
+-                  ts_to_ms (&ts[1]) - tv_to_ms (&now) + start + MILLI)) {
+-      case 1:
+-      break;
+ 
+-      case 0:
+-      fprintf (stderr, "%s: failed waiting for alarm\n", progname);
+-      return 1;
+-
+-      default:
+-      if (errno == EINTR) goto restart;
+-      fprintf (stderr, "%s: poll: %s\n", progname, strerror (errno));
+-      return 1;
+-      }
+-
+-      if (read (sig_fd[0], &sig, sizeof (sig)) != sizeof (sig))
++      do
+       {
+-        fprintf (stderr, "%s: read: %s\n", progname, strerror (errno));
+-        return 1;
++        gettimeofday (&now, NULL);
++        t = ts_to_ms (&ts[1]) - tv_to_ms (&now) + start + MILLI;
++        if (t < 0)
++          {
++            n = 0;
++            break;
++          }
+       }
+-      close (sig_fd[0]);
+-      if (sig != SIGALRM)
++      while ((n = poll (&pfd, 1, t)) == -1 && errno == EINTR);
++
++      switch (n)
+       {
+-        fprintf (stderr, "%s: unexpected data read\n", progname);
++      case 1:
++        if (read (sig_fd[0], &sig, sizeof (sig)) != sizeof (sig))
++          {
++            fprintf (stderr, "%s: read: %s\n", progname, strerror (errno));
++            return 1;
++          }
++        close (sig_fd[0]);
++        if (sig != SIGALRM)
++          {
++            fprintf (stderr, "%s: unexpected data read\n", progname);
++            return 1;
++          }
++        break;
++
++      case 0:
++        fprintf (stderr, "%s: failed waiting for alarm\n", progname);
+         return 1;
++
++      default:
++        if (errno != EINTR)
++          {
++            fprintf (stderr, "%s: poll: %s\n",
++                     progname, strerror (errno));
++            return 1;
++          }
+       }
+     }
+ 
+-- 
+cgit v1.1
+

Reply via email to