Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of "-l" and stdout redirected to /dev/null hangs sudo #335

Closed
vincentbernat opened this issue Dec 9, 2023 · 2 comments
Closed

Use of "-l" and stdout redirected to /dev/null hangs sudo #335

vincentbernat opened this issue Dec 9, 2023 · 2 comments

Comments

@vincentbernat
Copy link

Hey!

Since 1.9.15, sudo -l ls > /dev/null locks the sudo process on fcntl(1, F_SETLKW, {l_type=F_WRLCK, l_whence=SEEK_CUR, l_start=0, l_len=0}). I believe this is because of the tentative to avoid multiple sudo processes to modify the terminal settings.

@millert
Copy link
Collaborator

millert commented Dec 9, 2023

Locking /dev/null on Linux always seems to block, which is an interesting choice. Only locking if the fd is actually a tty fixes the problem.

millert added a commit that referenced this issue Dec 9, 2023
This moves sudo_isatty() to libsudo_util so sudo_term_is_raw() can
use it.  Fixes GitHub issue #335
millert added a commit that referenced this issue Dec 13, 2023
This moves sudo_isatty() to libsudo_util so sudo_term_is_raw() can
use it.  Fixes GitHub issue #335

--HG--
branch : 1.9
@millert
Copy link
Collaborator

millert commented Dec 13, 2023

The fix is present in sudo 1.9.15p3

@millert millert closed this as completed Dec 13, 2023
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

No branches or pull requests

2 participants