Bug#375689: Instructions on how to reconfigure xserver-xorg are incorrect

2006-07-17 Thread Colin Watson
On Fri, Jul 14, 2006 at 05:03:31AM +0100, James Westby wrote:
 I have a workaround for the problem, I will send it now while I
 remember. I will try and figure out a fix tomorrow.
 
 change 
 
 # here's a novel concept: DON'T TOUCH THE CONFIG ON UPGRADES
 if [ -z $UPGRADE ] || dpkg --compare-versions $2 le 1:7.0.14; then
 
 to 
 
 # here's a novel concept: DON'T TOUCH THE CONFIG ON UPGRADES
 if [ -z $UPGRADE ] || dpkg --compare-versions $2 le 1:8.0.14; then
 
 in /var/lib/dpkg/info/xserver-xorg.postinst

I think the reason for the trouble is that the code in
xserver-xorg.postinst that decides whether to set UPGRADE is broken. It
does this:

if [ $1 = configure ]  [ -n $2 ]; then
  UPGRADE='true'
fi

However, dpkg-reconfigure calls the postinst with configure
current-version, so this wrongly thinks that reconfigure == upgrade.

The Ubuntu xorg package has this in xsfbs.sh, which works better (and is
forward-compatible to some future time when the DEBCONF_RECONFIGURE
business is dropped from debconf and replaced with a proper reconfigure
argument):

if [ $1 = reconfigure ] || [ -n $DEBCONF_RECONFIGURE ]; then
  RECONFIGURE=true
else
  RECONFIGURE=
fi

if ([ $1 = install ] || [ $1 = configure ])  [ -z $2 ]; then
  FIRSTINST=yes
fi

if [ -z $RECONFIGURE ]  [ -z $FIRSTINST ]; then
  UPGRADE=yes
fi

Cheers,

