Package: nbd-server
Version: 1:2.9.15-3
Severity: normal

The synopsis suggests that a port is mandatory, but a config file
optional. Neither of this is true.

If I do not specify a config file (and /etc/nbd-server/config does
not exist), the command fails with the same error as when I try to
silence it with /dev/null:

  sergei:~/pulse-backup% nbd-server 12345 $PWD/nbd-disk -C /dev/null  -l 
./access                                                                        
            #3100
  ** (process:16914): WARNING **: Could not parse config file: Could not open 
config file.

If I do use a config file, but do not specify a port value for the
export, it also fails gloriously, this time with a segfault:

  sergei:~/pulse-backup% cat config                                             
                                                                                
     #3108
  [generic]

  [pulse-backup]
    exportname = /home/scratch/krafft/pulse-backup/nbd-disk
    authfile = /home/scratch/krafft/pulse-backup/access
  sergei:~/pulse-backup% nbd-server 12345 $PWD/nbd-disk -C ./config -l ./access 
                                                                                
     #3109

  ** (process:18685): WARNING **: Could not parse config file: Could not find 
required value port in group pulse-backup: Key file does not have key 'port'
  zsh: segmentation fault  nbd-server 12345 $PWD/nbd-disk -C ./config -l 
./access

So I add the port and start nbd-server again (with the same port on the command
line), it sometimes starts, but not always. If I kill it and try to start
again, it'll fail. The reason is that it attempts to bind the port *twice* and
fails:

  % nbd-server 12345 $PWD/nbd-disk -C ./config -l ./access·
  % tail -1 /var/log/syslog
  Jun 17 10:10:25 sergei nbd_server[32273]: bind: Address already in use
  % strace -f !!-2
  […]
  socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
  setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
  setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
  fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
  fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
  bind(3, {sa_family=AF_INET, sin_port=htons(12345), 
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
  listen(3, 1)                            = 0
  rt_sigaction(SIGCHLD, {0x402840, [], SA_RESTORER|SA_RESTART, 0x7f9e1c193f60}, 
NULL, 8) = 0
  rt_sigaction(SIGTERM, {0x4027d0, [], SA_RESTORER|SA_RESTART, 0x7f9e1c193f60}, 
NULL, 8) = 0
  socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
  setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
  setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
  fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
  fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
  bind(4, {sa_family=AF_INET, sin_port=htons(12345), 
sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
  […]
  % netstat -plant | grep -c :12345
  0

Changing the port on the command line (but not in the config file)
confirms this.

So in the end, I have to leave out the port on the command-line,
which is okay, but which is contrary to the manpage, and only then
it starts.

Sorry for the single bug report, but I could not figure out how to
slice the problems. ;)

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages nbd-server depends on:
ii  adduser                       3.112      add and remove users and groups
ii  debconf [debconf-2.0]         1.5.32     Debian configuration management sy
ii  libc6                         2.11.2-1   Embedded GNU C Library: Shared lib
ii  libglib2.0-0                  2.24.1-1   The GLib library of C routines
ii  ucf                           3.0025     Update Configuration File: preserv

nbd-server recommends no packages.

nbd-server suggests no packages.

-- debconf-show failed


-- 
 .''`.   martin f. krafft <madd...@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

Reply via email to