Commit b26eb69
authored
fix: set XDG_CONFIG_DIRS and XDG_DATA_DIRS defaults in tryGetPamEnvVars (#3121)
## Summary
- Fixes #2970: WaveTerm does not inherit `XDG_CONFIG_DIRS` (and
`XDG_DATA_DIRS`) when snap or other environments strip these variables
and PAM env files do not define them
- In `tryGetPamEnvVars()`, after the existing `XDG_RUNTIME_DIR`
fallback, adds identical fallback logic for `XDG_CONFIG_DIRS` (default:
`/etc/xdg`) and `XDG_DATA_DIRS` (default: `/usr/local/share:/usr/share`)
per the XDG Base Directory Specification
- No behavior change when these vars are already set by PAM env files
## Root Cause
Snap confinement strips several XDG environment variables.
`tryGetPamEnvVars()` already handles `XDG_RUNTIME_DIR` with a sensible
default, but `XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` were left unhandled,
causing child shells to receive empty/unset values.
## Test plan
- [ ] `gofmt -l ./pkg/shellexec/` — no output (clean)
- [ ] `go build ./...` — succeeds
- [ ] On Linux with snap, verify that child shells receive
`XDG_CONFIG_DIRS=/etc/xdg` and
`XDG_DATA_DIRS=/usr/local/share:/usr/share` when the variables are not
set by the desktop environment
Signed-off-by: majiayu000 <1835304752@qq.com>1 parent 24de0c1 commit b26eb69
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
763 | 769 | | |
764 | 770 | | |
0 commit comments