Project

General

Profile

Actions

Bug #15178

closed

Wrong paramaters passing to pthread_setname_np(3)

Added by taca (Takahiro Kambe) over 5 years ago. Updated almost 3 years ago.

Status:
Closed
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) over 3 years 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

Actions #2

Updated by jeremyevans (Jeremy Evans) over 3 years 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]

Actions #3

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

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

Updated by nagachika (Tomoyuki Chikanaga) about 3 years ago

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

ruby_2_7 16930b254b4e5397759d6b42845b495041b71321 merged revision(s) be9dbe1c3eb4bb4cab0bdc42a91ef425bb1eaddd.

Updated by usa (Usaku NAKAMURA) almost 3 years ago

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

ruby_2_6 r67923 merged revision(s) be9dbe1c3eb4bb4cab0bdc42a91ef425bb1eaddd.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0