#1005942 adduser: spews error when ^Ding out of binary question, proceeds anyway

#1005942#5
Date:
2022-02-17 15:50:23 UTC
From:
To:
Dear Maintainer,

adduser asks two binary questions: about retrying passwd and about
retrying chfn.

If you ^D out of them, currently, you get this:
-- >8 --
nabijaczleweli@tarta:~$ sudo adduser dupsko12
Adding user `dupsko12' ...
Adding new group `dupsko12' (1019) ...
Adding new user `dupsko12' (1022) with group `dupsko12' ...
Creating home directory `/home/dupsko12' ...
Copying files from `/etc/skel' ...
New password: ^D
Password change has been aborted.
passwd: Authentication token manipulation error
passwd: password unchanged
Try again? [y/N] ^D Use of uninitialized value $answer in chop at /usr/sbin/adduser line 556.
Use of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 557.
Changing the user information for dupsko12
Enter the new value, or press ENTER for the default
        Full Name []: ^D   Room Number []:         Work Phone []:  Home Phone []:  Other []: Is the information correct? [Y/n] ^D Use of uninitialized value $answer in chop at /usr/sbin/adduser line 582.
Use of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 583.

nabijaczleweli@tarta:~$ grep dupsko12 /etc/passwd
dupsko12:x:1022:1019:,,,:/home/dupsko12:/bin/bash
-- >8 --

Proceeding through an error spew is suboptimal,
but keeping the current behaviour would be nice.

Please consider the patch below
(based on current Salsa, i.e. a7c40dcd86aefe6b4d6fa926a8101222dc1bad01),
which falls through to the default answer (as already happens)
without the error spew:
-- >8 --
nabijaczleweli@tarta:~/uwu/adduser$ sudo ./adduser dupsko10
Adding user `dupsko10' ...
Adding new group `dupsko10' (1017) ...
Adding new user `dupsko10' (1020) with group `dupsko10' ...
Creating home directory `/home/dupsko10' ...
Copying files from `/etc/skel' ...
New password: ^D
Password change has been aborted.
passwd: Authentication token manipulation error
passwd: password unchanged
Try again? [y/N] ^D Changing the user information for dupsko10
Enter the new value, or press ENTER for the default
        Full Name []: ^D   Room Number []:         Work Phone []:  Home Phone []:  Other []: Is the information correct? [Y/n] ^D nabijaczleweli@tarta:~/uwu/adduser$

nabijaczleweli@tarta:~/uwu/adduser$ grep dupsko10 /etc/passwd
dupsko10:x:1020:1017:,,,:/home/dupsko10:/bin/bash
-- >8 --

Best,
наб

#1005942#10
Date:
2022-02-17 18:29:50 UTC
From:
To:
I'd rather have adduser abort and roll back  when the user has indicated
that they are not willing to interact with adduser any more.

I am not sure whether we should be asking those questions at all but
instead directly abort.

Greetings
Marc