Files
Dominik Schulz 09ea7700cc fix: store mount paths relative to home dir for cross-platform portability (#3439)
Fixes #2897.

Two bugs were present:

1. CleanPath in pkg/fsutil incorrectly expanded ~/... when GOPASS_HOMEDIR
   was set: it used path[2:] (stripping both '~' and '/'), concatenating
   without a path separator. E.g. '~/.local' with GOPASS_HOMEDIR=/foo
   became '/foo.local' instead of '/foo/.local'. Fix: use path[1:] to
   keep the separator, matching the existing os.UserHomeDir branch.

2. Absolute paths were written to config for [mounts] path entries,
   making configs non-portable across machines/platforms when synced.

Fix:
- Add ShrinkPath() to pkg/fsutil: converts an absolute path back to a
  ~/... relative form when it falls under GOPASS_HOMEDIR (if set) or
  the user home directory. This makes stored paths portable.
- Call ShrinkPath() in Config.SetPath() and Config.SetMountPath() so
  paths are always persisted in ~/... form.
- Apply CleanPath() in Config.Path() and Config.MountPath() so callers
  always receive a fully-expanded absolute path regardless of what is
  stored on disk.
- Expand rootPath via CleanPath() in newWithOptions() before passing it
  to gitconfig.LoadAll(), since the gitconfig library does not perform
  tilde expansion. Without this the root store local config was loaded
  from a literal '~/' directory relative to the working directory.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2026-05-25 17:44:35 +02:00
..
2025-11-12 21:09:26 +01:00
2025-10-05 20:16:33 +02:00
2026-04-04 17:34:42 +02:00
2025-03-02 19:49:22 +01:00