v5: Ensure Chmod behaviour across BoundOS and ChrootOS#187
Merged
pjbgf merged 3 commits intogo-git:releases/v5.xfrom Feb 24, 2026
Merged
v5: Ensure Chmod behaviour across BoundOS and ChrootOS#187pjbgf merged 3 commits intogo-git:releases/v5.xfrom
pjbgf merged 3 commits intogo-git:releases/v5.xfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #55 in go-git/go-git by aligning the behavior of BoundOS and ChrootOS filesystem implementations. The changes ensure that both implementations handle Chmod capabilities consistently and that BoundOS.TempFile() can create temporary files even when the target directory doesn't exist.
Changes:
- Added Chmod capability detection to the polyfill helper to allow ChrootOS to properly identify Chmod support
- Modified BoundOS.TempFile() to automatically create the target directory if it doesn't exist before creating the temporary file
- Updated CI workflow to test against Go 1.24.x, oldstable, and stable versions
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/test.yml |
Updated Go version matrix to use 1.24.x, oldstable, and stable references |
osfs/os_bound.go |
Added directory creation logic in TempFile method to handle non-existent directories |
osfs/os_bound_test.go |
Updated test expectations to reflect new TempFile behavior and fixed minor formatting issues |
helper/polyfill/polyfill.go |
Added Chmod capability tracking and implementation to polyfill wrapper |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Previously if the dir didn't already exist an error would be returned, which meant that some go-git features would break when changing ChrootOS with BoundOS. Signed-off-by: Paulo Gomes <[email protected]>
This is a follow-up to go-git#171. Signed-off-by: Paulo Gomes <[email protected]>
x-ref: go-git/go-git#1769 Signed-off-by: Paulo Gomes <[email protected]>
3f79797 to
f387d62
Compare
pjbgf
added a commit
to pjbgf/go-git
that referenced
this pull request
Feb 24, 2026
Loose object files are content-addressable and imutable. They should be created on demand and deleted on repacking. However, they should not be overwritten - assuming the initial file isn't corrupted. The previous lack of validation meant those files were being overwritten when in fact they could just be ignored. In Linux, this was a non-issue, however, in Windows this operation led to Access Denied errors. Some additional moving parts of this fix: - [go-billy](go-git/go-billy#187): Align behaviour supporting dir.NewObject(): - Add support for Chmod in polyfill so that ChrootOS is able to chmod files. - Ensure temporary directories are created for BoundOS to avoid errors when trying to create the temporary file used for loose files. - This PR: - Ensure that in Windows, packed and loose object files are created as read-only, which in this case means setting the flag windows.FILE_ATTRIBUTE_READONLY via x/sys/windows. - Skip renaming the temporary file into the existing loose object, instead simply delete the temporary file. Relates to: - Southclaws/sampctl#422 - git-bug/git-bug#1142 - entireio/cli#455 Signed-off-by: Paulo Gomes <[email protected]>
pjbgf
added a commit
to pjbgf/go-git
that referenced
this pull request
Feb 24, 2026
Loose object files are content-addressable and imutable. They should be created on demand and deleted on repacking. However, they should not be overwritten - assuming the initial file isn't corrupted. The previous lack of validation meant those files were being overwritten when in fact they could just be ignored. In Linux, this was a non-issue, however, in Windows this operation led to Access Denied errors. Some additional moving parts of this fix: - [go-billy](go-git/go-billy#187): Align behaviour supporting dir.NewObject(): - Add support for Chmod in polyfill so that ChrootOS is able to chmod files. - Ensure temporary directories are created for BoundOS to avoid errors when trying to create the temporary file used for loose files. - This PR: - Ensure that in Windows, packed and loose object files are created as read-only, which in this case means setting the flag windows.FILE_ATTRIBUTE_READONLY via x/sys/windows. - Skip renaming the temporary file into the existing loose object, instead simply delete the temporary file. Relates to: - Southclaws/sampctl#422 - git-bug/git-bug#1142 - entireio/cli#455 Signed-off-by: Paulo Gomes <[email protected]>
pjbgf
added a commit
to pjbgf/go-git
that referenced
this pull request
Feb 25, 2026
Loose object files are content-addressable and imutable. They should be created on demand and deleted on repacking. However, they should not be overwritten - assuming the initial file isn't corrupted. The previous lack of validation meant those files were being overwritten when in fact they could just be ignored. In Linux, this was a non-issue, however, in Windows this operation led to Access Denied errors. Some additional moving parts of this fix: - [go-billy](go-git/go-billy#187): Align behaviour supporting dir.NewObject(): - Add support for Chmod in polyfill so that ChrootOS is able to chmod files. - Ensure temporary directories are created for BoundOS to avoid errors when trying to create the temporary file used for loose files. - This PR: - Ensure that in Windows, packed and loose object files are created as read-only, which in this case means setting the flag windows.FILE_ATTRIBUTE_READONLY via x/sys/windows. - Skip renaming the temporary file into the existing loose object, instead simply delete the temporary file. Relates to: - Southclaws/sampctl#422 - git-bug/git-bug#1142 - entireio/cli#455 Signed-off-by: Paulo Gomes <[email protected]>
Maks1mS
pushed a commit
to stplr-dev/stplr
that referenced
this pull request
Feb 25, 2026
This PR contains the following updates: | Package | Type | Update | Change | OpenSSF | |---|---|---|---|---| | [github.com/go-git/go-billy/v5](https://github.com/go-git/go-billy) | require | minor | `v5.7.0` → `v5.8.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/go-git/go-billy) | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>go-git/go-billy (github.com/go-git/go-billy/v5)</summary> ### [`v5.8.0`](https://github.com/go-git/go-billy/releases/tag/v5.8.0) [Compare Source](go-git/go-billy@v5.7.0...v5.8.0) #### What's Changed - build: Update module golang.org/x/net to v0.45.0 \[SECURITY] (releases/v5.x) by [@​go-git-renovate](https://github.com/go-git-renovate)\[bot] in [#​183](go-git/go-billy#183) - v5: Ensure Chmod behaviour across BoundOS and ChrootOS by [@​pjbgf](https://github.com/pjbgf) in [#​187](go-git/go-billy#187) **Full Changelog**: <go-git/go-billy@v5.7.0...v5.8.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday ( * 0-4,22-23 * * 1-5 ), Only on Sunday and Saturday ( * * * * 0,6 ) (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNS4yIiwidXBkYXRlZEluVmVyIjoiNDMuMTUuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmNpZXMiXX0=--> Reviewed-on: https://altlinux.space/stapler/stplr/pulls/318 Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
pjbgf
added a commit
to pjbgf/go-git
that referenced
this pull request
Feb 26, 2026
Loose object files are content-addressable and imutable. They should be created on demand and deleted on repacking. However, they should not be overwritten - assuming the initial file isn't corrupted. The previous lack of validation meant those files were being overwritten when in fact they could just be ignored. In Linux, this was a non-issue, however, in Windows this operation led to Access Denied errors. Some additional moving parts of this fix: - [go-billy](go-git/go-billy#187): Align behaviour supporting dir.NewObject(): - Add support for Chmod in polyfill so that ChrootOS is able to chmod files. - Ensure temporary directories are created for BoundOS to avoid errors when trying to create the temporary file used for loose files. - This PR: - Ensure that in Windows, packed and loose object files are created as read-only, which in this case means setting the flag windows.FILE_ATTRIBUTE_READONLY via x/sys/windows. - Skip renaming the temporary file into the existing loose object, instead simply delete the temporary file. Relates to: - Southclaws/sampctl#422 - git-bug/git-bug#1142 - entireio/cli#455 Signed-off-by: Paulo Gomes <[email protected]>
pjbgf
added a commit
to pjbgf/go-git
that referenced
this pull request
Feb 26, 2026
Loose object files are content-addressable and imutable. They should be created on demand and deleted on repacking. However, they should not be overwritten - assuming the initial file isn't corrupted. The previous lack of validation meant those files were being overwritten when in fact they could just be ignored. In Linux, this was a non-issue, however, in Windows this operation led to Access Denied errors. Some additional moving parts of this fix: - [go-billy](go-git/go-billy#187): Align behaviour supporting dir.NewObject(): - Add support for Chmod in polyfill so that ChrootOS is able to chmod files. - Ensure temporary directories are created for BoundOS to avoid errors when trying to create the temporary file used for loose files. - This PR: - Ensure that in Windows, packed and loose object files are created as read-only, which in this case means setting the flag windows.FILE_ATTRIBUTE_READONLY via x/sys/windows. - Skip renaming the temporary file into the existing loose object, instead simply delete the temporary file. Relates to: - Southclaws/sampctl#422 - git-bug/git-bug#1142 - entireio/cli#455 Signed-off-by: Paulo Gomes <[email protected]>
arthurzam
pushed a commit
to gentoo-golang-dist/forgejo-runner
that referenced
this pull request
Feb 27, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [github.com/go-git/go-billy/v5](https://github.com/go-git/go-billy) | `v5.6.2` -> `v5.8.0` |  |  | --- ### Release Notes <details> <summary>go-git/go-billy (github.com/go-git/go-billy/v5)</summary> ### [`v5.8.0`](https://github.com/go-git/go-billy/releases/tag/v5.8.0) [Compare Source](go-git/go-billy@v5.7.0...v5.8.0) #### What's Changed - build: Update module golang.org/x/net to v0.45.0 \[SECURITY] (releases/v5.x) by [@​go-git-renovate](https://github.com/go-git-renovate)\[bot] in [#​183](go-git/go-billy#183) - v5: Ensure Chmod behaviour across BoundOS and ChrootOS by [@​pjbgf](https://github.com/pjbgf) in [#​187](go-git/go-billy#187) **Full Changelog**: <go-git/go-billy@v5.7.0...v5.8.0> ### [`v5.7.0`](https://github.com/go-git/go-billy/releases/tag/v5.7.0) [Compare Source](go-git/go-billy@v5.6.2...v5.7.0) #### What's Changed - Add support for Chmod on billy.Filesystem by [@​bitfehler](https://github.com/bitfehler) in [#​171](go-git/go-billy#171) - build: Update module golang.org/x/net to v0.38.0 \[SECURITY] (releases/v5.x) by [@​go-git-renovate](https://github.com/go-git-renovate)\[bot] in [#​177](go-git/go-billy#177) **Full Changelog**: <go-git/go-billy@v5.6.2...v5.7.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My41LjAiLCJ1cGRhdGVkSW5WZXIiOiI0My41LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbIktpbmQvRGVwZW5kZW5jeVVwZGF0ZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1409 Reviewed-by: Mathieu Fenniak <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
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.
These are changes required in order to fix go-git/go-git#55. During the investigation of the issue it became clear that the
osfsimplementations were having slightly misaligned behaviour:ChrootOSwas unable to identifyChmodsupport due to the underlying polyfill not supporting it.BoundOSwould error if the tempdir path didn't exist ahead ofTempFile()being called.Supersedes #186.