Package: ucf
Version: 3.0025
Severity: normal
Tags: patch

As the subject says, ucf fails with error code 20 when VERBOSE is set
to 1 in /etc/ucf.conf. Actually it is debconf's
/usr/share/debconf/confmodule which fails and subsequently topples
ucf. The problem seems to be, that some of the messages in ucf are
written to stdout instead of stderr, which confuses confmodule's
function _db_cmd when reading _db_internal_line. I believe the same is
true when DEBUG is set > 0 in ucf.conf, but I had no time to test it
in more detail.

I have been able to reproduce this consistently on Lenny and sid with
php5-cli, but I think I also encountered the same issue a couple of
months ago with nfs-common. I am pretty sure it affects every package
which uses ucf.

The last line executed before ucf aborts is the following (found with
set -x):
RET='20 Unsupported command "egrep" (full line was "egrep
[[:space:]]\/etc\/php5\/cli\/php\.ini$ /var/lib/ucf/hashfile")
received from confmodule.'

I attached a patch, diffed against ucf-3.0025 in sid, which simply
redirects the few verbose messages written to stdout to stderr.

Actually "git blame" tells me that the lines in question have been in
the code since 2004, so I can't help wondering whether it has been
broken for the last 6 years, or if something changed in debconf.

I have not been able to figure out yet, why this only happens when the
variables are set in ucf.conf, but not when the cli switches
(--verbose/--debug) are used. But somehow using the switches and using
ucf.conf results in different behavior, which I think may be a bug in
itself.

I hope the bug will be properly reported, this is my first time using
reportbug.

Thanks for your work on Debian!

Kind regards,
Aljoscha Lautenbach


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-3-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ucf depends on:
ii  coreutils                     8.4-2      GNU core utilities
ii  debconf                       1.5.30     Debian configuration management sy

ucf recommends no packages.

ucf suggests no packages.

-- debconf information:
  ucf/changeprompt: keep_current
  ucf/conflicts_found:
  ucf/title:
* ucf/show_diff:
* ucf/changeprompt_threeway: keep_current
--- ucf.orig	2010-04-09 22:43:53.000000000 +0200
+++ ucf.new	2010-04-09 22:43:43.000000000 +0200
@@ -155,8 +155,8 @@
 	if [ "X$docmd" = "XYES" ]; then
 	    set +e
 	    if [ "X$VERBOSE" != "X" ]; then
-		echo "egrep -v [[:space:]]${safe_dest_file}$ $statedir/hashfile"
-		egrep -v "[[:space:]]${safe_dest_file}$"  "$statedir/hashfile" \
+		echo >&2 "egrep -v [[:space:]]${safe_dest_file}$ $statedir/hashfile"
+		egrep -v "[[:space:]]${safe_dest_file}$"  "$statedir/hashfile" >&2 \
 		    || true;
 	    fi
 	    #echo "egrep -v [[:space:]]${safe_dest_file}$ $statedir/hashfile"
@@ -170,7 +170,7 @@
 	    set -e
 	fi
     fi
-    test -n "$VERBOSE" && echo "The cache file is $cached_file"
+    test -n "$VERBOSE" && echo >&2 "The cache file is $cached_file"
     if [ ! -z "$cached_file" -a -f "$statedir/cache/$cached_file" ]; then
 	$action rm -f "$statedir/cache/$cached_file"
     fi
@@ -197,9 +197,9 @@
 	if [ "X$docmd" = "XYES" ]; then
 	    set +e
 	    if [ "X$VERBOSE" != "X" ]; then
-		echo "(egrep -v \"[[:space:]]${safe_dest_file}$\" \"$statedir/hashfile\";"
-		egrep -v "[[:space:]]${safe_dest_file}$"  "$statedir/hashfile" || true;
-		 md5sum "$orig_new_file" | sed "s|$orig_new_file|$dest_file|" ;
+		echo >&2 "(egrep -v \"[[:space:]]${safe_dest_file}$\" \"$statedir/hashfile\";"
+		egrep -v "[[:space:]]${safe_dest_file}$"  "$statedir/hashfile" >&2 || true;
+		md5sum "$orig_new_file" | sed "s|$orig_new_file|$dest_file|" >&2;
 	    fi
 	    egrep -v "[[:space:]]${safe_dest_file}$" "$statedir/hashfile" > \
 		"$statedir/hashfile.tmp" || true; 
@@ -513,8 +513,8 @@
 if [ -e "$statedir/hashfile" ]; then
     if [ "X$VERBOSE" != "X" ]; then
 	echo >&2 "The hash file exists"
-	echo egrep "[[:space:]]${safe_dest_file}$" "$statedir/hashfile"
-	egrep "[[:space:]]${safe_dest_file}$" "$statedir/hashfile" || true
+	echo >&2 egrep "[[:space:]]${safe_dest_file}$" "$statedir/hashfile"
+	egrep "[[:space:]]${safe_dest_file}$" "$statedir/hashfile" >&2 || true
     fi
     lastsum=$(egrep "[[:space:]]${safe_dest_file}$" "$statedir/hashfile" | \
                    awk '{print $1;}' )

Reply via email to