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

reinstall: Stop waiting for newline after prompt is answered #1131

Closed
wants to merge 1 commit into from

Conversation

ckyrouac
Copy link
Contributor

@ckyrouac ckyrouac commented Feb 20, 2025

When I first used the script, I hit y expecting my answer to be accepted. When nothing happened, I hit y again and was presented with the same prompt. It took me far too long (I went as far as trying a different shell and terminal) to realize that hitting y only toggled the selection to capital Y, I had to also hit "enter". This is the first time I've used a script with this behavior. Maybe I'm in the minority but given that this is supposed to be an intuitive tool, should we toggle this flag?

@ckyrouac ckyrouac requested a review from omertuc February 20, 2025 19:16
@github-actions github-actions bot added the area/system-reinstall-bootc Issues related to system-reinstall-botoc label Feb 20, 2025
@jeckersb
Copy link
Contributor

(Disclaimer, I haven't actually tried running system-reinstall-bootc yet so maybe I'm missing context...)

My initial reaction is that the newline is expected. The canonical example for me is dnf install cowsay and you get the Is this ok [y/N]: prompt. At that point I'm expecting to type y<enter>, not just y.

@ckyrouac
Copy link
Contributor Author

ah right, of course. I think what threw me off is the way it's presented. Hitting y when y is the default appears to do nothing in system-reinstall-bootc.

There's feedback when using dnf, e.g.:

Is this ok [y/N]: yyyy

This happens when hitting y multiple times with system-reinstall-bootc:

❮ sudo ./target/release/system-reinstall-bootc quay.io/fedora/fedora-bootc:41
[sudo] password for chris:
None of the users on this system found have authorized SSH keys, if your image doesn't use cloud-init or other mean
None of the users on this system found have authorized SSH keys, if your image doesn't use cloud-init or other mean
None of the users on this system found have authorized SSH keys, if your image doesn't use cloud-init or other mean
None of the users on this system found have authorized SSH keys, if your image doesn't use cloud-init or other means to set up users, you may not be able to log in after reinstalling. Do you want to continue? [Y/n]

Looks like the prompt is (partially) repeated only when there is not enough width in the terminal. Otherwise, hitting y multiple times does nothing.

I might have been confused due to lack of sleep more than anything. Feel free to close if you think it's fine as-is.

@jeckersb
Copy link
Contributor

I guess I should actually try to use the tool on a VM to see exactly what you're talking about 😄. But from your explanation the current behavior doesn't look sane to me. I'll play with it a bit later this afternoon.

@omertuc
Copy link
Contributor

omertuc commented Feb 22, 2025

Looks like the prompt is (partially) repeated only when there is not enough width in the terminal. Otherwise, hitting y multiple times does nothing.

The lines repeating on long prompts is a dialoguer bug

But it doing nothing is a feature (the selection is communicated through the capitalization of y/n, if y is already capitalized, it means its already selected, not that it's the default. The default is never directly communicated - it's obvious because the default is simply capitalized from the get go)

@omertuc
Copy link
Contributor

omertuc commented Feb 22, 2025

Opened console-rs/dialoguer#323

@cgwalters
Copy link
Collaborator

We could mitigate the console-rs bug by line wrapping our prompt, right?

If progress there is slow on merging patches I'm also fine to vendor dialoguer in our codebase FWIW. (Or probably simpler, point to your fork via git dependencies, or (engineering this slightly more) another option is to make a branch on this repository which is actually not bootc, but is just forked dependencies)

As far as the mechanics of not waiting for a newline...I don't have a really strong opinion honestly, but weakly agree with John.

@ckyrouac
Copy link
Contributor Author

As far as the mechanics of not waiting for a newline...I don't have a really strong opinion honestly, but weakly agree with John.

Agreed, waiting for newline seems standard. The thing that threw me off is the input is not displayed in the terminal. So, pressing "y" on a selection where the default is "y" results in no feedback. Not a big deal, I'm just not used to that behavior. Closing this.

@ckyrouac ckyrouac closed this Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/system-reinstall-bootc Issues related to system-reinstall-botoc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants