Project

General

Profile

Bug #15178

Wrong paramaters passing to pthread_setname_np(3)

Added by taca (Takahiro Kambe) almost 2 years ago. Updated 20 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-dev:50643]
Tags:

Description

Ruby 2.6.0-preview2の動作を調べている途中で見つけました。

[Bug #9586]の修正r45713で、NetBSDの場合のpthread_setname_np(3)の引数を修正しています。
ここは第2引数と第3引数を入れ替えるのではなく、単に二重引用符を適切にquoteするだけとすべき
だったのではないでしょうか。

また、実際にthread_pthread.cでSET_CURRENT_THREAD_NAMEを介してpthread_setname_np(3)が
呼び出される状況を理解していないのですが、指定する名前はPTHREAD_MAX_NAMELEN_NPを超える
ことはないと思って良いのでしょうか。(PTHREAD_MAX_NAMELEN_NPの値は32です。)


Files

configure.ac.diff (645 Bytes) configure.ac.diff ptherad_setname_np()の引数を修正 taca (Takahiro Kambe), 09/29/2018 03:24 PM

Updated by jeremyevans0 (Jeremy Evans) 21 days ago

I agree with your analysis. Looking at the NetBSD man page for pthread_setname_np (https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current), the format string is clearly the 2nd argument and not the third. The only reason this hasn't caused problems is that few thread names are going to use printf(3) format specifiers. I've added a pull request to fix this: https://github.com/ruby/ruby/pull/3492

#2

Updated by jeremyevans (Jeremy Evans) 21 days ago

  • Status changed from Open to Closed

Applied in changeset git|be9dbe1c3eb4bb4cab0bdc42a91ef425bb1eaddd.


Fix pthread_setname_np arguments on NetBSD

The previous attempt to fix this in
b87df1bf243074edb2e6cc8a24bc00df81cebf3c reversed the argument
order instead of just fixing the quote escaping.

From Takahiro Kambe.

Fixes [Bug #15178]

#3

Updated by nagachika (Tomoyuki Chikanaga) 20 days ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.5: UNKNOWN, 2.6: REQUIRED, 2.7: REQUIRED

Also available in: Atom PDF