[BUG] Rust: libc::PTHREAD_MUTEX_INITIALIZER is incorrect
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
調査の方向性
Compare Rust libc's definition in src/unix/nuttx/mod.rs with NuttX's PTHREAD_MUTEX_INITIALIZER in include/pthread.h and NXSEM_NO_MHOLDER in include/nuttx/semaphore.h. Then inspect Rust std's use in library/std/src/sys/pal/unix/sync/mutex.rs. Done means an agreed approach produces a valid mutex initializer across the relevant NuttX configurations.
索引モデルが issue の本文から書いたものです。
説明
Description / Steps to reproduce the issue
Rust libc initializes PTHREAD_MUTEX_INITIALIZER to 0: https://github.com/rust-lang/libc/blob/c2744242b816317ea8b5c8e306eb829c080cb2b9/src/unix/nuttx/mod.rs#L310
But in NuttX this is generally not 0.
For example, defined here: https://github.com/apache/nuttx/blob/master/include/pthread.h#L359
Going into https://github.com/apache/nuttx/blob/master/include/pthread.h#L353
Which makes use of NXSEM_NO_MHOLDER, defined here: https://github.com/apache/nuttx/blob/master/include/nuttx/semaphore.h#L70
Furthermore, the initialization also depends on the configuration.
In Rust, std makes use of the constant to init mutexes, e.g. here: https://github.com/rust-lang/rust/blob/7d2cd0fbc092625ea371da704f15f80216d2220e/library/std/src/sys/pal/unix/sync/mutex.rs#L12
I'm not sure what the best solution is, I see some options:
- remove the symbol definition from Rust (and update std to use
pthread_mutex_initinstead) - init the Rust definition to a matching value and either require a certain config or make sure the position of the non-zero values is independent from the config
- update NuttX so the definition is always 0 (in addition to requiring a specific config)
On which OS does this issue occur?
[OS: Linux], [OS: BSD], [OS: Mac], [OS: Windows]
What is the version of your OS?
Irrelevant
NuttX Version
master
Issue Architecture
[Arch: all]
Issue Area
[Area: Posix], [Area: Applications]
Host information
No response
Verification
- I have verified before submitting the report.
- 主要言語
- C
- スター
- 4.1k
- フォーク
- 1.8k
- 平均マージ
- 1日 5時間
- マージ済み PR(30日)
- 841
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/nuttx のほかの issue
-
Arch: all Arch: arm Area: Build system OS: Linux Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/nuttx#19435 · コメント 9 件 ·
メンテナーはふだん 1 日以内に返信
-
Arch: all OS: Linux Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/nuttx#16249 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
-
Type: Enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
メンテナーはふだん 1 日以内に返信
-
Arch: simulator Arch: xtensa Area: Kernel OS: Mac Type: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
apache/nuttx#21499 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area: test kind: bug preview-effort: small priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
libsdl-org/SDL#16684 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
Issue-Bug Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信