x11-common loop asking 'Please enter an integer between -20 and 19.' at debconf medium or higher

Bug #68267 reported by Jonty
134
Affects Status Importance Assigned to Milestone
xorg (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: x11-common

When dpkg is installing x11-common, when debconf is using kde, something like:

Use of uninitialized value in join or string at /usr/share/perl5/Debconf/DbDriver/Stack.pm line 104, <GEN1> line 4.
Use of uninitialized value in join or string at /usr/share/perl5/Debconf/DbDriver/Stack.pm line 104, <GEN1> line 9.

happens, and a debconf window pops up saying "Incorrect nice value. Please enter an integer between -20 and 19". Only cancel can be clicked on this window, and doing so means the installation fails (which can affect a huge number of packages.)

This can be solved by making debconf's method dialog (that's all I know for sure, it may work with the other methods.)

Related branches

Revision history for this message
Jonty (jonnty) wrote :

I should add this was on Edgy.

description: updated
Revision history for this message
Paul Dufresne (paulduf) wrote :
Revision history for this message
Brian Ealdwine (eode) wrote :

I can confirm this.

I did a
 sudo dpkg-reconfigure debconf
and changed to "dialog" from "kde", selected "high", and then:

 dpkg -f dist-upgrade

..seems to be working.

Paul Dufresne (paulduf)
Changed in xorg:
status: Unconfirmed → Confirmed
Revision history for this message
Davor Cubranic (cubranic) wrote :

I still see this error on Kubuntu Feisty Herd 4, regardless of whether I set debconf method to "kde" or "dialog". It might be related to bug 69051, as my xorg.conf has changed, although my symptoms are like what's reported here, not the partially blank debconf window they mention.

Revision history for this message
Paul Dufresne (paulduf) wrote :

I am hitting this bug right now on feisty updating x11-common
from 7.2-0ubuntu1 to I guess ...ubuntu2.

Here is an extract of my ps tree while having Debconf asking a
new priority (other debconf bug, there is no text entry to enter
a new priority):
paul 5868 5057 0 11:14 ? 00:00:02 kdesu -u root -c adept_updater
root 5873 5868 0 11:14 pts/2 00:00:00 /usr/bin/sudo -u root /usr/bin/kdesu_stub -
root 5879 5868 0 11:14 pts/3 00:00:00 /usr/bin/kdesu_stub -
root 5882 5879 0 11:14 ? 00:00:00 sh -c adept_updater
root 5883 5882 14 11:14 ? 00:07:41 adept_updater
root 5949 5883 0 11:44 pts/4 00:00:00 /bin/sh -c /usr/sbin/dpkg-preconfigure --apt || true
root 5950 5949 0 11:44 pts/4 00:00:04 /usr/bin/perl -w /usr/sbin/dpkg-preconfigure --apt
root 5954 5950 0 11:44 pts/4 00:00:00 [dpkg-preconfigu] <defunct>
root 6034 5950 0 11:45 pts/4 00:00:00 /bin/sh /tmp/x11-common.config.59553 configure 1:7.2-0ubuntu1

As I understand Jonty's report, the bug is not really in x11-common,
but in debconf. So I'll move it there.

Revision history for this message
Paul Dufresne (paulduf) wrote :

Well, I don't know much about debconf and shell files.
But reading part of it, I 'feel' x11-common config script
is making it's own dialog and test for asking a nice value.

And it is not easy code, at least for me.
I attach extract_x11_common from the file
in previous comment.

Revision history for this message
Paul Dufresne (paulduf) wrote :

Seems like debconf template:
Template: x11-common/xwrapper/nice_value/error
Type: note
Description: Incorrect nice value
 Please enter an integer between -20 and 19.
---
is being shown without template:
Template: x11-common/xwrapper/nice_value
Type: string
Description: Nice value for the X server:
 When using operating system kernels with a particular scheduling strategy,
 it has been widely noted that the X server's performance improves when it
 is run at a higher process priority than the default; a process's priority
 is known as its "nice" value. These values range from -20 (extremely high
 priority, or "not nice" to other processes) to 19 (extremely low
 priority). The default nice value for ordinary processes is 0, and this
 is also the recommend value for the X server.
---
being shown before.

Revision history for this message
Paul Dufresne (paulduf) wrote :

