Skip to content

Fix newline for empty prompts - #1655

Open
squell wants to merge 1 commit into
mainfrom
fix-newline
Open

Fix newline for empty prompts#1655
squell wants to merge 1 commit into
mainfrom
fix-newline

Conversation

@squell

@squell squell commented Jul 10, 2026

Copy link
Copy Markdown
Member

Closes #1648

Note: this does mean that in irregular exits (e.g. due to ?, or a panic) of prompt_password, the new line would not be printed. But the only irregular that is there is the SIGTSTP/SIGTTIN/SIGTTOU, and actually with this patch the behaviour of those seems closer to ogsudo as well (e.g. ^Z will cause a newline to be printed anyway)

In particular, any I/O errors in read_unbuffered are handled by prompt_password and not propagated.

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

The write could be moved above the take_first_pending() if we do want a newline on signals, but the current location is fine too.

Would a test make sense?

@squell

squell commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

The write could be moved above the take_first_pending() if we do want a newline on signals, but the current location is fine too.

I'll experiment with that.

Would a test make sense?

We can take the unit test from #1654, those seem small enough. Although it also feels like compliance-test territory.

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.

sudo -S -p '' writes a newline to stderr

2 participants