public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/26402] New: pthread_setname_np should truncate instead of bail out
@ 2020-08-18 15:23 trass3r at gmail dot com
  2020-08-21 14:56 ` [Bug libc/26402] " trass3r at gmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: trass3r at gmail dot com @ 2020-08-18 15:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26402

            Bug ID: 26402
           Summary: pthread_setname_np should truncate instead of bail out
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: trass3r at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

IMHO pthread_setname_np should truncate instead of bail out, i.e. do
size_t name_len = min(strlen(name), TASK_COMM_LEN);
@
https://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/pthread_setname.c.html#39

Especially in cross-platform code you may have thread names longer than
TASK_COMM_LEN and a truncated name is more useful when debugging than an unset
one.

The function can still return ERANGE in the end.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libc/26402] pthread_setname_np should truncate instead of bail out
  2020-08-18 15:23 [Bug libc/26402] New: pthread_setname_np should truncate instead of bail out trass3r at gmail dot com
@ 2020-08-21 14:56 ` trass3r at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: trass3r at gmail dot com @ 2020-08-21 14:56 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26402

--- Comment #1 from trass3r <trass3r at gmail dot com> ---
In fact both PR_SET_NAME and writing to /proc/self/task/%u/comm automatically
truncate.
https://man7.org/linux/man-pages/man2/prctl.2.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-21 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 15:23 [Bug libc/26402] New: pthread_setname_np should truncate instead of bail out trass3r at gmail dot com
2020-08-21 14:56 ` [Bug libc/26402] " trass3r at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).