I think I have found ('a' or 'the') bug:
---
validate_nice_value () {
  _retval=1
  # first, try to subtract number from itself to validate numeric input
  # (expr is noisy, always throw away its output)
  set +e
  expr "$1" - "$1" > /dev/null 2>&1
  if [ $? -ne 2 ]; then
    # now check for valid range
---
but I get:
---
paul@paul-Caspar:~$ expr "raton" "-" "raton"
expr: non-numeric argument
paul@paul-Caspar:~$ echo $?
3
paul@paul-Caspar:~$ expr "" "-" ""
expr: non-numeric argument
paul@paul-Caspar:~$ echo $?
3
---
2 is a syntax error
3 if an error occured
here an error appears on empty or non-numeric value

Replacing:
if [ $? -ne 2 ]; then
by
if [ $? -ne 3 ]; then
would probably work.

Revision history for this message
Paul Dufresne (paulduf) wrote :

if [ $? -eq 1 ]; then
would probably be even better.
expr returns 1 if the result of expression is null or 0

Revision history for this message
Richard Birnie (rbirnie-deactivatedaccount) wrote :

I've just hit the same bug on Feisty Herd 5 with todays set of upgrades (6/3/2007). Is there any other information I can supply to help get this fixed?

I'm running Kubuntu Feisty Herd5. I tried running the updates by clicking on the adept notifier icon and through the main adept manager with identical results. I get the same debconf problem described here. A dialogue saying Incorrect nice value that won't accept any input from me.

If I hit show details in adept I have the same output as described in post 6 of this thread http://ubuntuforums.org/showthread.php?p=1856049. even referring to the same Qt::VBoxLayout element

I tried running sudo dpkg --configure -a and sudo dpkg-reconfigure debconf. I didn't change any settings in debconf because post 9 of the above forum thread said use 'dialog' but that didn't work. I didn't see the suggestion in this thread to set it as 'kde' until after I found an alternative work around.

Which was to run 'sudo apt-get upgrade' from the commandline. This worked perfectly. Can I supply anything else that would be useful? If some one can tell me where adept/dpkg keeps it's log files I can attach those if they're any use.

I have to say I don't really understand why running from commandline works while the GUI doesn't if the bug is in X rather than adept. But then that's just me.

Revision history for this message
Paul Dufresne (paulduf) wrote :

Bug #85979 is the same.

Daniel T Chen (crimsun)
Changed in xorg:
importance: Undecided → Medium
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Re: x11-common have an important debconf bug

changing it to

if [ $? -eq 1 ]; then

broke it completely.

Revision history for this message
gala.martin (gala-martin) wrote :

I can confirm this in feisty herd3, when updating from
X11-common 1.7.2-0ubuntu3 to X11-common 1.7.2-0ubuntu4

Revision history for this message
gala.martin (gala-martin) wrote :

I can confirm this in feisty herd5 (note the difference from above), when updating from X11-common 1.7.2-0ubuntu3 to X11-common 1.7.2-0ubuntu4

Revision history for this message
Jyrki Muukkonen (jvtm) wrote :

How about just using /usr/bin/test and get rid of the expr. AFAIK, it should whine if the input is not numeric, eg:

jmuu@noodle:~$ i=4; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $?
0
jmuu@noodle:~$ i=abc; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $?
2
jmuu@noodle:~$ i=42; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $?
1

Or am I missing something here?

Revision history for this message
Jyrki Muukkonen (jvtm) wrote :

Oh my.. I just replaced that validate_nice_value() function with a one-liner using /usr/bin/test.

Works for me on Feisty (server install, but eg. java and gd requires x11-common).

The attached patch can also be found at https://no.spoon.fi/~jvtm/patches/ubuntu/ubuntu-feisty-x11-common.config-validate_nice_value-fix.diff

Revision history for this message
johanjpk (johan-stevon) wrote : Re: [Bug 68267] Re: x11-common have an important debconf bug

How do I apply this? I'm not a developer.

Revision history for this message
Jyrki Muukkonen (jvtm) wrote : Re: x11-common have an important debconf bug

Something like this (install at least build-essential and fakeroot packages first):
apt-get source x11-common
cd xorg-7.2
patch -p1 -i /path/to/thefix.diff (or edit the debian/x11-common.config.in by hand)
dpkg-buildpackage -rfakeroot -uc -us -b

- install the .deb with dpkg -i x11-common-XYZ.deb
- test with dpkg-reconfigure x11-common (try inputing various strings, illegal numbers)

Revision history for this message
Tribe (boikot+ubuntu) wrote :

Same error here in a Kubuntu Feisty Herd 5.

Revision history for this message
Paul Dufresne (paulduf) wrote :

I begin to think the problem WAS NOT with validate_nice_value,
but rather with the priority of debconf.
"sudo dpkg-reconfigure --force -plow x11-common" seems
to work but "sudo dpkg-reconfigure --force -pmedium x11-common"
seems to bug.

Revision history for this message
Paul Dufresne (paulduf) wrote :

Time for me to sleep, but I think that if in:
---
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
  run db_go
---
you move the run db_go before the if, that should fix the bug

still validate_nice_value() simplified is cool, and does correct a bug too.

Revision history for this message
dan_linder (dan-linder) wrote :

I can confirm that this is happening on a fresh install of Kubuntu-Herd5 (downloaded via .torrent March 7).
I had just booted up the first time and ran Adept Manager to get the latest updates (March 8 @ 18:41 GMT). After the downloads finished, it errored with the screen shot here(also attached):
http://www.linder.org/~dan/Kubuntu-Herd5-Incorrect_Nice_Value-Adept_Manager.JPG

Dan

Revision history for this message
dan_linder (dan-linder) wrote :

I don't believe this is related to the exact package being installed, rather the installer itself or a back-end process.

And the various tests for nice values (i.e. Pauls comment #8 : https://launchpad.net/ubuntu/+source/xorg/+bug/68267/comments/8), is there other code to ensure that the value being tested is truly a number?
I.e. if the validate_nice_value() subroutine gets sent text (i.e. "x1" rather than "1"), won't this also produce a similar error?

How about this:
---
validate_nice_value () {
  _retval=1
  # first, try to subtract number from itself to validate numeric input
  # (expr is noisy, always throw away its output)
  set +e
  # Check for blank/null $1 variable.
  if [ ! -z "$1" ]; then
    # Exit because we were given a blank line.
  fi
  # >>>NOTE 1<<<
  expr "$1" - "$1" > /dev/null 2>&1
  if [ $? -ne 2 ]; then
    # now check for valid range
---

I can't think of a concise way to test for a string versus number to put in at the "NOTE 1" location.

Dan

Revision history for this message
anthony baxter (anthony) wrote :

Simple workaround I've been using when I hit this:

DISPLAY="" apt-get update

Revision history for this message
anthony baxter (anthony) wrote :

gah. upgrade, not update.

Paul Dufresne (paulduf)
description: updated
Revision history for this message
Paul Dufresne (paulduf) wrote :

the bug seems to be cause by:
---
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
---
$? is 0, the result of run rather than the result of db_input
removing run seems to give better results

But where is run define, what it does and why it is used, I don't know.

Revision history for this message
Paul Dufresne (paulduf) wrote :

ah, run is define in the config file.
so, we can keep:
run db_input low x11-common/xwrapper/nice_value
but change:
if [ $? -eq 30 ]; then
for:
if [ $_retval -eq 30 ]; then

Revision history for this message
Paul Dufresne (paulduf) wrote :

making previous comment in a patch
Just this seems enough to make both dpkg-reconfigure -plow and -pmedium to work (validate correctly nice value, don't have tested if nice value is really applied to the server).

still some warning at medium level:
Use of uninitialized value in join or string at /usr/share/perl5/Debconf/DbDriver/Stack.pm line 104, <GEN1> line 4.
...
Use of uninitialized value in substitution (s///) at /usr/share/perl5/Debconf/Format/822.pm line 83.
Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/Debconf/Format/822.pm line 84.
paul@paul-Caspar:~$

Revision history for this message
Paul Jackson (pj-usa) wrote :

A couple of things in the x11-common.config
script validate_nice_value() don't look right to me:

 1) That "set +e ... set -e" seems -really- bogus.
      That forces exit on non-zero exit status from
      simple commands, and this script intentionally
      invokes some simple commands that might exit
      non-zero, such as the expr line on the very next
      line after the "set +e".

 2) I believe that expr can exit with 3 if asked to
     subtract non-numbers. So I'd suggest changing
     the line:
         if [ $? -ne 2 ]; then
     to be instead the line:
         if [ $? -lt 2 ]; then

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

I would really appreciate if someone could test a real package with some of the proposals here, and upgrade it with adept/apt/.. Yes, it's not easy, but we've been bitten by this once and I don't feel like testing with main again :)

Revision history for this message
Jyrki Muukkonen (jvtm) wrote :

My earlier patch (in this thread), replaces the contents of validate_nice_value() function with a single line:

test "$1" -ge -20 -a "$1" -le 19 2> /dev/null

The patch I submitted was against the broken version (7.2.0ubuntu4 with "$? -ne 1"), but the same idea works with the not-so-broken one.

BTW, the other {x11-common,xserver-xorg}.{prerm,postinst} scripts have some evil looking expr's too.

Revision history for this message
Paul Dufresne (paulduf) wrote :

was said earlier:
 1) That "set +e ... set -e" seems -really- bogus.
       That forces exit on non-zero exit status from
       simple commands, and this script intentionally
       invokes some simple commands that might exit
       non-zero, such as the expr line on the very next
       line after the "set +e".
$ help set
"-e Exit immediately if a command exits with a non-zero status."
"Using + rather than - causes these flags to be turned off."
So as I understand: "set +e" make sure that it will NOT exit
script because of the non-zero expr results. Which seems ok.

Revision history for this message
Paul Jackson (pj-usa) wrote :

Paul Dufresne wrote:
> So as I understand: "set +e" make sure that it will NOT exit
> script because of the non-zero expr results. Which seems ok.

Aha - you're right. I didn't notice that it was <set +e, set -e>,
not the reverse order. Thanks for pointing that out.

Revision history for this message
Gimfred (bhuxham) wrote :

:Kubuntu herd 5

I have this problem, the 'debconf nice' error occurred for other packages, but it was x11-common loop that halted adept update.

I installed via cli (sudo apt-get upgrade) as per http://ubuntuforums.org/showthread.php?t=285853&page=2 and it seemed to work.

Revision history for this message
Colin Watson (cjwatson) wrote :

Could somebody get a log of this failure with DEBCONF_DEBUG=developer set in the environment? It would help to see what's actually happening.

Revision history for this message
Colin Watson (cjwatson) wrote :

I don't see an obvious need to fiddle with the expr calls here. They may be ugly, but I don't think they're what's failing.

Paul Dufresne's idea in https://launchpad.net/ubuntu/+source/xorg/+bug/68267/comments/27 looks correct, but I think his suggested fix is wrong; $_retval is an internal variable (per the underscore) and is best not checked outside the run function. The right answer seems to be to simply remove 'run' here, since 'run' is effectively '|| true' with some extra reporting. We're running inside 'set +e' already, so this is harmless.

Revision history for this message
Colin Watson (cjwatson) wrote :
Revision history for this message
Colin Watson (cjwatson) wrote :

I think that the -eq 1 change that Timo made to the expr call was in fact correct. As far as I can tell from the subsequent bug reports, it wasn't that it broke it completely, it merely had no obvious effect due to the more serious bug in db_input return code handling.

Revision history for this message
Colin Watson (cjwatson) wrote :

Ah, Timo, the reason why it broke is that you used '-ne 1' rather than '-eq 1' by mistake! The patch I'll attach in a moment incorporates my previous fix and does this properly.

Revision history for this message
Colin Watson (cjwatson) wrote :
Revision history for this message
Paul Dufresne (paulduf) wrote :

Colin, on some duplicates, some get segfaults after getting:
DESTROY created new reference to dead object ' Qt::VBoxLayout', <> line 2176 during global destruction
... followed by some /usr/share/perl5/Debconf/DbDriver/Stack.pm line 104, <GEN74> line 9.

Now, that's the third times I rewrite this comment, because an apparent bug in the editor (konqueror) itself, so now I will make one line by associated bug, see:
bug #67097
end of bug #85979
bug #87814
bug #91307
and finally but not the least: bug #92335 which is a full apport bug that looks a bit different but not too much different.

Revision history for this message
dan_linder (dan-linder) wrote : Re: [Bug 68267] Re: x11-common loop asking 'Please enter an integer between -20 and 19.' at debconf medium or higher

On Fri, March 23, 2007 06:56, Colin Watson wrote:
> Could somebody get a log of this failure with DEBCONF_DEBUG=developer
> set in the environment? It would help to see what's actually happening.

I will try to run adept_updater in the following manner:
sudo script -c ~/tmp/DebugAdept.sh

where "~/tmp/DebugAdept.sh" contains:
  #!/bin/sh
  DEBCONF_DEBUG=developer
  sudo adept_manager

I will then e-mail the contents of the script file to you.

Will this capture all the details you need?

Dan
P.S. I don't have any updates pending at the moment... :(

- - - -
"Wait for that wisest of all counselors, time." -- Pericles
"I do not fear computers, I fear the lack of them." -- Isaac Asimov

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

fixed in the latest upload, thanks for all the help!

xorg (1:7.2-0ubuntu9) feisty; urgency=low

  [ Colin Watson ]
  * debian/xserver-xorg.config.in: Improve expr return code handling in
    validate_nice_value (the right way this time); don't use run function
    when we need to check db_input's return value (LP: #68267).

Changed in xorg:
status: Confirmed → Fix Released
Revision history for this message
Paul Dufresne (paulduf) wrote :

This is also bug #87641 (with 37 duplicates) for which Debian have fixed debconf, see:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=413509

Not sure how to handle this (two different bug numbers for same problem with many duplicates and different fix).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.