v6: General Improvements#204
Merged
Merged
Conversation
Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Use Lstat when RemoveAll falls back to directory traversal after an initial Remove failure. This prevents a symlink from being followed and recursed into when Remove fails. Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Use io/fs helpers for Stat, OpenFile, and ReadDir so fallback-opened files are closed by the standard library helpers instead of being left open. Signed-off-by: Paulo Gomes <paulo@entire.io>
There was a problem hiding this comment.
Pull request overview
This PR tightens several filesystem helpers across the billy codebase: it improves path-boundary handling, symlink behavior, file reading/writing helpers, and a few docs/tests around those changes.
Changes:
- Hardened path handling in
util,chroot,mount, andmemfsto avoid incorrect prefix matches and symlink-following surprises. - Simplified
ReadFile/embedfsimplementations and fixedWriteFileto preserve write errors before attemptingSync. - Added regression tests for scoped filesystems, symlink traversal, rename prefix handling, and embed file-closing behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| util/util.go | Updates recursive removal, read/write helpers, and symlink-aware stat behavior. |
| util/util_test.go | Adds regression tests for ReadFile, WriteFile, and RemoveAll. |
| memfs/storage.go | Fixes descendant detection during rename operations. |
| memfs/memory.go | Improves package/type documentation and symlink doc comments. |
| memfs/memory_test.go | Adds tests for chroot symlink resolution, loops, and rename prefix handling. |
| helper/mount/mount.go | Fixes mountpoint prefix detection and a spelling error in comments. |
| helper/mount/mount_test.go | Adds tests for mountpoint prefix matching. |
| helper/iofs/iofs.go | Switches ReadFile to shared util helper. |
| helper/chroot/chroot.go | Adds symlink-following path resolution inside chrooted filesystems. |
| embedfs/embed.go | Generalizes internal FS handling and uses io/fs helpers. |
| embedfs/embed_test.go | Adds regression tests for closing internally opened files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
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.
No description provided.