t3code icon indicating copy to clipboard operation
t3code copied to clipboard

fix(server): scrub AppImage XDG_DATA_DIRS and GSETTINGS_SCHEMA_DIR from terminals

Open arhxam opened this issue 4 months ago • 2 comments

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_DIRS and GSETTINGS_SCHEMA_DIR mount paths from the server process (fixes #5059, alongside existing #1699 scrub for PATH / LD_LIBRARY_PATH).

Both variables are treated like other colon-separated search paths: AppImage $APPDIR segments are stripped, host entries stay, and if only mount segments remain the variable is removed so tools like gsettings use host defaults instead of reporting missing bundled schemas.

The AppImage terminal test now asserts scrubbed XDG_DATA_DIRS and undefined GSETTINGS_SCHEMA_DIR when 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_DIRS and GSETTINGS_SCHEMA_DIR from terminal environments when launched via AppImage

Extends APPIMAGE_PATH_LIKE_ENV_VARS in Manager.ts to strip AppImage mount segments from XDG_DATA_DIRS and GSETTINGS_SCHEMA_DIR when spawning terminals. If stripping leaves a variable with no remaining entries, the variable is removed entirely from the environment.

Macroscope summarized 23781bb.

arhxam avatar Jul 31 '26 06:07 arhxam

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eacf1ada-8637-4638-a9d2-75efbe4fa8f5

You can disable this status message by setting the reviews.review_status to false in 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 31 '26 06:07 coderabbitai[bot]

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.

macroscopeapp[bot] avatar Jul 31 '26 06:07 macroscopeapp[bot]