fix: accept both EINVAL and ENOENT for readlink(undef)#205
Open
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Open
fix: accept both EINVAL and ENOENT for readlink(undef)#205Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Conversation
The errno set by readlink(undef) varies by OS and version: - FreeBSD 14+ returns EINVAL - FreeBSD 12 and Linux return ENOENT The test was using $^O eq 'freebsd' to decide which errno to expect, but this fails on older FreeBSD versions. Accept both values instead. Fixes cpanel#175 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6338454 to
2dbc08f
Compare
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
EINVALandENOENTforreadlink(undef)andreadlink()in tests$^O eq 'freebsd'check that didn't account for FreeBSD version differencesProblem
The test assumed
readlink(undef)returnsEINVALon FreeBSD andENOENTon everything else. But the errno depends on the OS version, not just the OS:EINVAL(22)ENOENT(2)ENOENT(2)This caused test failures on FreeBSD 12 smokers (as reported by @eserte in #63).
Fix
Replace the
$^O-based branching with a simpleok($! == EINVAL || $! == ENOENT, ...)check. Applied to all 4 occurrences (REAL MODE and MOCK MODE, bothreadlink(undef)andreadlink()).Test plan
readlink(undef/empty)errno checks now accept both valuesFixes #175
🤖 Generated with Claude Code