Clarify process.report glibcVersionRuntime semantics for statically linked glibc builds
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.4k
- 平均マージ
- 4日 3時間
- マージ済み PR(30日)
- 272
説明
What is the issue?
process.report.getReport().header.glibcVersionRuntime can be absent in a Node.js binary that appears to be statically linked against glibc.
That may be intentional, but the current documentation does not appear to define the presence semantics of glibcVersionRuntime, especially for statically linked glibc builds. This makes it easy for ecosystem code to interpret an absent glibcVersionRuntime as "not glibc" or "musl", even when glibcVersionCompiler is present.
Reproduction
Using Node.js v22.21.1:
$ file "$(command -v node)"
/usr/bin/node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 4.19.0, stripped
$ ldd --version | head -n 1
ldd (GNU libc) 2.39
$ node -p "JSON.stringify({
node: process.version,
execPath: process.execPath,
glibcVersionCompiler: process.report.getReport().header.glibcVersionCompiler,
glibcVersionRuntime: process.report.getReport().header.glibcVersionRuntime,
node_target_type: process.config.variables.node_target_type,
node_shared: process.config.variables.node_shared
}, null, 2)"
{
"node": "v22.21.1",
"execPath": "/usr/bin/node",
"glibcVersionCompiler": "2.39",
"node_target_type": "static_library",
"node_shared": false
}
glibcVersionRuntime is omitted from the report object.
Why this is unclear
The diagnostic report documentation shows both fields in the example report:
"glibcVersionRuntime": "2.17",
"glibcVersionCompiler": "2.17"
The report documentation also says the report version is bumped when a key is added or removed, or when a value type changes.
However, I could not find documentation stating whether glibcVersionRuntime is guaranteed to be present on Linux glibc builds, whether it may be omitted, or whether it is expected to be omitted for statically linked glibc builds.
The implementation appears to emit glibcVersionRuntime only when dlsym(RTLD_DEFAULT, "gnu_get_libc_version") succeeds, while glibcVersionCompiler is emitted under __GLIBC__.
Expected documentation / clarification
It would be useful for the documentation to clarify one of the following:
glibcVersionRuntimeis optional and may be absent when the runtime glibc version cannot be dynamically queried, including statically linked glibc builds; orglibcVersionRuntimeshould be present for statically linked glibc builds, and its absence is a bug; or- consumers should not use absence of
glibcVersionRuntimeas evidence that the runtime is musl or non-glibc.
I am not asserting that the current runtime behavior is necessarily wrong. The issue is that the field's absence is observable, but the documented contract does not appear to define what that absence means.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
診断レポートのドキュメントと、issue で説明されている process.report.getReport().header フィールドから始めます。glibc が静的リンクされている場合に glibcVersionRuntime が存在しないことがあり得るか、またその不在が musl の証拠ではないことを明確にします。ドキュメントで既存の例と併せてその存在の意味を定義すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, linux, node.js
- 領域
- documentation, operating-systems
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 68/100