Package: nsd
Version: 2.3.6-1
Severity: important
Tags: patch

*** Please type your report below this line ***

Ondrej,

when freshly installing nsd the postinst script fails because of an
error thrown by chown due to the missing dbfile:

| Setting up nsd (2.3.6-1) ...
| chown: cannot access `/var/lib/nsd/nsd.db': No such file or directory
| invoke-rc.d: initscript nsd, action "start" failed.
| dpkg: error processing nsd (--install):
|  subprocess post-installation script returned error exit status 1

I've found the error in the init script and provide a patch:

------------------------------------------------------------------------
--- /tmp/nsd.bak        2007-04-05 11:59:10.000000000 +0200
+++ /tmp/nsd.new        2007-04-05 12:08:17.000000000 +0200
@@ -25,8 +25,8 @@
 
 case "$1" in
   start)
-       if ${rebuild} && [ "${zonesfile}" -nt "${dbfile}" ]; then ${NSDC} 
rebuild; fi
-        [ -n "${nsd_user}" ] && chown "${nsd_user}:" "${dbfile}"
+       if ${rebuild} && ( [ "${zonesfile}" -nt "${dbfile}" ] || [ ! -e 
"${dbfile}" ] ); then 
+         ${NSDC} rebuild && [ -n "${nsd_user}" ] && chown "${nsd_user}:" 
"${dbfile}"; fi
        echo -n "Starting $DESC: $NAME..."
        start-stop-daemon --start --quiet --pidfile ${pidfile} --exec ${DAEMON} 
-- -f ${dbfile} -P ${pidfile} ${flags} 2>/dev/null
        while [ ! -s ${pidfile} ]; do
------------------------------------------------------------------------

The problem is that the init script checks whether the dbfile is newer
than the config file.  However, since on a fresh install there's no
dbfile yet this check fails causing no rebuild, i.e. no generation of
the dbfile.  Therefore in the next step the chown fails due to the
missing file.

Applying my patch the init script will also build the dbfile if it not
exists.  Additionally, but IMO optionally, it now also only executes the
chown action when the rebuild went fine.

I've also found the errornous -nt check in the postinst script.  But
since the init script will take care of creating the missing file I
think the postinst script doesn't need to be fixed.


HTH -- Sebastian

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.17-2-486
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages nsd depends on:
ii  adduser                     3.102        Add and remove users and groups

-- 
Dinge, die man nicht hören will, wenn man operiert wird:
                         »Mist, das Licht ist schon wieder ausgefallen.«
************************************************************************
 PGP Key: 0x1E727CE6 / 9085 48BD 8332 4BFC D80C A6CF D162 20BB 1E72 7CE6
Spamtrap: <[EMAIL PROTECTED]>

Reply via email to