-- 
Colin Watson   [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Bug#375689: Instructions on how to reconfigure xserver-xorg are incorrect

2006-07-14 Thread James Westby
Hi,

I have attached a patch that is a first stab at solving these problems.
It requires more work by someone with more experience of the issues, but
it dies the basic of letting dpkg-reconfigure work if the md5sums match,
and not if they don't.

The first part of the patch migrates md5sums from the old locations,
this might want to be done for all of the related files.

The second part modifies the logic to try and accomplish what I think is
wanted.

Before it was

if upgrading from a specific version
  if xorg.conf not modified
reconfigure and write file
  else
update some paths etc
  fi
fi

and now attempts to do

if xorg.conf not modified
  reconfigure and write file
  # under the assumption that the new paths will be written correctly
else
  update the paths
fi

I hope I have the point of this section correct.

I have refrained from tagging the bug with +patch as the patch doesn't
solve the whole problem, please do this if appropriate.

Please contact me if you wish to discuss the patch further.

Thanks,

James

-- 
  James Westby
  [EMAIL PROTECTED]
  http://jameswestby.net/
--- xserver-xorg.postinst.orig  2006-07-15 01:32:53.0 +0100
+++ xserver-xorg.postinst   2006-07-15 01:48:19.0 +0100
@@ -1081,6 +1081,12 @@
 XORGCONFIG_ROSTER=$CONFIG_AUX_DIR/${XORGCONFIG##*/}.roster
 THIS_SERVER=/usr/bin/Xorg
 
+XORGCONFIG_CHECKSUM_OLD=/var/lib/xfree86/xorg.conf.md5sum
+
+if [ -f $XORGCONFIG_CHECKSUM_OLD ]; then
+  mv $XORGCONFIG_CHECKSUM_OLD $XORGCONFIG_CHECKSUM
+fi
+
 if [ -e $CONFIG_AUX_DIR/.migrateconfig ]; then
   AUTODETECT_VIDEO=yes
   rm -f $CONFIG_AUX_DIR/.migrateconfig
@@ -1665,44 +1671,44 @@
   warn not updating $SERVER_SYMLINK; file exists but is not a symlink
 fi
 
-# here's a novel concept: DON'T TOUCH THE CONFIG ON UPGRADES
-if [ -z $UPGRADE ] || dpkg --compare-versions $2 le 1:7.0.14; then
-  # compare the current and stored checksums; if they do not match, assume
-  # that's the way the user wants it.  if we're reconfiguring, overwrite
-  # it regardless and back it up.
-  if [ $(md5sum $XORGCONFIG) = $(cat $XORGCONFIG_CHECKSUM) ] || \
- ! [ -e $XORGCONFIG ] || [ -n $RECONFIGURE ]; then
-# they match or user deleted the file; prepare a new version
-NEW_XORGCONFIG=$XORGCONFIG.dpkg-new
-if [ -n $XRESPROBE_DEBUG ]; then
-  set -x
-fi
-xresprobeint
-if [ -n $XRESPROBE_DEBUG ]; then
-  set +x
-fi
-if [ -n $RECONFIGURE ]  [ -e $XORGCONFIG ]; then
-  BACKUP_XORGCONFIG=$XORGCONFIG.$(date '+%Y%m%d%H%M%S')
-  if [ -e $BACKUP_XORGCONFIG ]; then
-bomb backup xorg.conf file $BACKUP_XORGCONFIG already \
- exists; please remove it and try again
-  fi
-  cp $XORGCONFIG $BACKUP_XORGCONFIG
-  warn overwriting possibly-customised configuration file; backup \
-   in $BACKUP_XORGCONFIG
-fi
-if dexconf -o $NEW_XORGCONFIG; then
-  if ! cmp -s $XORGCONFIG $NEW_XORGCONFIG; then
-mv $NEW_XORGCONFIG $XORGCONFIG
-md5sum $XORGCONFIG  $XORGCONFIG_CHECKSUM
-  fi
-else
-  warn error while preparing new Xorg X server configuration \
-   file in $NEW_XORGCONFIG; not attempting to update existing \
-   configuration
+# compare the current and stored checksums; if they do not match, assume
+# that's the way the user wants it.  if we're reconfiguring, overwrite
+# it regardless and back it up.
+if [ $(md5sum $XORGCONFIG) = $(cat $XORGCONFIG_CHECKSUM) ] || \
+   ! [ -e $XORGCONFIG ] || [ -n $RECONFIGURE ]; then
+  # they match or user deleted the file; prepare a new version
+  NEW_XORGCONFIG=$XORGCONFIG.dpkg-new
+  if [ -n $XRESPROBE_DEBUG ]; then
+set -x
+  fi
+  xresprobeint
+  if [ -n $XRESPROBE_DEBUG ]; then
+set +x
+  fi
+  if [ -n $RECONFIGURE ]  [ -e $XORGCONFIG ]; then
+BACKUP_XORGCONFIG=$XORGCONFIG.$(date '+%Y%m%d%H%M%S')
+if [ -e $BACKUP_XORGCONFIG ]; then
+  bomb backup xorg.conf file $BACKUP_XORGCONFIG already \
+   exists; please remove it and try again
+fi
+cp $XORGCONFIG $BACKUP_XORGCONFIG
+warn overwriting possibly-customised configuration file; backup \
+ in $BACKUP_XORGCONFIG
+  fi
+  if dexconf -o $NEW_XORGCONFIG; then
+if ! cmp -s $XORGCONFIG $NEW_XORGCONFIG; then
+  mv $NEW_XORGCONFIG $XORGCONFIG
+  md5sum $XORGCONFIG  $XORGCONFIG_CHECKSUM
 fi
-rm -f $NEW_XORGCONFIG
   else
+warn error while preparing new Xorg X server configuration \
+ file in $NEW_XORGCONFIG; not attempting to update existing \
+ configuration
+  fi
+  rm -f $NEW_XORGCONFIG
+else
+  # here's a novel concept: DON'T TOUCH THE CONFIG ON UPGRADES
+  if [ -z $UPGRADE ] || dpkg --compare-versions $2 le 1:7.0.14; then
 # I'm going to get in so much shit for this...
 BACKUP_XORGCONFIG=$XORGCONFIG.$(date '+%Y%m%d%H%M%S')
 warn $XORGCONFIG has been customized, but we need to make updates. 
Backing up your config to $BACKUP_XORGCONFIG. If we screw something up, restore 
using this 

Bug#375689: Instructions on how to reconfigure xserver-xorg are incorrect

2006-07-13 Thread James Westby
I have a workaround for the problem, I will send it now while I
remember. I will try and figure out a fix tomorrow.

change 

# here's a novel concept: DON'T TOUCH THE CONFIG ON UPGRADES
if [ -z $UPGRADE ] || dpkg --compare-versions $2 le 1:7.0.14; then

to 

# here's a novel concept: DON'T TOUCH THE CONFIG ON UPGRADES
if [ -z $UPGRADE ] || dpkg --compare-versions $2 le 1:8.0.14; then

in /var/lib/dpkg/info/xserver-xorg.postinst

and 

md5sum /etc/X11/xorg.conf /var/lib/x11/xorg.conf.md5sum

as the submitter pointed out.

James

-- 
  James Westby
  [EMAIL PROTECTED]
  http://jameswestby.net/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#375689: Instructions on how to reconfigure xserver-xorg are incorrect

2006-06-27 Thread Sam Morris
Package: xserver-xorg
Version: 1:7.0.22
Severity: important

The top of my xorg.conf file contains the following information:

# If you have edited this file but would like it to be automatically updated
# again, run the following commands as root:
#
#   cp /etc/X11/xorg.conf /etc/X11/xorg.conf.custom
#   md5sum /etc/X11/xorg.conf /var/lib/xfree86/xorg.conf.md5sum
#   dpkg-reconfigure xserver-xorg

I have followed these steps, but running 'dpkg-reconfigure xserver-xorg'
has no effect on the xorg.conf file.

I installed xserver-xorg afresh and found that the following information
had replaced the above information:

# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Isn't this the message that one usually sees on Ubuntu systems? Regardless,
it is also incorrect.

Next I dug into the xserver-xorg.config script, and saw that it
appears to store its md5sums in /var/lib/x11. However, even through I
reset the contents of xorg.conf.md5sum in that directory, the script
still did not overwrite /etc/X11/xorg.conf with a new configuration
file.

So the issues here are:

 1. Users upgrading to X11R7 end up with incorrect and misleading information
in their xorg.conf files.
 
 2. Users installing X11R7 afresh end up with incorrect and misleading
instructions in their xorg.conf files and/or the xserver-xorg.config
script is broken.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (530, 'testing'), (520, 'unstable'), (510, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-k7
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages xserver-xorg depends on:
ii  debconf  1.5.2   Debian configuration management sy
ii  nvidia-glx [xserver-xorg-vid 1.0.8762-2  NVIDIA binary XFree86 4.x driver
ii  x11-common   1:7.0.22X Window System (X.Org) infrastruc
ii  xbase-clients1:7.0.1-2   miscellaneous X clients
ii  xkb-data 0.8-5   X Keyboard Extension (XKB) configu
ii  xserver-xorg-core1:1.0.2-8   X.Org X server -- core server
ii  xserver-xorg-input-aiptek [x 1:1.0.0.5-2 X.Org X server -- Aiptek input dri
ii  xserver-xorg-input-all   1:7.0.22the X.Org X server -- input driver
ii  xserver-xorg-input-evdev [xs 1:1.0.0.5-2 X.Org X server -- evdev input driv
ii  xserver-xorg-input-kbd [xser 1:1.0.1.3-2 X.Org X server -- keyboard input d
ii  xserver-xorg-input-mouse [xs 1:1.0.4-3   X.Org X server -- mouse input driv
ii  xserver-xorg-video-nv [xserv 1:1.0.1.5-2 X.Org X server -- NV display drive
ii  xserver-xorg-video-vesa [xse 1:1.0.1.3-2 X.Org X server -- VESA display dri

Versions of packages xserver-xorg recommends:
pn  discover1 | discover  none (no description available)
pn  laptop-detect none (no description available)
pn  mdetect   none (no description available)
pn  xresprobe none (no description available)

-- debconf information:
* xserver-xorg/multiple_possible_x-drivers:
  xserver-xorg/config/monitor/use_sync_ranges: true
* xserver-xorg/config/inputdevice/mouse/port: /dev/input/mice
* xserver-xorg/config/monitor/lcd: false
* xserver-xorg/autodetect_monitor: true
* xserver-xorg/config/display/default_depth: 24
* xserver-xorg/config/display/modes: 1600x1200, 1280x1024, 1152x864, 1024x768, 
832x624, 800x600, 720x400, 640x480
* xserver-xorg/config/inputdevice/keyboard/internal:
* xserver-xorg/config/inputdevice/keyboard/options:
* xserver-xorg/config/device/use_fbdev: false
* xserver-xorg/config/inputdevice/keyboard/variant:
* xserver-xorg/config/nonnumeric_string_error:
* xserver-xorg/config/inputdevice/keyboard/layout: gb
* xserver-xorg/config/monitor/identifier: JC-17W41
* xserver-xorg/config/inputdevice/mouse/emulate3buttons: false
* xserver-xorg/autodetect_mouse: true
* xserver-xorg/config/monitor/horiz-sync: 30-92
* xserver-xorg/config/monitor/range_input_error:
* xserver-xorg/config/write_dri_section: false
* xserver-xorg/config/inputdevice/keyboard/model: pc104
* xserver-xorg/config/device/driver: nvidia
* xserver-xorg/config/monitor/selection-method: Medium
* xserver-xorg/config/write_files_section: true
* xserver-xorg/config/monitor/mode-list: 1280x960 @ 85Hz
* xserver-xorg/config/doublequote_in_string_error:
* xserver-xorg/config/monitor/screen-size: 17 inches (430 mm)
* shared/default-x-server: xserver-xorg
* xserver-xorg/config/inputdevice/mouse/protocol: ImPS/2
* shared/no_known_x-server:
* xserver-xorg/config/device/bus_id_error:
* xserver-xorg/config/monitor/vert-refresh: 50-85
* xserver-xorg/autodetect_keyboard: false
  xserver-xorg/config/fontpath/fontserver:
* xserver-xorg/config/modules: bitmap, dbe, ddc, extmod, freetype, glx, int10, 
record, vbe
* xserver-xorg/config/device/video_ram: