Hi *!

The easier part of this problem is addressed by the attached patch:
wwwoffle.config tries to preseed the debconf db with yes/no for boolean values
which expect true/false.

The "overwwrites local config" part is way harder. Looking at the postinst
gives me the creeps. Just a few quotes which I think would need fixing:

Everything in debian/wwwoffle.postinst of 2.8e-1:

Line 202:
| # Here the [...] link is made if it either doesn't exist or it points to a
| # non-existent file.

The following code is AFAICS not conditional upon first installation, thus
overriding a local admin who has intentionally removed the link.

Line 257:
|    perl -i.bak -pe 's/^(\# WWWOFFLE - World Wide Web Offline Explorer - 
Version).*/$1'" $config_version/" $CONFIG
|    if cmp -s $CONFIG $CONFIG.bak; then mv -f $CONFIG.bak $CONFIG; fi

If the perl doesn't modify the config, this will kill the symlink:

> [EMAIL PROTECTED]:~/tmp/test$ echo foo > foo
> [EMAIL PROTECTED]:~/tmp/test$ echo bar > bar
> [EMAIL PROTECTED]:~/tmp/test$ ln -s foo xxx
> [EMAIL PROTECTED]:~/tmp/test$ ls -la
> total 16
> drwxr-xr-x   2 david david 4096 2005-02-27 17:30 ./
> drwxr-xr-x  25 david david 4096 2005-02-27 17:29 ../
> -rw-r--r--   1 david david    4 2005-02-27 17:31 bar
> -rw-r--r--   1 david david    4 2005-02-27 17:30 foo
> lrwxrwxrwx   1 david david    3 2005-02-27 17:30 xxx -> foo
> [EMAIL PROTECTED]:~/tmp/test$ mv -f bar xxx
> [EMAIL PROTECTED]:~/tmp/test$ ls -la
> total 16
> drwxr-xr-x   2 david david 4096 2005-02-27 17:31 ./
> drwxr-xr-x  25 david david 4096 2005-02-27 17:29 ../
> -rw-r--r--   1 david david    4 2005-02-27 17:30 foo
> -rw-r--r--   1 david david    4 2005-02-27 17:31 xxx
> [EMAIL PROTECTED]:~/tmp/test$ cat xxx
> bar
> [EMAIL PROTECTED]:~/tmp/test$ cat foo
> foo
> [EMAIL PROTECTED]:~/tmp/test$ 

Line 344:
| perl -pi -e "s,[...]

This seems to be the main cause for the symlink-replacement stuff:

> [EMAIL PROTECTED]:~/tmp/test$ cat config
> test
> test1
> test
> 
> [EMAIL PROTECTED]:~/tmp/test$ ln -s config config.link
> [EMAIL PROTECTED]:~/tmp/test$ perl -pi -e 's/1/foo/' config.link 
> [EMAIL PROTECTED]:~/tmp/test$ ls -la
> total 16
> drwxr-xr-x   2 david david 4096 2005-02-27 17:35 ./
> drwxr-xr-x  25 david david 4096 2005-02-27 17:29 ../
> -rw-r--r--   1 david david   17 2005-02-27 17:34 config
> -rw-r--r--   1 david david   19 2005-02-27 17:35 config.link
> [EMAIL PROTECTED]:~/tmp/test$ cat config
> test
> test1
> test
> 
> [EMAIL PROTECTED]:~/tmp/test$ cat config.link 
> test
> testfoo
> test
> 
> [EMAIL PROTECTED]:~/tmp/test$ 

Line 354:
| if [ ! -f $OPTIONS ]; then
|    cp -p /usr/share/wwwoffle/default/wwwoffle.options $OPTIONS
| fi

This too is not special cased to the not-upgrading case.



The following two problems apply to all debconf -> $OPTIONS transformations

Line 365:
| if grep '^htdig' $OPTIONS >/dev/null 2>&1 ; then

This is probably correct, but it highlights that other places testing 
for options are too strict when using grep -x 'htdig'.

Line 368 and 372:
|         perl -i -e 'while (<>) { next if /htdig/; print; }' $OPTIONS

This skips _all_ lines containing 'htdig' including comments

Line 383:
| if grep '^PPP' $OPTIONS >/dev/null 2>&1 ; then

'PPP' is lowercased everywhere else.

