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

Bug#191669: xserver-xfree86: _POSIX2_VERSION=200112 upgrade failure (+ patch)



Package: xserver-xfree86
Version: 4.2.1-6
Severity: normal

I have _POSIX2_VERSION=200112 set in my environment; this causes some
GNU utilities (notably coreutils 5.0) to conform to the new POSIX
standard rather than the old one.  The new standard disallows
obsolescent usages like "head -1"; you're supposed to use "head -n 1"
instead.  Setting this variable caused "dselect" to fail when
attempting to upgrade to xserver-xfree86 4.2.1-6, with the following
symptoms.  I enclose a patch at the end of this message.

To reproduce the problem, set _POSIX2_VERSION=200112 in your environment
and then attempt to upgrade to 4.2.1-6.

	...
	Preconfiguring packages ...
	head: `-1' option is obsolete; use `-n 1'
	Try `head --help' for more information.
	...
	Installing new version of config file /etc/X11/rstart/rstartd.real ...

	Setting up xfonts-100dpi (4.2.1-6) ...
	Running update-fonts-dir in 100dpi font directory...head: `-1' option is obsolete; use `-n 1'
	Try `head --help' for more information.
	done.
	Running update-fonts-alias in 100dpi font directory...done.

	Setting up xfonts-75dpi (4.2.1-6) ...
	Running update-fonts-dir in 75dpi font directory...head: `-1' option is obsolete; use `-n 1'
	Try `head --help' for more information.
	done.
	Running update-fonts-alias in 75dpi font directory...done.

	Setting up xfonts-base (4.2.1-6) ...
	Running update-fonts-dir in misc font directory...head: `-1' option is obsolete; use `-n 1'
	Try `head --help' for more information.
	done.
	Running update-fonts-alias in misc font directory...done.

	Setting up xfonts-scalable (4.2.1-6) ...
	Running update-fonts-scale in Speedo font directory...tail: +2: No such file or directory
	done.
	Running update-fonts-dir in Speedo font directory...head: `-1' option is obsolete; use `-n 1'
	Try `head --help' for more information.
	done.
	Running xftcache in Speedo font directory...done.
	Running update-fonts-scale in Type1 font directory...tail: +2: No such file or directory
	tail: +2: No such file or directory
	done.
	Running update-fonts-dir in Type1 font directory.../usr/bin/X11/mkfontdir: bad format for /usr/lib/X11/fonts/Type1/fonts.scale file
	/usr/bin/X11/mkfontdir: failed to create directory in /usr/lib/X11/fonts/Type1
	head: `-1' option is obsolete; use `-n 1'
	Try `head --help' for more information.
	done.
	Running xftcache in Type1 font directory...done.

	Setting up xserver-common (4.2.1-6) ...
	head: `-1' option is obsolete; use `-n 1'
	Try `head --help' for more information.
	tail: +2: No such file or directory
	dpkg: error processing xserver-common (--configure):
	 subprocess post-installation script returned error exit status 1
	dpkg: dependency problems prevent configuration of xserver-xfree86:
	 xserver-xfree86 depends on xserver-common (>= 4.1.0-10); however:
	  Package xserver-common is not configured yet.
	dpkg: error processing xserver-xfree86 (--configure):
	 dependency problems - leaving unconfigured
	Setting up xterm (4.2.1-6) ...
	Installing new version of config file /etc/X11/app-defaults/XTerm-color ...

	Setting up g++-3.2 (3.2.3-0pre9) ...
	Setting up libstdc++5-dev (3.2.3-0pre9) ...
	Setting up g++ (3.2.3-1) ...

	Errors were encountered while processing:
	 xserver-common
	 xserver-xfree86
	E: Sub-process /usr/bin/dpkg returned an error code (1)
	Some errors occurred while unpacking. I'm going to configure the
	packages that were installed. This may result in duplicate errors
	or errors caused by missing dependencies. This is OK, only the errors
	above this message are important. Please fix them and run [I]nstall again
	Press enter to continue.
	Setting up g++ (3.2.3-1) ...

	Errors were encountered while processing:
	 xserver-common
	 xserver-xfree86
	E: Sub-process /usr/bin/dpkg returned an error code (1)
	Some errors occurred while unpacking. I'm going to configure the
	packages that were installed. This may result in duplicate errors
	or errors caused by missing dependencies. This is OK, only the errors
	above this message are important. Please fix them and run [I]nstall again
	Press enter to continue.

	Setting up xserver-common (4.2.1-6) ...
	head: `-1' option is obsolete; use `-n 1'
	Try `head --help' for more information.
	tail: +2: No such file or directory
	dpkg: error processing xserver-common (--configure):
	 subprocess post-installation script returned error exit status 1
	dpkg: dependency problems prevent configuration of xserver-xfree86:
	 xserver-xfree86 depends on xserver-common (>= 4.1.0-10); however:
	  Package xserver-common is not configured yet.
	dpkg: error processing xserver-xfree86 (--configure):
	 dependency problems - leaving unconfigured
	Errors were encountered while processing:
	 xserver-common
	 xserver-xfree86

	installation script returned error exit status 100.
	Press <enter> to continue.


Here is a proposed patch.  I haven't tested it -- it's done only by
inspecting the code looking for problematic uses like "head -1".

diff -pru debian/local/update-fonts-dir debian-fix/local/update-fonts-dir
--- debian/local/update-fonts-dir	2003-05-01 17:00:00.000000000 -0700
+++ debian-fix/local/update-fonts-dir	2003-05-02 10:23:30.000000000 -0700
@@ -56,7 +56,7 @@ while [ -n "$1" ]; do
       /usr/bin/X11/mkfontdir $XDIR
     fi
     # are there any fonts in the font dir?
-    if [ "$(head -1 $XDIR/fonts.dir)" = "0" ]; then
+    if [ "$(head -n 1 $XDIR/fonts.dir)" = "0" ]; then
       rm -f $XDIR/fonts.dir $XDIR/encodings.dir
       # remove the font dir if it is empty
       rmdir $XDIR > /dev/null 2>&1 || true
diff -pru debian/local/update-fonts-scale debian-fix/local/update-fonts-scale
--- debian/local/update-fonts-scale	2003-05-01 17:00:00.000000000 -0700
+++ debian-fix/local/update-fonts-scale	2003-05-02 10:23:29.000000000 -0700
@@ -56,7 +56,7 @@ while [ -n "$1" ]; do
     if [ "$(echo $ETCDIR/*.scale)" != "$ETCDIR/*.scale" ]; then
       for file in $ETCDIR/*.scale; do
         # omit count at top of file
-        tail +2 $file >> $XDIR/fonts.scale.update-tmp
+        tail -n +2 $file >> $XDIR/fonts.scale.update-tmp
       done
       # write new scale file in case we are interrupted
       # write new count to top of file
diff -pru debian/rules debian-fix/rules
--- debian/rules	2003-05-01 17:00:00.000000000 -0700
+++ debian-fix/rules	2003-05-02 10:23:28.000000000 -0700
@@ -43,7 +43,7 @@ export GROFF_NO_SGR=1
 HTML2TEXT=html2text -nobs -style pretty
 
 # Get package version info.
-SOURCE_VERSION:=$(shell head -1 debian/changelog | cut -d\( -f2 | cut -d\) -f1)
+SOURCE_VERSION:=$(shell head -n 1 debian/changelog | cut -d\( -f2 | cut -d\) -f1)
 
 # Get builder info.
 BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2> /dev/null))}})
@@ -272,7 +272,7 @@ ifndef test_rules
 	# confirm that the installed file list has not changed
 	if [ -e debian/MANIFEST.$(ARCH) ]; then \
 	  if ! cmp -s debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new; then \
-	    diff -u -0 debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new; \
+	    diff -U 0 debian/MANIFEST.$(ARCH) debian/MANIFEST.$(ARCH).new; \
 	    if [ -n "$$IGNORE_MANIFEST_CHANGES" ]; then \
 	      echo 'MANIFEST check failed; ignoring problem because \$$IGNORE_MANIFEST_CHANGES set' >&2; \
 	      echo 'Please ensure that the package maintainer has an up-to-date version of the' >&2; \
diff -pru debian/xserver-common.postinst.in debian-fix/xserver-common.postinst.in
--- debian/xserver-common.postinst.in	2003-05-01 17:00:00.000000000 -0700
+++ debian-fix/xserver-common.postinst.in	2003-05-02 10:23:27.000000000 -0700
@@ -59,13 +59,13 @@ EOF
        egrep -q '^### END DEBCONF SECTION' $CONFIGFILE; then
       # see if the beginning of the file was left alone; sed cannot backtrack in an
       # address range
-      if ! head -1 $CONFIGFILE | egrep -q '^### BEGIN DEBCONF SECTION'; then
+      if ! head -n 1 $CONFIGFILE | egrep -q '^### BEGIN DEBCONF SECTION'; then
         # sick, sick, sick
         LINES=$(sed -n '1,/^### BEGIN DEBCONF SECTION/p' < $CONFIGFILE | wc -l)
         sed -n 1,$(( $LINES - 1 ))p < $CONFIGFILE > $WORKTMP
       fi
       cat $DEBCONFTMP >> $WORKTMP
-      sed -n '/^### END DEBCONF SECTION/,$p' < $CONFIGFILE | tail +2 >> $WORKTMP
+      sed -n '/^### END DEBCONF SECTION/,$p' < $CONFIGFILE | tail -n +2 >> $WORKTMP
     else
       message "Existing $CONFIGFILE has missing or half-open debconf region;" \
               "not writing X server wrapper configuration file."
diff -pru debian/xserver-xfree86.config.in debian-fix/xserver-xfree86.config.in
--- debian/xserver-xfree86.config.in	2003-05-01 17:00:00.000000000 -0700
+++ debian-fix/xserver-xfree86.config.in	2003-05-02 10:23:24.000000000 -0700
@@ -565,7 +565,7 @@ if [ "$ARCH" = "powerpc" -o "$MULTIHEAD"
   fi
   if which lspci > /dev/null 2>&1; then
     # try to guess the correct BusID
-    VIDEO_CARD=$(LC_ALL=C lspci -n | grep "Class 0300:" | head -1 | cut -d\  -f1)
+    VIDEO_CARD=$(LC_ALL=C lspci -n | grep "Class 0300:" | head -n 1 | cut -d\  -f1)
     if [ -n "$VIDEO_CARD" ]; then
       # we now have an entry in "hex:hex.hex" format, need "PCI:decimal:decimal:decimal"
       BUS=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d: -f1) )
@@ -678,8 +678,8 @@ if [ -z "$RECONFIGURE" ]; then
       set -e
       if [ -n "$MDETECT_OUTPUT" ]; then
         PRIORITY=low
-        AUTODETECTED_PORT=$(echo "$MDETECT_OUTPUT" | head -1)
-        AUTODETECTED_PROTOCOL=$(echo "$MDETECT_OUTPUT" | tail -1)
+        AUTODETECTED_PORT=$(echo "$MDETECT_OUTPUT" | head -n 1)
+        AUTODETECTED_PROTOCOL=$(echo "$MDETECT_OUTPUT" | tail -n 1)
         debug_echo "mdetect returned port \"$AUTODETECTED_PORT\"; protocol \"$AUTODETECTED_PROTOCOL\""
         if [ -n "$AUTODETECTED_PORT" ]; then
           # /dev/input/mouse* means we autodetected a USB pointer; we will




Reply to: