lipnitsk / llconf

Automatically exported from code.google.com/p/llconf
GNU Lesser General Public License v2.1
5 stars 3 forks source link

llconf hangs reading syslog-ng.conf file. #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download latest, and build with "dpkg-buildpackage -rfakeroot -us -uc"
2. llconf syslog-ng -i  /import/tonic/bedge/llconf/syslog-ng.conf -s dump 

What is the expected output? What do you see instead?
I would have expected a syntex tree for the config file.
There was no output, llconf did not complete.

What version of the product are you using?       llconf-0.4.6.tar.gz

On what operating system? Ubuntu 8.04

Please provide any additional information below.

Here's the strace output up to the hang: 

execve("/usr/bin/llconf", ["llconf", "syslog-ng", "-i",
"/import/tonic/bedge/llconf/syslo"..., "-s", "dump"], [/* 58 vars */]) = 0
brk(0)                                  = 0x804c000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7f1a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/users/bedge/lib/tls/i686/sse2/cmov/libllconf.so.0", O_RDONLY) = -1
ENOENT (No such file or directory)
stat64("/users/bedge/lib/tls/i686/sse2/cmov", 0xbfed4fe0) = -1 ENOENT (No
such file or directory)
open("/users/bedge/lib/tls/i686/sse2/libllconf.so.0", O_RDONLY) = -1 ENOENT
(No such file or directory)
stat64("/users/bedge/lib/tls/i686/sse2", 0xbfed4fe0) = -1 ENOENT (No such
file or directory)
open("/users/bedge/lib/tls/i686/cmov/libllconf.so.0", O_RDONLY) = -1 ENOENT
(No such file or directory)
stat64("/users/bedge/lib/tls/i686/cmov", 0xbfed4fe0) = -1 ENOENT (No such
file or directory)
open("/users/bedge/lib/tls/i686/libllconf.so.0", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/users/bedge/lib/tls/i686", 0xbfed4fe0) = -1 ENOENT (No such file
or directory)
open("/users/bedge/lib/tls/sse2/cmov/libllconf.so.0", O_RDONLY) = -1 ENOENT
(No such file or directory)
stat64("/users/bedge/lib/tls/sse2/cmov", 0xbfed4fe0) = -1 ENOENT (No such
file or directory)
open("/users/bedge/lib/tls/sse2/libllconf.so.0", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/users/bedge/lib/tls/sse2", 0xbfed4fe0) = -1 ENOENT (No such file
or directory)
open("/users/bedge/lib/tls/cmov/libllconf.so.0", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/users/bedge/lib/tls/cmov", 0xbfed4fe0) = -1 ENOENT (No such file
or directory)
open("/users/bedge/lib/tls/libllconf.so.0", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/users/bedge/lib/tls", 0xbfed4fe0) = -1 ENOENT (No such file or
directory)
open("/users/bedge/lib/i686/sse2/cmov/libllconf.so.0", O_RDONLY) = -1
ENOENT (No such file or directory)
stat64("/users/bedge/lib/i686/sse2/cmov", 0xbfed4fe0) = -1 ENOENT (No such
file or directory)
open("/users/bedge/lib/i686/sse2/libllconf.so.0", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/users/bedge/lib/i686/sse2", 0xbfed4fe0) = -1 ENOENT (No such file
or directory)
open("/users/bedge/lib/i686/cmov/libllconf.so.0", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/users/bedge/lib/i686/cmov", 0xbfed4fe0) = -1 ENOENT (No such file
or directory)
open("/users/bedge/lib/i686/libllconf.so.0", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/users/bedge/lib/i686", 0xbfed4fe0) = -1 ENOENT (No such file or
directory)
open("/users/bedge/lib/sse2/cmov/libllconf.so.0", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/users/bedge/lib/sse2/cmov", 0xbfed4fe0) = -1 ENOENT (No such file
or directory)
open("/users/bedge/lib/sse2/libllconf.so.0", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/users/bedge/lib/sse2", 0xbfed4fe0) = -1 ENOENT (No such file or
directory)
open("/users/bedge/lib/cmov/libllconf.so.0", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/users/bedge/lib/cmov", 0xbfed4fe0) = -1 ENOENT (No such file or
directory)
open("/users/bedge/lib/libllconf.so.0", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/users/bedge/lib", 0xbfed4fe0)  = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=174566, ...}) = 0
mmap2(NULL, 174566, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7eef000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/usr/lib/libllconf.so.0", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240,\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=252552, ...}) = 0
mmap2(NULL, 83192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0xb7eda000
mmap2(0xb7eee000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14) = 0xb7eee000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260e\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1364388, ...}) = 0
mmap2(NULL, 1369712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
= 0xb7d8b000
mmap2(0xb7ed4000, 12288, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x149) = 0xb7ed4000
mmap2(0xb7ed7000, 9840, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7ed7000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libdl.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\n\0\000"..., 512)
= 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=9684, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7d8a000
mmap2(NULL, 12412, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0xb7d86000
mmap2(0xb7d88000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xb7d88000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7d85000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7d856b0, limit:1048575,
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1,
seg_not_present:0, useable:1}) = 0
mprotect(0xb7ed4000, 4096, PROT_READ)   = 0
munmap(0xb7eef000, 174566)              = 0
brk(0)                                  = 0x804c000
brk(0x806d000)                          = 0x806d000
open("/import/tonic/bedge/llconf/syslog-ng.conf", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=9745, ...}) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7f18000
read(3, "# \n# vim: set tabstop=4 shiftwid"..., 8192) = 8192
read(3, "on(df_daemon); };\n\n# kern.*     "..., 8192) = 1553
read(3, "", 8192)                       = 0

The conf file is attached.

Original issue reported on code.google.com by bruce.e...@gmail.com on 21 Jul 2008 at 11:54

Attachments:

GoogleCodeExporter commented 9 years ago
I looked a little deeper and it's a bug where the last line of an syslog-ng 
conf file
is a comment.
Here's a patch:

 diff -Naur /import/tonic/bedge/tools/llconf/src/parsers/syslogng.c
src/parsers/syslogng.c

--- /import/tonic/bedge/tools/llconf/src/parsers/syslogng.c     2008-07-22
09:21:00.000000000 -0700
+++ src/parsers/syslogng.c      2008-07-22 10:23:54.000000000 -0700
@@ -63,6 +63,10 @@
                        cl = cl->next;
                        p = cl->line;
                }
+               if(cl->next == NULL) {
+                       p = NULL;
+                       break;
+               }
        }
        *pp = p;
        return cl;
@@ -223,7 +227,7 @@
                char buf[256];

                cl = _skip_spaces(cl, &p);
-               if(!*p) break;
+               if(!p || !*p) break;
                if(*p){
                        dup_next_word_b(&p, buf, sizeof(buf)-1);

I'm sure that there's a cleaner way, but this was my attempt :-)

Thanks, Bruce

Original comment by bruce.e...@gmail.com on 22 Jul 2008 at 5:27