Line 402:
|    if [ "$FREQ" != off ]; then
|        # convert to digits only
|        FREQ=$( expr "$FREQ" : '\([0-9]*\)' )

In the .config, there is already complex code to clean this value and 
(without obvious cause) to cap it to 30 minutes. Also this would silently 
eat input errors.

Line 397, 412, 423:
|CRONTAB=/etc/cron.d/wwwoffle
[..]
|        if [ -s $CRONTAB ]; then

This too is not special cased to the not-upgrading case and fails if 
$CRONTAB is a symlink.

The postinst goes on to munge or recreate the crontab. Again without 
checking for symlinks or admin-removal of the file.

Line 448:
| # now duplicate directory structure of /usr/share/wwwoffle/html to 
/etc/wwwoffle/html

Followed by approximatly 20 lines of shell code which probably amount to a 'cp 
-s' which 
I _think_ could be replaced by a 'ln -s /usr/share/wwwoffle/html 
/etc/wwwoffle/html' 
iff the package is not upgrading and there is no /etc/wwwoffle/html.

Line 516, ff:
|    rm -f nohup.out
|    nohup chown -R proxy:proxy /var/cache/wwwoffle/. /var/lib/wwwoffle/. 
>/dev/null 2>&1 &
|    sleep 1
|    rm -f nohup.out

This deletes nohup.out in the current directory, which could be not from 
wwwoffle, which could also be created in $HOME, but is not created by nohup 
anyway because of the redirection.
Regards, David
-- 
- hallo... wie gehts heute?
- *hust* gut *rotz* *keuch*
- gott sei dank kommunizieren wir über ein septisches medium ;)
 -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15
diff -ru wwwoffle-2.8e.unpatched/debian/changelog wwwoffle-2.8e/debian/changelog
--- wwwoffle-2.8e.unpatched/debian/changelog	2005-02-27 17:14:32.606080552 +0100
+++ wwwoffle-2.8e/debian/changelog	2005-02-27 17:00:05.782857712 +0100
@@ -1,3 +1,9 @@
+wwwoffle (2.8e-1~1) unstable; urgency=low
+
+  * Fixed wwwoffle.config: debconf thinkos (Closes part of: #295060)
+
+ -- David Schmitt <[EMAIL PROTECTED]>  Sun, 27 Feb 2005 16:59:55 +0100
+
 wwwoffle (2.8e-1) unstable; urgency=low
 
   * New upstream version.
diff -ru wwwoffle-2.8e.unpatched/debian/wwwoffle.config wwwoffle-2.8e/debian/wwwoffle.config
--- wwwoffle-2.8e.unpatched/debian/wwwoffle.config	2005-02-27 17:14:32.609080096 +0100
+++ wwwoffle-2.8e/debian/wwwoffle.config	2005-02-27 17:02:42.986959056 +0100
@@ -16,19 +16,19 @@
 db_set wwwoffle/string_parent_proxy "$PARENT_PROXY" # put config file data into debconf
 if [ -s /etc/wwwoffle/wwwoffle.options ]; then
     if grep -qsx ppp /etc/wwwoffle/wwwoffle.options; then
-        db_set wwwoffle/use-ppp-interface yes
+        db_set wwwoffle/use-ppp-interface true
     else
-        db_set wwwoffle/use-ppp-interface no
+        db_set wwwoffle/use-ppp-interface false
     fi
     if grep -qsx fetch /etc/wwwoffle/wwwoffle.options; then
-        db_set wwwoffle/ppp-fetch yes
+        db_set wwwoffle/ppp-fetch true
     else
-        db_set wwwoffle/ppp-fetch no
+        db_set wwwoffle/ppp-fetch false
     fi
     if grep -qsx htdig /etc/wwwoffle/wwwoffle.options; then
-        db_set wwwoffle/use-htdig yes
+        db_set wwwoffle/use-htdig true
     else
-        db_set wwwoffle/use-htdig no
+        db_set wwwoffle/use-htdig false
     fi
 fi
 
@@ -49,7 +49,7 @@
 db_input medium wwwoffle/use-ppp-interface
 db_go
 db_get wwwoffle/use-ppp-interface
-if [ x"$RET" = xyes ]; then
+if [ x"$RET" = xtrue ]; then
     db_input medium wwwoffle/ppp-fetch
 fi
 x=1

Reply via email to