fix: open on broken symlink returns ELOOP instead of confess#216
Open
Koan-Bot wants to merge 2 commits intocpanel:masterfrom
Open
fix: open on broken symlink returns ELOOP instead of confess#216Koan-Bot wants to merge 2 commits intocpanel:masterfrom
Koan-Bot wants to merge 2 commits intocpanel:masterfrom
Conversation
Contributor
|
View failure from CI |
Contributor
|
@Koan-Bot rebase |
Contributor
Author
CI fix — force-pushed 4ae8b6bRoot cause: Both tests had swapped
Fixes:
|
Two bugs fixed: 1. __open: opening a broken or circular symlink caused confess() (die with stack trace) instead of returning false with $!=ELOOP, which is what real open() does. 2. __sysopen: O_NOFOLLOW on a symlink used hardcoded $!=40 instead of the portable ELOOP constant from Errno. On macOS, errno 40 is EMSGSIZE (message too long), not ELOOP. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix swapped symlink() constructor args in both t/open.t and t/sysopen.t (readlink, path) — was causing confess on double-mock - Use ENOENT (not ELOOP) for broken symlinks in __open — matches real kernel behavior (ELOOP is only for circular symlinks) - Create proper broken symlink by omitting target mock entirely Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4ae8b6b to
054a33f
Compare
atoomic
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
open()on a broken/circular symlink now returns false with$! = ELOOPinstead of dying viaconfess()sysopen()withO_NOFOLLOWon a symlink now uses portableELOOPconstant instead of hardcoded$! = 40(which isEMSGSIZEon macOS, notELOOP)What changed
__open: The broken symlink check (confess() if $abs_path eq BROKEN_SYMLINK) was a fatal error with no message. Realopen()on a broken symlink returns false and sets$!toELOOP. Now handles bothBROKEN_SYMLINKandCIRCULAR_SYMLINKcorrectly.__sysopen: TheO_NOFOLLOWhandler used$! = 40— a hardcoded errno value that only maps toELOOPon Linux. On macOS/FreeBSD, errno 40 isEMSGSIZE. Now uses theELOOPconstant fromErrno(already imported).Test plan
t/open.t: opens a broken symlink, verifies returns false with$! == ELOOPt/sysopen.t: sysopen withO_NOFOLLOWon a symlink, verifies returns false with$! == ELOOP🤖 Generated with Claude Code