Your message dated Sat, 18 May 2013 11:44:21 +0200
with message-id <[email protected]>
and subject line Both these are fixed
has caused the Debian Bug report #698870,
regarding nbd-server: Error in config file causes failure with confusing message
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 this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
698870: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698870
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: nbd-server
Version: 1:3.2-1.1
Severity: normal
Tags: patch

Dear Maintainer,

While working with nbd-server, I tried to allow the clients to
fetch a list of exports. After including the following in the
generic section of /etc/nbd-server/config:
        [generic]
                # other lines ...
                allowlist
nbd-server refused to start, complaining there were no configured
exports, even though there were:
        nass0:root ~ 17 # nbd-server -d 
        ** Message: No configured exports; quitting.

Obviously, the line should read 'allowlist = 1', but It would be
helpful if nbd-server detected the error, and complained about
that instead of (apparently) ignoring the rest of the config file,
and issuing the confusing complaint about no configured exports.

I also tried 'allowlist = yes'. In that case it gives a
descriptive message, although it still confusingly and incorrectly
complains that there are no exports:
        nass0:root ~ 14 # nbd-server -d 

        ** (process:3482): WARNING **: Could not parse config file: Could not 
parse allowlist in group 
generic: Key file contains key 'allowlist' which has a value that cannot be 
interpreted.
        ** Message: No configured exports; quitting.

The cause seems to be that g_key_file_load_from_file fails not only
if the file cannot be found or read, but also if it contains syntax
errors.

I am attaching a patch that fixes the problem: it reports the config file
error, and it no longer also complains that no exports were configured.
With the patch, nbd-server reports:
        nass0:root ~ 35 # /tmp/nbd-server -d 

        ** (process:3609): WARNING **: Could not parse config file: Key file 
contains line '    
allowlist' which is not a key-value pair, group, or comment

Kind regards,

Rogier.

Patch:
----------------------------------------------------------------------------------
--- nbd-3.2/nbd-server.c        2012-07-03 22:54:53.000000000 +0200
+++ nbd-3.2-patch/nbd-server.c  2013-01-24 19:19:04.000000000 +0100
@@ -899,8 +899,7 @@
        cfile = g_key_file_new();
        retval = g_array_new(FALSE, TRUE, sizeof(SERVER));
        if(!g_key_file_load_from_file(cfile, f, G_KEY_FILE_KEEP_COMMENTS |
-                       G_KEY_FILE_KEEP_TRANSLATIONS, &err)) {
-               g_set_error(e, errdomain, CFILE_NOTFOUND, "Could not open 
config file %s.", f);
+                       G_KEY_FILE_KEEP_TRANSLATIONS, e)) {
                g_key_file_free(cfile);
                return retval;
        }
@@ -2597,6 +2596,7 @@
        SERVER *serve;
        GArray *servers;
        GError *err=NULL;
+       bool error_reported=false;
 
        if (sizeof( struct nbd_request )!=28) {
                fprintf(stderr,"Bad size of structure. Alignment problems?\n");
@@ -2640,10 +2640,11 @@
        }
     
        if(!servers || !servers->len) {
-               if(err && !(err->domain == g_quark_from_string("parse_cfile")
-                               && err->code == CFILE_NOTFOUND)) {
+               if(err && !(err->domain == G_FILE_ERROR
+                               && err->code == G_FILE_ERROR_NOENT)) {
                        g_warning("Could not parse config file: %s", 
                                        err ? err->message : "Unknown error");
+                       error_reported=true;
                }
        }
        if(serve) {
@@ -2652,7 +2653,8 @@
        }
 
        if((!serve) && (!servers||!servers->len)) {
-               g_message("No configured exports; quitting.");
+               if (!error_reported)
+                       g_message("No configured exports; quitting.");
                exit(EXIT_FAILURE);
        }
        if (!dontfork)
----------------------------------------------------------------------------------

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages nbd-server depends on:
ii  adduser                3.113+nmu3
ii  debconf [debconf-2.0]  1.5.46
ii  libc6                  2.13-37
ii  libglib2.0-0           2.33.12+really2.32.4-3
ii  ucf                    3.0025+nmu3

nbd-server recommends no packages.

nbd-server suggests no packages.

-- debconf information excluded

--- End Message ---
--- Begin Message ---
Version: 1:3.3-2

I forgot to mention this in the changelog, but both these bugs were
closed with the 3.3 upload.

-- 
This end should point toward the ground if you want to go to space.

If it starts pointing toward space you are having a bad problem and you
will not go to space today.

  -- http://xkcd.com/1133/

--- End Message ---

Reply via email to