snap: Restore HOME so git reads the user's global config - #5
Open
bejaratommy wants to merge 1 commit into
Open
Conversation
The snapcraft.yaml refactor in e0e8c1f dropped the HOME: $SNAP_REAL_HOME environment variable. Under strict confinement HOME then defaults to $SNAP_USER_DATA, so the bundled git no longer resolves the user's global ~/.gitconfig. Settings such as core.quotepath=false are therefore ignored, and GitInfo fails to resolve content files with non-ASCII names (e.g. hugö.md). The gitconfig plug already grants read access to the real home, but git only consults it when HOME points there. Restoring HOME fixes GitInfo for such files; the HUGO_SECURITY_EXEC_OSENV allowlist already permits HOME through to the git subprocess. Fixes gohugoio#15114
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 snapcraft.yaml refactor in e0e8c1f ("snap: Limit build platforms…") inadvertently dropped the
HOME: $SNAP_REAL_HOMEentry from theenvironment:block.Under strict confinement
HOMEthen defaults to$SNAP_USER_DATA(~/snap/hugo/current), so the bundled git no longer resolves the user's global~/.gitconfig. Settings such ascore.quotepath=falseare ignored, andgit logemits octal-escaped, quoted paths for non-ASCII filenames — soGitInfocan no longer be matched to content files likehugö.md.The
gitconfigplug already grants read access to the real home, but git only consults it whenHOMEpoints there. Restoring the variable fixesGitInfofor such files.HUGO_SECURITY_EXEC_OSENValready whitelists(XDG_CONFIG_)?HOME, so the value propagates to the git subprocess.Fixes gohugoio#15114.
Notes