GNU bug report logs - #38632
27.0.50; Emacs process name is changed permanently upon creating a named thread

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> gmail.com>

Date: Mon, 16 Dec 2019 06:45:02 UTC

Severity: normal

Merged with 39003

Found in versions 27.0.50, 27.0.60

Fixed in version 27.1

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


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

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 38632 <at> debbugs.gnu.org, yantar92 <at> gmail.com
Subject: Re: bug#38632: 27.0.50; Emacs process name is changed permanently
 upon creating a named thread
Date: Wed, 18 Dec 2019 18:04:53 +0100
>>>>> On Wed, 18 Dec 2019 17:53:49 +0200, Eli Zaretskii <eliz <at> gnu.org> said:

    Eli> AFAIU, prctl is Linux-specific, whereas pthread_setname_np is
    Eli> supported on other Posix platforms that provide pthreads.  Also, prctl
    Eli> has another disadvantage, in that it requires you to pass the name to
    Eli> the thread being created, or put it in some global.  OTOH, truncating
    Eli> a string is not exactly rocket science, we can do that ourselves
    Eli> before calling the API.

We already use a wrapper function to call the user-supplied function,
so prctl could be added there, but the wider availability of
pthread_setname_np weighs in its favour.

    Eli> (Btw, the limitation is 16 bytes, including the terminating null, so
    Eli> truncation needs to be clever about non-ASCII characters, and I wonder
    Eli> what does prctl do when 15 bytes end in the middle of a multibyte
    Eli> sequence.)

It does exactly what you'd expect, it drops the extraneous bytes, so
putting eg ü on the boundary results in a name ending in à (#xc3).

In any case, if emacs or prctl truncates, then the name as reported
by 'list-threads' will be out of sync with pthread_getname_np, unless
you'd want to adjust that too.

Robert




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

Previous Next


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