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

nixos-installer: retry setting password on mismatch #34058

Closed
wants to merge 5 commits into from

Conversation

lschuermann
Copy link
Member

Motivation for this change

The nixos-install script should retry setting the password if it failed. This way, one can make a mistake when typing and retry instead of running the installer again or setting the password manually.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 23, 2018

Just passing this through shellcheck:

Line 12:
    echo "Wrong password - Attempt $(expr $ATTEMPT + 1) of $MAX_PASSWD_ATTEMPTS."
                                     ^-- SC2003: expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
                                          ^-- SC2086: Double quote to prevent globbing and word splitting.

Looks good otherwise. I'll try it soon.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 23, 2018

Works perfectly!

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Feb 17, 2018

ping

@mmahut
Copy link
Member

mmahut commented Aug 9, 2019

Any updates on this pull request, please?

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Aug 9, 2019

It was pratically ready before the conflict. It should be rebased.

@mmahut
Copy link
Member

mmahut commented Aug 9, 2019

@lschuermann are you interested in rebasing this work please?

@lschuermann
Copy link
Member Author

I'm interested in rebasing this, but I'm pretty busy currently. It should be really easy however. I'd give myself a deadline of mid-september, if this is okay @rnhmjoj? I'm really sorry that this PR is open that long already.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Aug 11, 2019

@lschuermann No problem. I had some spare time so I rebased the change myself and tested it again.
I can't push here because I don't have commit access. The branch is here, should I open a new PR?

@lschuermann
Copy link
Member Author

Wow, that was fast! If you don't mind, I'd like to give this a quick test myself too. To keep the PR nice and tidy, I'd pull your changes onto my branch, this should avoid opening another PR fixing the same issue. Should be done in the next few hours.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Aug 12, 2019

Wow, that was fast! If you don't mind, I'd like to give this a quick test myself too.

Sure, it's better to double check.

To keep the PR nice and tidy, I'd pull your changes onto my branch

Perfect

@lschuermann
Copy link
Member Author

lschuermann commented Aug 13, 2019

Works like a charm, thank you!

I've integrated your changes. Instead of moving my branch-reference to your commit, I've merged the current master and used yours as a resolution. Now you're the merge author. Checked the diff with the current master, looks fine to me, nothing overwritten. If you diff the file, it should be exactly the same, but IMHO this better reflects attribution and history. Also, the maintainers know who to $(git blame) now. 😄 I hope this is okay with you.

I'd cc maintainers @edolstra and @Ma27 as they've both significantly contributed to the relevant parts of the script.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Aug 15, 2019

Checked the diff with the current master, looks fine to me, nothing overwritten. If you diff the file, it should be exactly the same, but IMHO this better reflects attribution and history. Also, the maintainers know who to $(git blame) now. 😄 I hope this is okay with you.

No problem at all, thank you.

@lschuermann
Copy link
Member Author

lschuermann commented Aug 20, 2019

Now that #66588 is through, I should probably change this to use the newly introduced --silent option. Other than that, this seems to be ready actually.

@lschuermann
Copy link
Member Author

@GrahamcOfBorg test installer

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Aug 29, 2019

ping

@lschuermann
Copy link
Member Author

pong. Let's get this PR closed today :)

@lschuermann
Copy link
Member Author

@GrahamcOfBorg test installer

@lschuermann
Copy link
Member Author

Technically my promise wasn't kept, but better late than never, right? @mmahut Tested it in a VM, ofborg says it's good, so there's a go from me.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Aug 30, 2019

Technically my promise wasn't kept, but better late than never, right?

Sure thing.

@mmahut Tested it in a VM, ofborg says it's good, so there's a go from me.

I also tested it, on a physical disk and everything looks just about right.

@edolstra
Copy link
Member

👎, this adds a lot of code and it's not really necessary since you can just run nixos-install again (which should be pretty fast because everything's already there).

@disassembler
Copy link
Member

I agree with @edolstra. This doesn't seem necessary to me.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Aug 31, 2019

Too bad, we have spent quite some time on this. Could we al least pick up the fixes for shellcheck?

@lschuermann
Copy link
Member Author

lschuermann commented Aug 31, 2019

@edolstra We might just have a different definition of what a lot of code (8 lines) means.

It's not absolutely necessary alright, but I talked to at least 5 people having this minor issue. As installing is one of the first things a user might do, and from a new user perspective nixos-installer automates so much already, I have a strong opinion that we should give the user a second chance to type their password correctly. As does any other installer.

Closing this for now, feel free to reopen when you've changed your mind. Please confirm if @rnhmjoj or I should open a separate PR for the shellcheck fixes. I'm gonne be on vacation for the next two weeks and won't respond.

@mmahut
Copy link
Member

mmahut commented Aug 31, 2019

As someone who gives a new laptop to a person and ask them to install NixOS frequently, I see this way too often (typo in password retype using a new laptop that a person is not used to).

Too bad, changing few lines to improve user experience is always worth it in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants