fix: set XDG_CONFIG_DIRS and XDG_DATA_DIRS defaults in tryGetPamEnvVars#3121
Conversation
When snap or other environments strip XDG_CONFIG_DIRS and XDG_DATA_DIRS, and PAM env files do not define them, child shells receive no value for these vars. Apply XDG Base Directory spec defaults (/etc/xdg and /usr/local/share:/usr/share) following the same pattern already used for XDG_RUNTIME_DIR. Fixes wavetermdev#2970 Signed-off-by: majiayu000 <1835304752@qq.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
The fix follows the existing pattern used for Reviewed by minimax-m2.5-20260211 · 119,577 tokens |
|
@majiayu000 thanks again for the submission. looks good! |
Summary
XDG_CONFIG_DIRS(andXDG_DATA_DIRS) when snap or other environments strip these variables and PAM env files do not define themtryGetPamEnvVars(), after the existingXDG_RUNTIME_DIRfallback, adds identical fallback logic forXDG_CONFIG_DIRS(default:/etc/xdg) andXDG_DATA_DIRS(default:/usr/local/share:/usr/share) per the XDG Base Directory SpecificationRoot Cause
Snap confinement strips several XDG environment variables.
tryGetPamEnvVars()already handlesXDG_RUNTIME_DIRwith a sensible default, butXDG_CONFIG_DIRSandXDG_DATA_DIRSwere left unhandled, causing child shells to receive empty/unset values.Test plan
gofmt -l ./pkg/shellexec/— no output (clean)go build ./...— succeedsXDG_CONFIG_DIRS=/etc/xdgandXDG_DATA_DIRS=/usr/local/share:/usr/sharewhen the variables are not set by the desktop environment