Skip to content

Make sure files created by PTF can be read by the invoking user. - #269

Merged
jafingerhut merged 2 commits into
p4lang:mainfrom
fruffy-xsight:fruffy/ptf_changes
Jul 29, 2026
Merged

jafingerhut merged 2 commits into
p4lang:mainfrom
fruffy-xsight:fruffy/ptf_changes

Conversation

@fruffy-xsight

Copy link
Copy Markdown
Contributor

Fix a pet peeve of mine.

ptf needs root to open raw sockets and it is normally run with sudo. Every file it wrote was then owned by root: the log directory, log files, pcaps, xUnit results, and the profiler dump. That makes the files unreadable in normal operations.

Chown those files to SUDO_UID/SUDO_GID as they are created. This only happens when running as root under sudo, and does nothing otherwise.

ptf needs root to open raw sockets and it is normally run with sudo.
Every file it wrote was then owned by root: the log directory, log files,
pcaps, xUnit results, and the profiler dump. That makes the files unreadable in normal operations.

Chown those files to SUDO_UID/SUDO_GID as they are created. This only
happens when running as root under sudo, and does nothing otherwise.

Signed-off-by: Fabian Ruffy <212419330+fruffy-xsight@users.noreply.github.com>
Signed-off-by: Fabian Ruffy <212419330+fruffy-xsight@users.noreply.github.com>

@jafingerhut jafingerhut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely an annoyance for me, too. Thanks for the enhancement.

@jafingerhut
jafingerhut merged commit 680f96b into p4lang:main Jul 29, 2026
14 checks passed
@fruffy-xsight
fruffy-xsight deleted the fruffy/ptf_changes branch July 30, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants