Your message dated Tue, 16 Jan 2007 09:47:04 +0000
with message-id <[EMAIL PROTECTED]>
and subject line Bug#406963: fixed in nbd 1:2.8.7-4
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: nbd-server
Version: 1:2.8.7-3
Severity: normal
Tags: patch

I have the following /etc/nbd-server file:

NBD_PORT[0]=21544
NBD_FILE[0]=/var/lib/nbd/pulk-pull/swap
NBD_SERVER_OPTS[0]="-l /var/lib/nbd/pulk-pull/swap.nbd-allow"
NBD_PORT[1]=37417
NBD_FILE[1]=/var/lib/nbd/oomingmak/swap
NBD_SERVER_OPTS[1]="-l /var/lib/nbd/oomingmak/swap.nbd-allow"
[comments omitted]

The following occurs when I run "dpkg-reconfigure nbd-server", or
reinstall nbd-server:

/var/lib/dpkg/info/nbd-server.postinst: line 52: [: -l: binary operator expected
/var/lib/dpkg/info/nbd-server.postinst: line 52: [: -l: binary operator expected
/etc/nbd-server: line 3: /var/lib/nbd/pulk-pull/swap.nbd-allow: Permission 
denied
/etc/nbd-server: line 6: /var/lib/nbd/oomingmak/swap.nbd-allow: Permission 
denied
Starting Network Block Device server: /var/lib/nbd/pulk-pull/swap 
/var/lib/nbd/oomingmak/swap nbd-server.

/etc/nbd-server then becomes:

NBD_PORT[0]=21544
NBD_FILE[0]=/var/lib/nbd/pulk-pull/swap
NBD_SERVER_OPTS[0]=-l /var/lib/nbd/pulk-pull/swap.nbd-allow
NBD_PORT[1]=37417
NBD_FILE[1]=/var/lib/nbd/oomingmak/swap
NBD_SERVER_OPTS[1]=-l /var/lib/nbd/oomingmak/swap.nbd-allow
[comments omitted]

Note that the NBD_SERVER_OPTS* lines lose proper quoting.  The
"Permission denied" errors on startup happen because bash is trying to
execute the "swap.nbd-allow" files as a result of the improper
serialization.

This modification to /var/lib/dpkg/info/nbd-server.postinst properly
serializes these values, and also corrects the error reported on line
52:

---8<---8<---
--- nbd-server.postinst.orig    2006-12-31 06:20:08.000000000 -0800
+++ /var/lib/dpkg/info/nbd-server.postinst      2007-01-15 02:07:52.000000000 
-0800
@@ -9,6 +9,21 @@
 
 [ -e /etc/nbd-server ] && . /etc/nbd-server
 
+# Quotes each argument for shell expression inclusion, to prevent
+# interpretation of special characters.
+function shell_quote () {
+       local first=true
+       while [ "$#" -gt 0 ]; do
+               if [ ! "$first" ]; then
+                       echo -n ' '
+               fi
+               # sed expression transforms instances of ' to '\''
+               echo -n "'$(echo "$1" | sed -e "s/'/'\\\\''/g")'"
+               first=
+               shift
+       done
+}
+
 # summary of how this script can be called:
 #        * <postinst> `configure' <most-recently-configured-version>
 #        * <old-postinst> `abort-upgrade' <new version>
@@ -49,12 +64,12 @@
                  umask 066
                  (   echo "NBD_PORT[$(( $i + 0 ))]="$PORT
                      echo "NBD_FILE[$(( $i + 0 ))]="$FN
-                     if [ -z ${NBD_SERVER_OPTS[$(( $i + 0))]} ]
+                     if [ -z "${NBD_SERVER_OPTS[$(( $i + 0))]}" ]
                          then
                          echo "#NBD_SERVER_OPTS[$(( $i + 0))] is unset, but 
can contain -r, -m, -c or -a."
                          echo "#See nbd-server(1) for their meanings"
                      else
-                         echo "NBD_SERVER_OPTS[$(( $i + 
0))]="${NBD_SERVER_OPTS[$(( $i + 0))]}
+                         echo "NBD_SERVER_OPTS[$(( $i + 0))]=$(shell_quote 
"${NBD_SERVER_OPTS[$(( $i + 0))]}")"
                      fi
                  ) >> $TMPFILE
                done
