Implement SEEK whence support (SEEK_SET, SEEK_CUR, SEEK_END)#195
Merged
toddr merged 1 commit intocpanel:masterfrom Feb 12, 2026
Merged
Implement SEEK whence support (SEEK_SET, SEEK_CUR, SEEK_END)#195toddr merged 1 commit intocpanel:masterfrom
toddr merged 1 commit intocpanel:masterfrom
Conversation
Member
|
Please re-base |
The SEEK tied filehandle method previously died with "Unimplemented" for any whence value other than 0 (SEEK_SET). This implements full whence support: - SEEK_SET (0): seek to absolute position - SEEK_CUR (1): seek relative to current position - SEEK_END (2): seek relative to end of file Returns the new position on success (or "0 but true" for position 0), and 0 on failure (out of bounds). Invalid whence values die. Adds comprehensive tests in t/seek.t covering all whence modes, edge cases (empty files, seek after write, invalid whence), and extends t/sysopen.t with parallel real/mock sysseek tests. Fixes cpanel#77 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
Rebase: Implement SEEK whence support (SEEK_SET, SEEK_CUR, SEEK_END)Branch Actions
Automated by Kōan |
f31ba77 to
ecd1dcf
Compare
atoomic
approved these changes
Feb 11, 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
The
SEEKtied filehandle method previously died with "Unimplemented" for any$whencevalue other than 0. This implements full whence support:Returns the new position on success (or
"0 but true"for position 0), and0on failure (out of bounds). Invalid whence values die.Fixes #77
Changes
lib/Test/MockFile/FileHandle.pm: Replace stub SEEK with full whence implementationt/seek.t: New comprehensive test file (30+ tests) covering all whence modes, edge cases (empty files, seek after write, invalid whence), and bothseek()andsysseek()builtinst/sysopen.t: Extended with parallel real/mocksysseektests for SEEK_CUR and SEEK_ENDTest plan
t/seek.texercises all three whence modest/sysopen.tverifies mock behavior matches real filehandle behavior🤖 Generated with Claude Code