guix/gnu/packages/patches/glibc-hurd-pthread_setcancelstate.patch
Janneke Nieuwenhuizen a9005279d0
gnu: glibc/hurd: Add patches for the 64bit Hurd.
These patches fix:

  * Statically linked tar to hang/segfault upon issuing the "--mtime=@1"
  warning; this is also applicable for the 32bit Hurd using glibc-2.39!

See <https://lists.gnu.org/archive/html/bug-hurd/2024-11/msg00115.html>.

  * Shell replacement problems for the 64bit Hurd.

See <https://lists.debian.org/debian-hurd/2024/07/msg00063.html>.

  * Findutil's gnulib-tests/test-sigaction failure.

* gnu/packages/patches/glibc-hurd-pthread_setcancelstate.patch,
gnu/packages/patches/glibc-hurd64-fault.patch,
gnu/packages/patches/glibc-hurd64-intr-msg-clobber.patch,
gnu/packages/patches/glibc-hurd64-sgms-context.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register them.
* gnu/packages/base.scm (glibc/hurd): Use them.

Change-Id: I9ee65983876cd22ad1dc01aabb41a34074631599
2024-12-03 08:33:13 +01:00

92 lines
3.3 KiB
Diff

Upstream-status: Taken from <https://salsa.debian.org/glibc-team/glibc/-/blob/25a0a47767fe7dc5151eb36afaade17218728efe/debian/patches/hurd-i386/local-static_pthread_setcancelstate.diff>.
This is needed for the 64bit Hurd statically linked tar non to hang when
issuing a warning.
since the move of libpthread functions to libc, glibc dropped the use
of __libc_ptf_call. But htl hasn't made the move yet, so we have to use
__libc_ptf_call there for now.
Index: glibc-2.36/misc/error.c
===================================================================
--- glibc-2.36.orig/misc/error.c
+++ glibc-2.36/misc/error.c
@@ -240,7 +240,8 @@ __error_internal (int status, int errnum
/* We do not want this call to be cut short by a thread
cancellation. Therefore disable cancellation for now. */
int state = PTHREAD_CANCEL_ENABLE;
- __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
+ __libc_ptf_call (__pthread_setcancelstate,
+ (PTHREAD_CANCEL_DISABLE, &state), 0);
#endif
flush_stdout ();
@@ -262,7 +263,7 @@ __error_internal (int status, int errnum
#ifdef _LIBC
_IO_funlockfile (stderr);
- __pthread_setcancelstate (state, NULL);
+ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
#endif
}
@@ -306,7 +307,9 @@ __error_at_line_internal (int status, in
/* We do not want this call to be cut short by a thread
cancellation. Therefore disable cancellation for now. */
int state = PTHREAD_CANCEL_ENABLE;
- __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
+ __libc_ptf_call (__pthread_setcancelstate,
+ (PTHREAD_CANCEL_DISABLE, &state),
+ 0);
#endif
flush_stdout ();
@@ -336,7 +339,7 @@ __error_at_line_internal (int status, in
#ifdef _LIBC
_IO_funlockfile (stderr);
- __pthread_setcancelstate (state, NULL);
+ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
#endif
}
Index: glibc-2.36/libio/iopopen.c
===================================================================
--- glibc-2.36.orig/libio/iopopen.c
+++ glibc-2.36/libio/iopopen.c
@@ -281,9 +281,10 @@ _IO_new_proc_close (FILE *fp)
do
{
int state;
- __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
+ __libc_ptf_call (__pthread_setcancelstate,
+ (PTHREAD_CANCEL_DISABLE, &state), 0);
wait_pid = __waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0);
- __pthread_setcancelstate (state, NULL);
+ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
}
while (wait_pid == -1 && errno == EINTR);
if (wait_pid == -1)
Index: glibc-2.36/stdlib/fmtmsg.c
===================================================================
--- glibc-2.36.orig/stdlib/fmtmsg.c
+++ glibc-2.36/stdlib/fmtmsg.c
@@ -124,7 +124,8 @@ fmtmsg (long int classification, const c
/* We do not want this call to be cut short by a thread
cancellation. Therefore disable cancellation for now. */
int state = PTHREAD_CANCEL_ENABLE;
- __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
+ __libc_ptf_call (__pthread_setcancelstate,
+ (PTHREAD_CANCEL_DISABLE, &state), 0);
__libc_lock_lock (lock);
@@ -193,7 +194,7 @@ fmtmsg (long int classification, const c
__libc_lock_unlock (lock);
- __pthread_setcancelstate (state, NULL);
+ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
return result;
}