-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Make SubReadStream seekable when underlying stream is seekable #118720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: rzikm <[email protected]>
@copilot There seem to be test failures. Fix them please. Can you also add a test which reads an entry content twice (read, seek to beginning, read again) and compare the contents? For both Seek method and the Position setter. |
…try content twice Co-authored-by: rzikm <[email protected]>
I've fixed the test failures and added the requested test. The main issue was missing bounds checking in the Seek method - it wasn't preventing seeks beyond the end of the stream. Changes made:
All 1333 tests now pass with no failures. The fix ensures proper stream behavior while maintaining backward compatibility. Commit: a6c91cf |
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_ReadTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please address further comments
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_ReadTests.cs
Outdated
Show resolved
Hide resolved
…ctor test Co-authored-by: rzikm <[email protected]>
Co-authored-by: rzikm <[email protected]>
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs
Outdated
Show resolved
Hide resolved
Hey @copilot, please update this PR to address all open conversations and implement the pending suggestions. Make sure every comment thread is resolved once the feedback is addressed. |
Co-authored-by: alinpahontu2912 <[email protected]>
Addressed all open conversations in e525dfb. The SubReadStream seek operations now have immediate observable effects by calling |
Co-authored-by: Copilot <[email protected]>
Hey @copilot, revert the changes from the last commit |
Co-authored-by: alinpahontu2912 <[email protected]>
Reverted the changes from the last commit (e525dfb) that added immediate observable effects to the SubReadStream seek operations. The Position setter and Seek method no longer call Commit: b559fc0 |
- Reverted the problematic helper method from dfd29b2 that replaced reflection in tests - Restored the e525dfb changes that make SubReadStream seek operations have immediate observable effects - Position setter and Seek method now call _superStream.Seek() immediately rather than deferring - All 1335 tests pass Co-authored-by: alinpahontu2912 <[email protected]>
Reverted the changes from commit dfd29b2 (which replaced reflection with a problematic helper method) and restored the useful changes from commit e525dfb (immediate observable effects for SubReadStream seek operations). The Position setter and Seek method now call _superStream.Seek() immediately rather than deferring the operation. All 1335 tests pass. Commit: 9d563a7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but this will need at least one other review as I was the one to initiate this PR
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs
Outdated
Show resolved
Hide resolved
Hey @copilot address the last reviews |
Co-authored-by: alinpahontu2912 <[email protected]>
Addressed all review feedback in 2cfd808. The Position setter now uses direct position assignment instead of Seek(), and the Seek method now honors the return value from the underlying stream's Seek operation. All 1519 tests pass. |
The SubReadStream now properly supports seeking when the underlying stream is seekable, with immediate observable effects for seek operations. Changes to address feedback:
_superStream.Position
instead of_superStream.Seek()
to maintain semantic difference_superStream.Seek()
to handle partial seeks correctlyAll 1335 System.IO.Compression tests and 184 ZipFile tests pass successfully.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.