Bug #15178
closedWrong paramaters passing to pthread_setname_np(3)
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
Updated by jeremyevans0 (Jeremy Evans) about 4 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
Updated by jeremyevans (Jeremy Evans) about 4 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]
Updated by nagachika (Tomoyuki Chikanaga) about 4 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) almost 4 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) over 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.