Package: nbd-client
Version: 1:2.9.16-2
Severity: normal

Dear Wouter Verhelst (or to whom it may concern),

according to the man page:

       -c     Check whether the specified nbd device is connected.
              
              If the device is connected, nbd-client will exit
              with an exit state of 0 and print the PID of the
              nbd-client instance that connected it to stdout.
              
              If the device is not connected or does not exist
              (for example because the nbd module was not
              loaded), nbd-client will exit with an exit state of
              1 and not print anything on stdout.

nbd-client -c /dev/nbdNOTCONNECTED should exit with exitstate 1
but it exits with exit state of 0:

At the moment there is no instance of nbd-client running,

$ ps a|grep "[n]bd-client .*" ; echo $?
1

therefore none of the nbd device nodes is connected. But:

$ sudo nbd-client -c /dev/nbd2 ; echo $?
0

According to the man page exit status should be 1 in this
case. Now I connect one device:

$ sudo nbd-client hardy 2002 /dev/nbd2 
Negotiation: ..size = 577070833KB
bs=1024, sz=577070833


and probe for its connectedness:

$ sudo nbd-client -c /dev/nbd2 ; echo $?
14202
0

That's o.k. with the man page.  I disconnect the device:

$ sudo nbd-client -d /dev/nbd2 ; echo $?
Disconnecting: que, disconnect, sock, done
0


I unload the nbd module:

$ sudo rmmod nbd
$ lsmod|grep nbd ; echo $?
1


I test the existence of the nbd device node:

$ ls -l /dev/nbd2
ls: cannot access /dev/nbd2: No such file or directory:


I probe again:

$ sudo nbd-client -c /dev/nbd2 ; echo $?
0

According to the man page nbd-client should exit in this case
with exit status 1.


Now I stop the nbd server:

$ ssh hardy invoke-rc.d nbd-server stop
Stopping Network Block Device server: nbd-server.


Is the nbd server really dead?

$ sudo nbd-client hardy 2002 /dev/nbd2 ; echo $?
Error: Socket failed: Connection refused
Exiting.
1

I probe again:

$ sudo nbd-client -c /dev/nbd2 ; echo $?
0


Same result as before.


I load the module:

sudo modprobe nbd


I again test the existence of the nbd device node

~$ ls -l /dev/nbd2
brw-rw---- 1 root Diskussion 43, 32 2010-08-08 19:58 /dev/nbd2


$ sudo nbd-client -c /dev/nbd2 ; echo $?
0



--> According to the man page nbd-client gives wrong exit status
    if nbd device node is not connected or not existent.

It would be fine if nbd-client would report if there is no
nbd-server when testing the connectedness of a device node.



I realised this problem when my backup script broke.  That
happened between 2010-07-31 and today so I'm quite sure the issue
is related to your last version of nbd-client.


Thank you very much for maintaining nbd.  Ciao, Gregor 


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

Kernel: Linux 2.6.32-5-19rt-mbb (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages nbd-client depends on:
ii  debconf [debconf-2.0]         1.5.35     Debian configuration management sy
ii  libc6                         2.11.2-2   Embedded GNU C Library: Shared lib

nbd-client recommends no packages.

nbd-client suggests no packages.

-- debconf information:
* nbd-client/port2: 2002
* nbd-client/killall: false
* nbd-client/type2: raw
* nbd-client/device3:
* nbd-client/device: /dev/nbd0
* nbd-client/port1: 2001
* nbd-client/host: hardy
* nbd-client/device1: /dev/nbd1
* nbd-client/type1: raw
* nbd-client/port: 2003
* nbd-client/type: raw
* nbd-client/host1: hardy
* nbd-client/type3: raw
* nbd-client/device2: /dev/nbd2
* nbd-client/number: 1
  nbd-client/no-auto-config:
* nbd-client/host2: hardy
* nbd-client/extra:
* nbd-client/port3:
* nbd-client/host3:



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to