Skip to content

Conversation

@bjorn3
Copy link
Collaborator

@bjorn3 bjorn3 commented Dec 9, 2025

This way redirecting stdio to another tty won't be treated as if stdio
isn't redirected at all.

This matches newer ogsudo versions.

Also introduced a SafeTty trait to ensure a bunch of methods that invoke ioctls only get called on known real ttys.

Fixes #1377

@bjorn3 bjorn3 requested a review from squell December 9, 2025 16:05
@squell squell added this to the sudo changes milestone Dec 10, 2025
@bjorn3
Copy link
Collaborator Author

bjorn3 commented Dec 10, 2025

Pushed a commit to port sudo-project/sudo@78b7121 too.

@squell squell added the C-operatingsystem Low-level glue layers label Dec 11, 2025
@squell
Copy link
Member

squell commented Dec 15, 2025

I've created #1390 to remind us to write an integration test for the OFLAG commit that was piggy-backed on this PR.

@squell
Copy link
Member

squell commented Dec 15, 2025

Note:I think the matches_pgrp function can be slightly better named (something like is_terminal_for_pgrp), as discussed, but that is not a blocker for merging.

@squell
Copy link
Member

squell commented Dec 15, 2025

Maybe also an integration test that demonstrates the behaviour?

This way redirecting stdio to another tty won't be treated as if stdio
isn't redirected at all.

This matches newer ogsudo versions.
exec_bg is already set and the only two other effects it has are calling
disable_input() and changing a debug log message. The former is not
necessary to do when stdout is a pipe to fix the missing keystroke
issue while the latter now matches ogsudo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-operatingsystem Low-level glue layers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check if stdio tty is actually our own tty

2 participants