nodejs / nodejs/node

Clarify process.report glibcVersionRuntime semantics for statically linked glibc builds

Đang mở Phù hợp với người mới
#63,481 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.4k
Merge trung bình
4 ngày 3 giờ
Pull request đã merge (30 ngày)
272

Mô tả

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:

  1. glibcVersionRuntime is optional and may be absent when the runtime glibc version cannot be dynamically queried, including statically linked glibc builds; or
  2. glibcVersionRuntime should be present for statically linked glibc builds, and its absence is a bug; or
  3. consumers should not use absence of glibcVersionRuntime as 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với tài liệu về báo cáo chẩn đoán và các trường process.report.getReport().header được mô tả trong issue. Làm rõ liệu glibcVersionRuntime có thể vắng mặt khi glibc được liên kết tĩnh hay không, và rằng sự vắng mặt đó không phải là bằng chứng về musl; hoàn thành khi tài liệu định nghĩa ngữ nghĩa về sự hiện diện của nó cùng với ví dụ hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, linux, node.js
Lĩnh vực
documentation, operating-systems
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
68/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.