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

Bug#336748: xserver-xorg: Useless update of symlink on read-only partition



Package: xserver-xorg
Version: 6.8.2.dfsg.1-7
Severity: important
Tags: patch

When trying to do to 'dpkg-reconfigure xserver-xorg' during the boot
of an LTSP thin client, the postinst fail because it tries to update
the /etc/X11/X symlink even though it already is pointing to the right
location.  This is the error message:

  ln: creating symbolic link '/etc/X11/X.dpkg-new' to
    '/usr/bin/X11/Xorg': Premission denied

This patch get rid of the problem, by checking the symlink content
first, and only try to update if it is pointing in the wrong
direction.

--- /opt/ltsp/i386-etch/var/lib/dpkg/info/xserver-xorg.postinst 2005-11-01 09:33:19.355288283 +0100
+++ /tmp/xserver-xorg.postinst  2005-11-01 09:32:13.891662641 +0100
@@ -1594,7 +1594,8 @@
     db_get shared/default-x-server
     if [ -n "$RET" ]; then
       SELECTED_PACKAGE="$RET"
-      if [ "$SELECTED_PACKAGE" = "$THIS_PACKAGE" ]; then
+      if [ "$SELECTED_PACKAGE" = "$THIS_PACKAGE" ] && [ -L "$SERVER_SYMLINK" ] &&
+         [ "$(readlink "$SERVER_SYMLINK")" != "$THIS_SERVER" ]; then
         # prepare a new version of the config file; this is a symlink so we
         # can't use the tempfile command for it (we'd have to subsequently
         # use ln -sf, which is subject to race condition attacks)


It might be an idea to use the make_symlink_sane() function instead.
The comments in this part of the code seem out of date, sa the symlink
updates the X binary pointer, not the config file.

When this issue is fixed, the postints fail while trying to make a
backup copy of the configuration file.  This patch get rid of that
problem, but I am not sure if it is the best fix.  Perhaps the script
should check if /etc/X11/ is writable before trying to make a backup
copy?  Or perhaps make a backup copy in /var/log/ instead?

--- /opt/ltsp/i386-etch/var/lib/dpkg/info/xserver-xorg.postinst 2005-11-01 09:33:19.355288283 +0100
+++ /tmp/xserver-xorg.postinst  2005-11-01 09:32:13.891662641 +0100
@@ -1642,7 +1643,7 @@
       bomb "backup xorg.conf file $BACKUP_XORGCONFIG already" \
            "exists; please remove it and try again"
     fi
-    cp "$XORGCONFIG" "$BACKUP_XORGCONFIG"
+    cp "$XORGCONFIG" "$BACKUP_XORGCONFIG" || true
     warn "overwriting possibly-customised configuration file; backup" \
          "in $BACKUP_XORGCONFIG"
   fi

And finally, the dexconf run fail because it can't write to
/etc/X11/xorg.conf.dpkg-new.  Not sure how to handle that gracefully.

Getting X auto-configuration working in LTSP seem a lot harder then I
expected. :(



Reply to: