[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#487691: user-setup: endless loop after entering empty root passwords



On Tue, Aug 05, 2008 at 10:42:13PM +0200, Frans Pop wrote:
> > debconf receives:
> >   INPUT critical user-setup/password-empty
> >   INPUT low passwd/shadow
> >   INPUT medium passwd/root-login
> >   GO
> >
> > So actually, the behaviour of the "Go back" button is right for the
> > newt frontend according to the questions asked.
> 
> This analysis looks incomplete to me and the part you show here is out of 
> context, so impossible to draw conclusions from. I still don't see how 
> this explains why you'd get the error dialog displayed *again* after 
> choosing <go back> from the "Allow root" question. And I also still don't 
> see if this is a state machine error or a cdebconf issue.
> 
> An attachment with the full syslog including 'set -x' output *and* debconf 
> debugging, or at least for the relevant part from the start of user-setup 
> would have been helpful.

First, the state machine loop ends with:

  if db_go; then
          STATE=$(($STATE + 1))
  else
          STATE=$(($STATE - 1))
  fi

So we have a db_go upon when reaching the end of the case statement executing
the code relevant to the current state.

The state machine starts at state 0, with:

  0)
      # Ask how the password files should be set up.
      db_input low passwd/shadow || true
      # Ask if root should be allowed to login.
      db_input medium passwd/root-login || true
      ;;

After the case, db_go is run so two questions are asked.  When answered, we
move to state 1:

  1)
      […parts handling passwd/root-login and preseeding skipped…]
      if ! root_password; then
              db_input critical passwd/root-password || true
              db_input critical passwd/root-password-again || true
      fi
      ;;

Two more questions asked.  When answered, we move to state 2:

  2)
      […parts handling passwd/root-login and preseeding skipped…]
      if ! root_password; then
              # Compare the two passwords, loop back if not
              # identical, or if empty.
              db_get passwd/root-password
              ROOT_PW="$RET"
              if [ -z "$ROOT_PW" ]; then
                      db_fset user-setup/password-empty seen false
                      db_input critical user-setup/password-empty
                      db_fset passwd/root-password seen false
                      db_fset passwd/root-password-again seen false
                      STATE=0
                      continue
              fi
              […part about password mismatch skipped…]
      fi
      ;;

Normal case (root password contains something): we move to the db_go, no
questions asked, and we advance to state 3.

In case of error (empty root password), we first "ask"
user-setup/password-empty using db_input.  And then we switch directly
to state 0 _without_ executing db_go (by use of the "continue"
statement).  We are then back executing:

  0)
      # Ask how the password files should be set up.
      db_input low passwd/shadow || true
      # Ask if root should be allowed to login.
      db_input medium passwd/root-login || true
      ;;

So, two other db_input, and then we move on to the db_go.

Hence, three questions are asked in one row, namely
"user-setup/password-empty", "passwd/shadow", "passwd/root-login".

The user is thus first showed the error message.  Then, after pressing
"Continue", "passwd/shadow" or "passwd/root-login" is displayed
(depending on the priority).  When pressing "Go back", the previous
question is displayed, which actually is the error message (again).

So, I thought of two different ways to fix this:
 * Change user-setup-ask to show the error messages with their own db_go,
   which could be inserted right below the relevant db_input.
 * Make the text and newt cdebconf frontends skip questions with the
   "error" type when rewinding through the question list after "Go
   back" has been preseed.

I have an implementation ready and tested for this second option.

In the hope to made myself clear enough,
-- 
Jérémy Bobbio                        .''`. 
lunar@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   

Attachment: signature.asc
Description: Digital signature


Reply to: