fix(server): scrub AppImage XDG_DATA_DIRS and GSETTINGS_SCHEMA_DIR from terminals
What Changed
Added XDG_DATA_DIRS and GSETTINGS_SCHEMA_DIR to the AppImage environment scrub in apps/server/src/terminal/Manager.ts. Extended the existing AppImage terminal test.
Why
Closes #5059.
The integrated terminal inherits the server process environment. On Linux AppImage builds the runtime's AppRun points XDG_DATA_DIRS at an $APPDIR/usr/share entry and GSETTINGS_SCHEMA_DIR at the bundled $APPDIR/usr/share/glib-2.0/schemas. The existing scrub (added for #1699) only cleaned PATH/LD_LIBRARY_PATH, so those two leaked into the PTY and gsettings inside the terminal reported "No schemas installed".
Both are colon-separated search paths, so they join the same APPIMAGE_PATH_LIKE_ENV_KEYS scrub: the AppImage mount segments are dropped, the user's real entries preserved, and when only mount segments remain the variable is removed so the shell falls back to the platform default. The added assertions fail before and pass after; all 50 Manager tests pass.
Checklist
- [x] This PR is small and focused
- [x] I explained what changed and why
- [x] No UI changes
[!NOTE] Low Risk Scoped to Linux AppImage terminal spawn env scrubbing with existing path-filter logic and test coverage; no change when not launched from an AppImage.
Overview Extends the AppImage terminal environment scrub so integrated PTYs no longer inherit
XDG_DATA_DIRSandGSETTINGS_SCHEMA_DIRmount paths from the server process (fixes #5059, alongside existing #1699 scrub forPATH/LD_LIBRARY_PATH).Both variables are treated like other colon-separated search paths: AppImage
$APPDIRsegments are stripped, host entries stay, and if only mount segments remain the variable is removed so tools likegsettingsuse host defaults instead of reporting missing bundled schemas.The AppImage terminal test now asserts scrubbed
XDG_DATA_DIRSand undefinedGSETTINGS_SCHEMA_DIRwhen it pointed only at the mount.Reviewed by Cursor Bugbot for commit 23781bb1a78974c64d8fdafeefe7cc1756220b4c. Bugbot is set up for automated code reviews on this repo. Configure here.
[!NOTE]
Scrub
XDG_DATA_DIRSandGSETTINGS_SCHEMA_DIRfrom terminal environments when launched via AppImageExtends
APPIMAGE_PATH_LIKE_ENV_VARSin Manager.ts to strip AppImage mount segments fromXDG_DATA_DIRSandGSETTINGS_SCHEMA_DIRwhen spawning terminals. If stripping leaves a variable with no remaining entries, the variable is removed entirely from the environment.Macroscope summarized 23781bb.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
eacf1ada-8637-4638-a9d2-75efbe4fa8f5You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
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 @coderabbitai help to get the list of available commands.
Approvability
Verdict: Approved 23781bb
Straightforward bug fix extending an existing AppImage environment scrubbing mechanism to two additional variables (XDG_DATA_DIRS, GSETTINGS_SCHEMA_DIR). The change is minimal, uses established infrastructure, and includes test coverage.
You can customize Macroscope's approvability policy. Learn more.