[BUG] Segfault on macOS 26 when built with the macOS 27 SDK (pipe2 is weak-linked and NULL)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #2751 của @sohailshk — đã đóng, không merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 32/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c, cmake, macos
- Lĩnh vực
- build-system
Hướng nghiên cứu
Read the pipe2 call at line 55 of src/common/impl/processing_linux.c alongside the check_function_exists(pipe2) probe in the CMake files, which links strongly against the SDK stub and ignores the macos(27.0) availability marking. src/detection/swap/swap_apple.c already shows the __builtin_available pattern if option B is chosen. Done is a clean build with no -Wunguarded-availability-new warning, ./build/fastfetch and --format json exiting 0, and nm -m no longer showing a weak _pipe2. Note PR #2751 is already open, so coordinate before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
fastfetch segfaults on macOS 26.6.2 (arm64) when built from source with the macOS 27.0 SDK and the default deployment target (26.0). Every module that spawns a process crashes, including the default run and --format json. The crash is at address 0.
The cause is availability, not the check itself. CMake's check_function_exists(pipe2) compiles its own declaration and links it strongly, so it passes because the 27.0 SDK's libSystem stub exports _pipe2. FF_HAVE_PIPE2 is then defined and ffPipe2() calls pipe2(). The macos(27.0) availability marking on pipe2 in the SDK's unistd.h makes that call a weak import when the deployment target is 26.0. On macOS 26 the symbol is not there, so the pointer is NULL and the call jumps to address 0.
The compiler already reports this in the build log (fastfetch dev e09925d3, macOS 27.0 SDK, deployment target 26.0; the source path is shortened):
src/common/impl/processing_linux.c:55:9: warning: 'pipe2' is only available on macOS 27.0 or newer [-Wunguarded-availability-new]
55 | if (pipe2(fds, flags) == -1) {
| ^~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/unistd.h:219:9: note: 'pipe2' has been marked as being introduced in macOS 27.0 here, but the deployment target is macOS 26.0.0
219 | int pipe2(int [2], int);
| ^
src/common/impl/processing_linux.c:55:9: note: enclose 'pipe2' in a __builtin_available check to silence this warning
55 | if (pipe2(fds, flags) == -1) {
| ^~~~~
Reproduce
cmake -B build -DBUILD_TESTS=On && cmake --build build -j4on macOS 26.6.2 with the macOS 27.0 SDK. The build prints the warning above../build/fastfetchor./build/fastfetch --format json(exit status 139).grep HAVE_PIPE2 build/CMakeCache.txtshowsHAVE_PIPE2:INTERNAL=1.
Expected: exit status 0, output as usual.
Actual: SIGSEGV, KERN_INVALID_ADDRESS at 0x0, in ffProcessSpawn called from ffDetectShell.
Checks on the same machine
dlsym(RTLD_DEFAULT, "pipe2")returns NULL;dlsym(RTLD_DEFAULT, "pipe")does not.nm -m build/fastfetchshows(undefined) weak external _pipe2 (from libSystem).- With
-DHAVE_PIPE2=OFF, the same build exits 0 for the default run,--format jsonand the Shell and Terminal modules.
Possible fixes (maintainer's choice)
- A: skip the
pipe2check on Apple platforms and use the existingpipe()+fcntl()fallback. This is the one-line change in the PR. - B: keep
pipe2and guard the call with__builtin_available(macOS 27.0, *), as the compiler suggests. This keeps the single syscall on macOS 27+. The repo already uses this pattern insrc/detection/swap/swap_apple.c(__builtin_available(macOS 26.0, *)).
Impact on releases
The 2.71.0 release binary is not affected today: its macOS asset was built with the 26.5 SDK and imports _pipe only. The release build uses the default deployment target, so if the release runner's default SDK becomes 27.0, the published binary would crash on every macOS 26 system.
Version used: fastfetch dev e09925d3 (built from source; not a release binary).
Bug prevalence: Always (on this setup). Regression: Not sure (it depends on the SDK used to build).
Installation: Built from source.
A tested fix is ready (option A) and a PR follows once you choose an option.
- Ngôn ngữ chính
- C
- Star
- 25.5k
- Fork
- 965
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 25
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fastfetch-cli/fastfetch
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fastfetch-cli/fastfetch#2780 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[LOGO] B1ackOSĐang mởlogo request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fastfetch-cli/fastfetch#2773 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[LOGO] Kedi GNU/LinuxCó thể đã có người làm @avfx5 đã nhận 5 ngày trước. Đang mởlogo request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fastfetch-cli/fastfetch#2755 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[LOGO] AuxoĐang mởlogo request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
fastfetch-cli/fastfetch#2754 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[LOGO] VentoOSCó thể đã có người làm @Goldloli đã nhận 9 ngày trước. Đang mởlogo request
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
fastfetch-cli/fastfetch#2742 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fastfetch-cli/fastfetch
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
elliotchance/vsql#2079 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[libcbor] update to 0.15.1Đang mởcategory:port-update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 2 ngày
-
docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
meshcore-dev/MeshCore#4015 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
Maintainer thường phản hồi trong vòng 13 ngày