--->8--->8---

Two subsequent iterations of "dpkg-reconfigure nbd-server" preserve
the semantic meaning of the NBD_SERVER_OPTS* lines (though harmlessly
changing my original double-quoted strings to single-quoted strings),
and report no errors.

I've also commented out NBD_SERVER_OPTS[0] and reconfigured nbd-server
to ensure my patch works correctly when such a value is not set.

On what perhaps should be filed in a separate bug report: Why aren't
the NBD_SERVER_OPTS* lines configurable with debconf?

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16.29-xen
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages nbd-server depends on:
ii  debconf [debconf-2.0]        1.5.11      Debian configuration management sy
ii  libc6                        2.3.6.ds1-8 GNU C Library: Shared libraries
ii  libglib2.0-0                 2.12.4-2    The GLib library of C routines

nbd-server recommends no packages.

-- debconf information:
* nbd-server/filename: /var/lib/nbd/pulk-pull/swap
* nbd-server/port: 21544
* nbd-server/filename1: /var/lib/nbd/oomingmak/swap
* nbd-server/port1: 37417
  nbd-server/autogen:
* nbd-server/number: 2

-- 
J.P. Larocque: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>


--- End Message ---
--- Begin Message ---
Source: nbd
Source-Version: 1:2.8.7-4

We believe that the bug you reported is fixed in the latest version of
nbd, which is due to be installed in the Debian FTP archive:

nbd-client_2.8.7-4_i386.deb
  to pool/main/n/nbd/nbd-client_2.8.7-4_i386.deb
nbd-server_2.8.7-4_i386.deb
  to pool/main/n/nbd/nbd-server_2.8.7-4_i386.deb
nbd_2.8.7-4.diff.gz
  to pool/main/n/nbd/nbd_2.8.7-4.diff.gz
nbd_2.8.7-4.dsc
  to pool/main/n/nbd/nbd_2.8.7-4.dsc



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Wouter Verhelst <[EMAIL PROTECTED]> (supplier of updated nbd package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Tue, 16 Jan 2007 10:18:07 +0100
Source: nbd
Binary: nbd-client nbd-server
Architecture: source i386
Version: 1:2.8.7-4
Distribution: unstable
Urgency: low
Maintainer: Wouter Verhelst <[EMAIL PROTECTED]>
Changed-By: Wouter Verhelst <[EMAIL PROTECTED]>
Description: 
 nbd-client - the Network Block Device client
 nbd-server - the Network Block Device server
Closes: 406963
Changes: 
 nbd (1:2.8.7-4) unstable; urgency=low
 .
   * Properly quote NBD_SERVER_OPTS array stuff when rewriting nbd-server
     config file.
   * Properly quote same variable when testing it with [.
   * The above two Closes: #406963.
Files: 
 0e7704a62a6bd7aca8bb149e59ffc6d2 586 admin optional nbd_2.8.7-4.dsc
 950a82e16450b8c7451a51a7acaae0b8 36609 admin optional nbd_2.8.7-4.diff.gz
 3d10a1049f5cadb46bb2812cee29b383 35660 admin optional 
nbd-server_2.8.7-4_i386.deb
 71b134fe86298a01095569d21f8b5449 32098 admin optional 
nbd-client_2.8.7-4_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFrJyzPfwsYq950p4RAjuEAKCGBdmA2FZ3reY0n8kGG3bYUKNA/wCfftOK
x/XZ3ZBRoIF7uHfm7uZvRHY=
=TDmY
-----END PGP SIGNATURE-----


--- End Message ---

Reply via email to