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

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

This matches newer ogsudo versions.
@bjorn3 bjorn3 requested a review from squell December 9, 2025 16:05
// we are not in the foreground process group.

catching_sigttou(|| self.tty.tcsetpgrp(pgrp))
catching_sigttou(|| self.tcsetpgrp(pgrp))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

UserTerm implements AsFd to forward to self.tty. SafeTty is implemented for UserTerm, but not for the File stored in the tty field.

@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.

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.
@squell squell added the C-operatingsystem Low-level glue layers label Dec 11, 2025
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