[PR #2844] [MERGED] Fix issue #561. Refactor/Optimize code to get and use pid and process name. #4554

Closed
opened 2026-05-05 10:22:18 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netblue30/firejail/pull/2844
Author: @crass
Created: 7/9/2019
Status: Merged
Merged: 7/9/2019
Merged by: @netblue30

Base: masterHead: fix-561-trace-appimage


📝 Commits (1)

  • 97518da Fix issue #561. Refactor/Optimize code to get and use pid and process name.

📊 Changes

1 file changed (+72 additions, -76 deletions)

View changed files

📝 src/libtrace/libtrace.c (+72 -76)

📄 Description

This fixes #561, which is misnamed. This issue affects just about any non-trivial shell scripts under firejail. Its just more obvious with appimage because the vast majority of AppRun programs are shell scripts.

The issue is that the preloaded libtrace library writes log messages to stdout and not directly to the console/tty. So a bash construct like FILEPATH=$(readlink -a file), will contain the output of readlink but also trace log messages for exec, stat, etc. Thus FILEPATH will not just be a file path. And the process tree then opens FILEPATH, which its highly likely to do, a process will try to open with a string that is not a path.

This change has log messages written to /dev/tty, which is the tty firejail is run with and the one you'd expect to get output on. Also, I refactored the existing code to be a tad more efficient by setting global variables for pid and process name in the library constructors.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netblue30/firejail/pull/2844 **Author:** [@crass](https://github.com/crass) **Created:** 7/9/2019 **Status:** ✅ Merged **Merged:** 7/9/2019 **Merged by:** [@netblue30](https://github.com/netblue30) **Base:** `master` ← **Head:** `fix-561-trace-appimage` --- ### 📝 Commits (1) - [`97518da`](https://github.com/netblue30/firejail/commit/97518da939533a5cf4637bd8f7f81d69b2579ad7) Fix issue #561. Refactor/Optimize code to get and use pid and process name. ### 📊 Changes **1 file changed** (+72 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `src/libtrace/libtrace.c` (+72 -76) </details> ### 📄 Description This fixes #561, which is misnamed. This issue affects just about any non-trivial shell scripts under firejail. Its just more obvious with appimage because the vast majority of AppRun programs are shell scripts. The issue is that the preloaded libtrace library writes log messages to stdout and not directly to the console/tty. So a bash construct like `FILEPATH=$(readlink -a file)`, will contain the output of `readlink` but also trace log messages for exec, stat, etc. Thus `FILEPATH` will not just be a file path. And the process tree then opens `FILEPATH`, which its highly likely to do, a process will try to open with a string that is not a path. This change has log messages written to `/dev/tty`, which is the tty firejail is run with and the one you'd expect to get output on. Also, I refactored the existing code to be a tad more efficient by setting global variables for pid and process name in the library constructors. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 10:22:18 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#4554
No description provided.