GNU bug report logs - #39363
emacs-git version: pthread_setname_np on NetBSD

Previous Next

Package: emacs;

Reported by: Thomas Klausner <wiz <at> NetBSD.org>

Date: Thu, 30 Jan 2020 23:03:02 UTC

Severity: normal

Fixed in version 27.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39363 in the body.
You can then email your comments to 39363 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39363; Package emacs. (Thu, 30 Jan 2020 23:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thomas Klausner <wiz <at> NetBSD.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 30 Jan 2020 23:03:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thomas Klausner <wiz <at> NetBSD.org>
To: bug-gnu-emacs <at> gnu.org
Subject: emacs-git version: pthread_setname_np on NetBSD
Date: Fri, 31 Jan 2020 00:02:13 +0100
[Message part 1 (text/plain, inline)]
Hi!

Recently, emacs from git stopped compiling on NetBSD because it
started using pthread_setname_np. AFAIK, there is no commonly agreed
upon standard for this function, and NetBSD's uses three arguments, see
https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current

The attached patch makes emacs compile again (on NetBSD-9.99.43/amd64)
but configure should probably be taught to look for that version of
pthread_setname_np instead of the #ifdef __NetBSD__.

Thanks,
 Thomas
[patch-src_systhread.c (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39363; Package emacs. (Fri, 31 Jan 2020 07:49:01 GMT) Full text and rfc822 format available.

Message #8 received at 39363 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Thomas Klausner <wiz <at> NetBSD.org>
Cc: 39363 <at> debbugs.gnu.org
Subject: Re: bug#39363: emacs-git version: pthread_setname_np on NetBSD
Date: Fri, 31 Jan 2020 09:48:13 +0200
> Date: Fri, 31 Jan 2020 00:02:13 +0100
> From: Thomas Klausner <wiz <at> NetBSD.org>
> 
> Recently, emacs from git stopped compiling on NetBSD because it
> started using pthread_setname_np. AFAIK, there is no commonly agreed
> upon standard for this function, and NetBSD's uses three arguments, see
> https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current
> 
> The attached patch makes emacs compile again (on NetBSD-9.99.43/amd64)
> but configure should probably be taught to look for that version of
> pthread_setname_np instead of the #ifdef __NetBSD__.

I think we want instead to modify the configure-time test to include
the possibility of 3-argument pthread_setname_np.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39363; Package emacs. (Fri, 31 Jan 2020 09:04:02 GMT) Full text and rfc822 format available.

Message #11 received at 39363 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39363 <at> debbugs.gnu.org, Thomas Klausner <wiz <at> NetBSD.org>
Subject: Re: bug#39363: emacs-git version: pthread_setname_np on NetBSD
Date: Fri, 31 Jan 2020 10:02:50 +0100
>>>>> On Fri, 31 Jan 2020 09:48:13 +0200, Eli Zaretskii <eliz <at> gnu.org> said:

    >> Date: Fri, 31 Jan 2020 00:02:13 +0100
    >> From: Thomas Klausner <wiz <at> NetBSD.org>
    >> 
    >> Recently, emacs from git stopped compiling on NetBSD because it
    >> started using pthread_setname_np. AFAIK, there is no commonly agreed
    >> upon standard for this function, and NetBSD's uses three arguments, see
    >> https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current
    >> 
    >> The attached patch makes emacs compile again (on NetBSD-9.99.43/amd64)
    >> but configure should probably be taught to look for that version of
    >> pthread_setname_np instead of the #ifdef __NetBSD__.

    Eli> I think we want instead to modify the configure-time test to include
    Eli> the possibility of 3-argument pthread_setname_np.

Untested patch (I donʼt have any NetBSD machines).

diff --git a/configure.ac b/configure.ac
index f604acb694..1d922d9c02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4192,6 +4192,21 @@ AC_DEFUN
     AC_DEFINE(
       HAVE_PTHREAD_SETNAME_NP_1ARG, 1,
       [Define to 1 if pthread_setname_np takes a single argument.])
+  else
+    AC_CACHE_CHECK(
+     [whether pthread_setname_np takes three arguments],
+     [emacs_cv_pthread_setname_np_3arg],
+     [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+         [[#include <pthread.h>]],
+         [[pthread_setname_np (0, "%s", "a");]])],
+       [emacs_cv_pthread_setname_np_3arg=yes],
+       [emacs_cv_pthread_setname_np_3arg=no])])
+     if test "$emacs_cv_pthread_setname_np_3arg" = "yes"; then
+       AC_DEFINE(
+         HAVE_PTHREAD_SETNAME_NP_3ARG, 1,
+         [Define to 1 if pthread_setname_np takes three arguments.])
+     fi
   fi
 fi
 
diff --git a/src/systhread.c b/src/systhread.c
index c649ae853a..0d600d6895 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -214,11 +214,13 @@ #define TASK_COMM_LEN 16
   char p_name[TASK_COMM_LEN];
   strncpy (p_name, name, TASK_COMM_LEN - 1);
   p_name[TASK_COMM_LEN - 1] = '\0';
- #ifdef HAVE_PTHREAD_SETNAME_NP_1ARG
+# ifdef HAVE_PTHREAD_SETNAME_NP_1ARG
   pthread_setname_np (p_name);
- #else
+# elif defined HAVE_PTHREAD_SETNAME_NP_3ARG
+  pthread_setname_np (pthread_self (), "%s", p_name);
+# else
   pthread_setname_np (pthread_self (), p_name);
- #endif
+# endif
 #endif
 }
 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39363; Package emacs. (Fri, 31 Jan 2020 17:10:02 GMT) Full text and rfc822 format available.

Message #14 received at 39363 <at> debbugs.gnu.org (full text, mbox):

From: Thomas Klausner <wiz <at> NetBSD.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 39363 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#39363: emacs-git version: pthread_setname_np on NetBSD
Date: Fri, 31 Jan 2020 18:09:57 +0100
On Fri, Jan 31, 2020 at 10:02:50AM +0100, Robert Pluim wrote:
>     Eli> I think we want instead to modify the configure-time test to include
>     Eli> the possibility of 3-argument pthread_setname_np.
> 
> Untested patch (I donʼt have any NetBSD machines).

Works for me. Thank you!
 Thomas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39363; Package emacs. (Mon, 03 Feb 2020 11:38:02 GMT) Full text and rfc822 format available.

Message #17 received at 39363 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Thomas Klausner <wiz <at> NetBSD.org>
Cc: 39363 <at> debbugs.gnu.org
Subject: Re: bug#39363: emacs-git version: pthread_setname_np on NetBSD
Date: Mon, 03 Feb 2020 12:37:02 +0100
>>>>> On Mon, 03 Feb 2020 10:38:38 +0100, Robert Pluim <rpluim <at> gmail.com> said:

>>>>> On Fri, 31 Jan 2020 18:09:57 +0100, Thomas Klausner <wiz <at> NetBSD.org> said:
    Thomas> On Fri, Jan 31, 2020 at 10:02:50AM +0100, Robert Pluim wrote:
    Eli> I think we want instead to modify the configure-time test to include
    Eli> the possibility of 3-argument pthread_setname_np.
    >>> 
    >>> Untested patch (I donʼt have any NetBSD machines).

    Thomas> Works for me. Thank you!

Thanks for testing. Eli, emacs-27 I presume?

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39363; Package emacs. (Mon, 03 Feb 2020 15:36:02 GMT) Full text and rfc822 format available.

Message #20 received at 39363 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 39363 <at> debbugs.gnu.org, wiz <at> NetBSD.org
Subject: Re: bug#39363: emacs-git version: pthread_setname_np on NetBSD
Date: Mon, 03 Feb 2020 17:35:18 +0200
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Mon, 03 Feb 2020 12:37:02 +0100
> Cc: 39363 <at> debbugs.gnu.org
> 
>     >>> Untested patch (I donʼt have any NetBSD machines).
> 
>     Thomas> Works for me. Thank you!
> 
> Thanks for testing. Eli, emacs-27 I presume?

Yes, thanks.




Reply sent to Robert Pluim <rpluim <at> gmail.com>:
You have taken responsibility. (Mon, 03 Feb 2020 15:42:02 GMT) Full text and rfc822 format available.

Notification sent to Thomas Klausner <wiz <at> NetBSD.org>:
bug acknowledged by developer. (Mon, 03 Feb 2020 15:42:02 GMT) Full text and rfc822 format available.

Message #25 received at 39363-done <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39363-done <at> debbugs.gnu.org, wiz <at> NetBSD.org
Subject: Re: bug#39363: emacs-git version: pthread_setname_np on NetBSD
Date: Mon, 03 Feb 2020 16:41:42 +0100
>>>>> On Mon, 03 Feb 2020 17:35:18 +0200, Eli Zaretskii <eliz <at> gnu.org> said:

    >> From: Robert Pluim <rpluim <at> gmail.com>
    >> Date: Mon, 03 Feb 2020 12:37:02 +0100
    >> Cc: 39363 <at> debbugs.gnu.org
    >> 
    >> >>> Untested patch (I donʼt have any NetBSD machines).
    >> 
    Thomas> Works for me. Thank you!
    >> 
    >> Thanks for testing. Eli, emacs-27 I presume?

    Eli> Yes, thanks.

Done. Closing bug.

Robert




bug Marked as fixed in versions 27.1. Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 04 Feb 2020 07:56:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 03 Mar 2020 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.