fix: sanitize environment for external file openers#1391
Conversation
|
Hello, I've noticed that you've been opening quite a few rapid fire PRs to address open bug reports. I've noticed a common trait amongst all of these where they're not using our designated pull request description template that includes task checkboxes for the platforms this code was tested on and the depth of what was tested. I ask you to please update your PRs with this information and include that information going forward. Given that this PR addresses a Linux-specific issue and trying to adding environment variables to a subprocess, and #1390 (which was opened a few minutes before this one) addresses a bug that needs to be specifically tested on Windows, I am skeptical that these were tested on the applicable platforms at all. |
|
You're right, and I'm sorry for the extra review burden. What happened: I've been working on an independent OSS contribution agent to see if it can make useful open-source contributions. I'm a big fan of TagStudio, so I added it as a candidate project, but it went off in the wrong direction and started working through the TagStudio backlog too aggressively. I've turned it off now. I'm going through the open PRs manually and will update, draft, or close anything that isn't properly scoped or tested. My intention was to help, not create more work for you. |
|
I've moved this to draft. You're right that the real test here is the Linux portable/PyInstaller build opening files correctly, and I haven't verified that yet. I'll leave it as draft unless I can test that environment properly. |
|
Closing this after a stricter audit. The important test for this issue is the Linux portable/PyInstaller build opening files correctly, and I have not verified that environment. Sorry for the noise. |
Summary
Draft / not ready for review.
This attempts to address #1322 by sanitizing the environment used when launching external file openers from a bundled app. In particular, it restores
LD_LIBRARY_PATHfromLD_LIBRARY_PATH_ORIGand removes bundled Qt/PyInstaller path variables from the subprocess environment.I am leaving this as draft because the important validation is an end-to-end Linux portable/PyInstaller build opening files through system defaults, and I have not performed that validation. The current coverage is only targeted unit tests for the environment construction.
Tasks Completed
uv run --extra pytest python -m pytest tests/test_silent_subprocess.py -quv run --extra ruff ruff check src/tagstudio/core/utils/silent_subprocess.py tests/test_silent_subprocess.py