Bug#413249: severity of 413249 is important, tagging 413249

2007-03-05 Thread Frank Küster
Steve Langasek [EMAIL PROTECTED] wrote:

 # Automatically generated email from bts, devscripts version 2.9.27
 severity 413249 important
 tags 413249 unreproducible

It is very well reproducible here, it occurred again today.  This time,
even Ctrl-c wouldn't stop the script, it ate 95% CPU, and ps axf
showed that it had somehow detached from the controlling X terminal.  It
needed a kill $pid to get control of my CPU.

I have added a set -x in config and preinst, and this showed me one
point were there is a bug in the config script.  I am not sure, however,
that this is the root of my problem.  

The bug I found so far is

while :; do
  run db_input low x11-common/xwrapper/nice_value
  # is the question going to be asked?
  if [ $? -eq 30 ]; then
break # no; bail out of validation loop
  fi

Because db_input is wrapped in the run function, the return value of
db_input is no longer in $?, and the script will not break the loop.  It
is in $_retval, though:

run () {
[...]
  $@ || _retval=$?

  if [ ${_retval:-0} -ne 0 ]; then
observe command \$*\ exited with status $_retval
  fi

The patch for this would be

 while :; do
   run db_input low x11-common/xwrapper/nice_value
   # is the question going to be asked?
+  WILL_BE_ASKED=$_retval
-  if [ $? -eq 30 ]; then
+  if [ $WILL_BE_ASKED -eq 30 ]; then
break # no; bail out of validation loop
  fi

However, changing this doesn't fix my problem, and I got sceptical
whether it originates in x11-common, since I get so many internal
debconf errors.

I removed the content of /var/cache/debconf, dpkg-reconfigure'd debconf,
and tried again, but that didn't help.

Somehow still debconf's answers are not what the config script expects.
Upon reinstalling x11-common with set -xv, I get 

# next question requires input validation; assume safe valid value already
# present (possibly the template default)
SAFE=
+ SAFE=
if db_get x11-common/xwrapper/nice_value; then
  SAFE=$RET
fi
+ db_get x11-common/xwrapper/nice_value
+ _db_cmd 'GET x11-common/xwrapper/nice_value'
+ IFS=' '
+ printf '%s\n' 'GET x11-common/xwrapper/nice_value'
debconf (developer): -- GET x11-common/xwrapper/nice_value
debconf (developer): -- 0 0
+ IFS='
'
+ read -r _db_internal_line
+ RET='value set'
+ case ${_db_internal_line%%[   ]*} in
+ return 0
+ SAFE='value set'

Why on earth is $RET now value set, where it should be 0?  Note
that value set was the last answer that debconf communicated about
that template, but not the last answer it communcated in that script
(which was about allowed_users.

What is happening here?  Please remember that this is an etch system
installed on the 10th of February, nothing were the system had time to
degrade into a mess of distribution mixture and local misconfiguration
(though I do not exclude the latter...)

Regards, Frank
-- 
Dr. Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)



Bug#413249: severity of 413249 is important, tagging 413249

2007-03-05 Thread Frank Küster
clone 413249 -1
retitle 413249 wrong returnvalue logic in config script
tags 413249 -unreproducible
retitle -1 debconf: database communication does not work
reassign -1 debconf
thanks

Frank Küster [EMAIL PROTECTED] wrote:

 It is very well reproducible here, it occurred again today.  
[...]
 The bug I found so far is

(this is going to stay 413249, package x11-common)

 while :; do
   run db_input low x11-common/xwrapper/nice_value
   # is the question going to be asked?
   if [ $? -eq 30 ]; then
 break # no; bail out of validation loop
   fi

 Because db_input is wrapped in the run function, the return value of
 db_input is no longer in $?, and the script will not break the loop.  It
 is in $_retval, though:

 run () {
 [...]
   $@ || _retval=$?

   if [ ${_retval:-0} -ne 0 ]; then
 observe command \$*\ exited with status $_retval
   fi

 The patch for this would be

  while :; do
run db_input low x11-common/xwrapper/nice_value
# is the question going to be asked?
 +  WILL_BE_ASKED=$_retval
 -  if [ $? -eq 30 ]; then
 +  if [ $WILL_BE_ASKED -eq 30 ]; then
 break # no; bail out of validation loop
   fi

 However, changing this doesn't fix my problem, and I got sceptical
 whether it originates in x11-common, since I get so many internal
 debconf errors.

This is why I reassign the other part of this to debconf.  I'm quite
sure that what is going on on my system is not a general breakage of
debconf, but for sure it is something that needs investigation

[work on debconf snipped, see bug log]
 debconf (developer): -- GET x11-common/xwrapper/nice_value
 debconf (developer): -- 0 0
 + IFS='
 '
 + read -r _db_internal_line
[...]
 Why on earth is $RET now value set, where it should be 0?  Note
 that value set was the last answer that debconf communicated about
 that template, but not the last answer it communcated in that script
 (which was about allowed_users.

Now the debug output below adds to the confusion, but it might be easier
to debug.  I have done

# dpkg --purge --force-depends x11-common

and then installed again, with set -xv in the maintainer scripts.
Things to observe:

- db_set returns with exit code 1.  Is this okay?  I think it
  shouldn't, and it's a peculiarity of x11-common to not stop when this
  happens.  However, what does it indicate on the debconf side?

- after the skipped parts, the db_input part is not interesting, but
  shows that that goes without errors

- db_go gives an internal debconf error (I have just apt-get
  --reinstall install'ed the etch version, so the files should be okay) 

- db_get returns *nothing*, although it was set to 0 earlier.

+ run db_set x11-common/xwrapper/nice_value 0
+ '[' 3 -lt 1 ']'
+ db_set x11-common/xwrapper/nice_value 0
+ _db_cmd 'SET x11-common/xwrapper/nice_value' 0
+ IFS=' '
+ printf '%s\n' 'SET x11-common/xwrapper/nice_value 0'
debconf (developer): -- SET x11-common/xwrapper/nice_value 0
debconf (developer): -- 0 value set
+ IFS='
'
+ read -r _db_internal_line
+ RET='value set'
+ case ${_db_internal_line%%[   ]*} in
+ return 0
+ '[' 1 -ne 0 ']'
+ observe 'command db_set x11-common/xwrapper/nice_value 0 exited with status 
1'
+ '[' -n '' ']'

[... some parts skipped ...]

+ run db_input low x11-common/xwrapper/nice_value
+ '[' 3 -lt 1 ']'
+ db_input low x11-common/xwrapper/nice_value
+ _db_cmd 'INPUT low' x11-common/xwrapper/nice_value
+ IFS=' '
+ printf '%s\n' 'INPUT low x11-common/xwrapper/nice_value'
+ IFS='
'
+ read -r _db_internal_line
debconf (developer): -- INPUT low x11-common/xwrapper/nice_value
debconf (developer): -- 30 question skipped
+ RET='30 question skipped'
+ case ${_db_internal_line%%[   ]*} in
+ return 30
+ _retval=30
+ '[' 30 -ne 0 ']'
+ observe 'command db_input low x11-common/xwrapper/nice_value exited with 
status 30'
+ '[' -n '' ']'
+ '[' 0 -eq 30 ']'
+ run db_go
+ '[' 1 -lt 1 ']'
+ db_go
+ _db_cmd 'GO '
+ IFS=' '
+ printf '%s\n' 'GO '
+ IFS='
'
+ read -r _db_internal_line
debconf (developer): -- GO 
Use of uninitialized value in join or string at 
/usr/share/perl5/Debconf/DbDriver/Stack.pm line 104, GEN1 line 7.
debconf (developer): -- 0 ok
+ RET=ok
+ case ${_db_internal_line%%[   ]*} in
+ return 0
+ '[' 30 -ne 0 ']'
+ observe 'command db_go exited with status 30'
+ '[' -n '' ']'
+ RET=
+ db_get x11-common/xwrapper/nice_value
+ _db_cmd 'GET x11-common/xwrapper/nice_value'
+ IFS=' '
+ printf '%s\n' 'GET x11-common/xwrapper/nice_value'
+ IFS='
'
+ read -r _db_internal_line
debconf (developer): -- GET x11-common/xwrapper/nice_value
debconf (developer): -- 0 
+ RET=

Any idea what's going on?

Regards, Frank

-- 
Dr. Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)



Bug#413249: severity of 413249 is important, tagging 413249

2007-03-05 Thread Steve Langasek
On Mon, Mar 05, 2007 at 02:02:07PM +0100, Frank Küster wrote:
 I removed the content of /var/cache/debconf, dpkg-reconfigure'd debconf,
 and tried again, but that didn't help.

 Somehow still debconf's answers are not what the config script expects.
 Upon reinstalling x11-common with set -xv, I get 

 # next question requires input validation; assume safe valid value already
 # present (possibly the template default)
 SAFE=
 + SAFE=
 if db_get x11-common/xwrapper/nice_value; then
   SAFE=$RET
 fi
 + db_get x11-common/xwrapper/nice_value
 + _db_cmd 'GET x11-common/xwrapper/nice_value'
 + IFS=' '
 + printf '%s\n' 'GET x11-common/xwrapper/nice_value'
 debconf (developer): -- GET x11-common/xwrapper/nice_value
 debconf (developer): -- 0 0
 + IFS='
 '
 + read -r _db_internal_line
 + RET='value set'
 + case ${_db_internal_line%%[ ]*} in
 + return 0
 + SAFE='value set'

 Why on earth is $RET now value set, where it should be 0?

Good question.  What does 'debconf-show x11-common' spit out at this point?

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
[EMAIL PROTECTED]   http://www.debian.org/



Bug#413249: severity of 413249 is important, tagging 413249

2007-03-05 Thread Frans Pop
On Tuesday 06 March 2007 03:58, Steve Langasek wrote:
  Why on earth is $RET now value set, where it should be 0?

 Good question.  What does 'debconf-show x11-common' spit out at this
 point?

I would guess that the error is in the code that _sets_ the value of this 
debconf question. I'm fairly certain that value set is what is returned 
in $RET by the db_set command (together with an error code of 0).

In general in debconf, $RET can contain error or informational messages 
from debconf itself as well as real values, roughly as follows:
- error code  0: $RET = error message
- error code = 0 and function should return a real value (e.g. db_get):
  $RET = real value
- error code =0 and function does not return a real value (e.g. db_set
  or db_go): $RET = informational message

This means that with incorrect error handling, or by executing a db_* 
function without saving the value of $RET in a different variable before
reusing $RET, you can end up with these kind of values.

Hope this helps.

Cheers,
FJP


pgp4LU74JW8Yk.pgp
Description: PGP signature