Skip to content

snap: Restore HOME so git reads the user's global config - #5

Open
bejaratommy wants to merge 1 commit into
masterfrom
fix/snap-restore-home-env
Open

snap: Restore HOME so git reads the user's global config#5
bejaratommy wants to merge 1 commit into
masterfrom
fix/snap-restore-home-env

Conversation

@bejaratommy

Copy link
Copy Markdown
Owner

Summary

The snapcraft.yaml refactor in e0e8c1f ("snap: Limit build platforms…") inadvertently dropped the HOME: $SNAP_REAL_HOME entry from the environment: block.

Under strict confinement HOME then defaults to $SNAP_USER_DATA (~/snap/hugo/current), so the bundled git no longer resolves the user's global ~/.gitconfig. Settings such as core.quotepath=false are ignored, and git log emits octal-escaped, quoted paths for non-ASCII filenames — so GitInfo can no longer be matched to content files like hugö.md.

The gitconfig plug already grants read access to the real home, but git only consults it when HOME points there. Restoring the variable fixes GitInfo for such files. HUGO_SECURITY_EXEC_OSENV already whitelists (XDG_CONFIG_)?HOME, so the value propagates to the git subprocess.

Fixes gohugoio#15114.

Notes

  • Single-line config restoration; snap package changes can't be built/verified in this environment, so relying on CI and the maintainer's snap build.
  • Root cause was identified by @jmooring in the issue thread.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant