[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] error compiling nbd 2.9.15 with enable-debug



On Tue, Jul 13, 2010 at 03:58:36PM -0400, Richard Huddleston wrote:
> i'm trying to debug some nbd segfaults
> 
> nbd-server[7256]: segfault at 0 ip 0000000000402879 sp
> 00007fff11ce8060 error 4 in nbd-server[400000+7000]

What version is that? What were you doing at the time?

> and so i thought i'd try compiling with debugging
> 
> i'm trying to compile nbd 2.9.15 with --enable-debug
> on ubuntu lucid 64 bit

Note that --enable-debug produces a server that can't fork(), so it can
only serve one client. Also, the output is mainly meant for protocol
debugging rather than for debugging segfaults. Anyway.

[...]
> nbd-server.c: In function ‘rawexpwrite’:
> nbd-server.c:1020: warning: format ‘%llu’ expects type ‘long long
> unsigned int’, but argument 3 has type ‘off_t’
> nbd-server.c:1020: warning: format ‘%u’ expects type ‘unsigned int’,
> but argument 4 has type ‘size_t’
> nbd-server.c: In function ‘rawexpread’:
> nbd-server.c:1066: warning: format ‘%llu’ expects type ‘long long
> unsigned int’, but argument 3 has type ‘off_t’
> nbd-server.c:1066: warning: format ‘%u’ expects type ‘unsigned int’,
> but argument 4 has type ‘size_t’
> nbd-server.c: In function ‘expread’:
> nbd-server.c:1103: warning: format ‘%d’ expects type ‘int’, but
> argument 2 has type ‘size_t’
> nbd-server.c: In function ‘expwrite’:
> nbd-server.c:1147: warning: format ‘%d’ expects type ‘int’, but
> argument 2 has type ‘size_t’
> nbd-server.c: In function ‘mainloop’:
> nbd-server.c:1266: warning: format ‘%d’ expects type ‘int’, but
> argument 5 has type ‘size_t’
> nbd-server.c: In function ‘glib_message_syslog_redirect’:
> nbd-server.c:1865: warning: format not a string literal and no format arguments

These are warnings, because we don't do the appropriate casts in the
debug output stuff. You may ignore them.

> mv -f .deps/nbd_server-nbd-server.Tpo .deps/nbd_server-nbd-server.Po
> gcc -g -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -g
> -O2   -o nbd-server nbd_server-nbd-server.o -lglib-2.0
> gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT nbd-client.o -MD -MP -MF
> ..deps/nbd-client.Tpo -c -o nbd-client.o nbd-client.c
> nbd-client.c:397: error: expected identifier or ‘(’ before ‘while’
> nbd-client.c:398: error: expected declaration specifiers or ‘...’
> before string constant
> nbd-client.c:398: warning: data definition has no type or storage class
[...]

This, of course, is something else, but fixed by this:

diff --git a/nbd-client.c b/nbd-client.c
index 97c8048..7aceb3e 100644
--- a/nbd-client.c
+++ b/nbd-client.c
@@ -343,7 +343,9 @@ int main(int argc, char *argv[]) {
        
 #ifndef NOFORK
        if(!nofork) daemon(0,0);
+#endif
        do {
+#ifndef NOFORK
                if (fork()) {
                        /* Due to a race, the kernel NBD driver cannot
                         * call for a reread of the partition table

It's in git now, together with the logic reversal of yesterday.

-- 
The biometric identification system at the gates of the CIA headquarters
works because there's a guard with a large gun making sure no one is
trying to fool the system.
  http://www.schneier.com/blog/archives/2009/01/biometrics.html



Reply to: