Skip to content

v6: General Improvements#204

Merged
pjbgf merged 12 commits into
go-git:mainfrom
pjbgf:v6-improvements
May 5, 2026
Merged

v6: General Improvements#204
pjbgf merged 12 commits into
go-git:mainfrom
pjbgf:v6-improvements

Conversation

@pjbgf

@pjbgf pjbgf commented May 5, 2026

Copy link
Copy Markdown
Member

No description provided.

pjbgf added 10 commits May 4, 2026 17:15
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>
Copilot AI review requested due to automatic review settings May 5, 2026 10:49
@pjbgf pjbgf mentioned this pull request May 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and memfs to avoid incorrect prefix matches and symlink-following surprises.
  • Simplified ReadFile/embedfs implementations and fixed WriteFile to preserve write errors before attempting Sync.
  • 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.

Comment thread helper/chroot/chroot.go Outdated
Comment thread helper/chroot/chroot.go Outdated
Comment thread helper/chroot/chroot.go Outdated
pjbgf added 2 commits May 5, 2026 12:10
Signed-off-by: Paulo Gomes <paulo@entire.io>
Signed-off-by: Paulo Gomes <paulo@entire.io>
@pjbgf pjbgf force-pushed the v6-improvements branch from 1b45062 to a35f62c Compare May 5, 2026 11:16
@pjbgf pjbgf merged commit 2b60adf into go-git:main May 5, 2026
13 checks passed
@pjbgf pjbgf deleted the v6-improvements branch May 5, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants