Re: problem with fnord-1.9 and wget

Thilo Bangert <[email protected]> Wed, 28 Sep 2005 22:48:30 +0800
Newsgroups gmane.comp.web.fnord
Message-ID <[email protected]>
--Boundary-00=_/0qODJyeO4OtJWV
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Am Mittwoch 28 September 2005 21:13 schrieb Felix von Leitner:
[snip]
>
> However, it shows that sendfile64 is called with the wrong length.
> Since fnord calls it with the right length when compiled with dietlibc,
> I assume this is a header problem.  I just compiled fnord with glibc and
> it also uses the right length for my test file.
>
> This is quite mysterious.  Please make sure your strace is the correct
> version.

i am calling strace right before fnord on a run file where i changed the 
IP.... good enough?

>
> Just to make sure we are using the same code base: please make sure you
> use the current CVS version.

the CVS version works fine - see attached trace (i aborted the download early)

looking at what the gentoo packages does, i found they apply the attached 
patch - nothing related to this problem AFAICT (but this may just show my 
ignorance).

CFLAGS for the compile was

   -O2 -march=pentium4 -fomit-frame-pointer -pipe

regards
Thilo

--Boundary-00=_/0qODJyeO4OtJWV
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="fnord-1.9-gentoo.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="fnord-1.9-gentoo.diff"

diff --exclude='*~' -urN fnord-1.9.orig/fnord-conf fnord-1.9/fnord-conf
--- fnord-1.9.orig/fnord-conf	2003-06-05 19:32:39.000000000 -0400
+++ fnord-1.9/fnord-conf	2005-03-06 22:39:30.243806792 -0500
@@ -17,7 +17,7 @@
 mkdir -p $dir
 echo "#!/bin/sh" > $dir/run
 echo "cd $webroot" >> $dir/run
-echo "exec envuidgid $acct tcpserver -RHl localhost ${myip:-0} 80 fnord 2>&1" >> $dir/run
+echo "exec envuidgid $acct tcpserver -RHl localhost ${myip:-0} 80 /usr/bin/fnord 2>&1" >> $dir/run
 chmod 755 $dir/run
 
 # tell old daemontools that it should spawn a log process, too
diff --exclude='*~' -urN fnord-1.9.orig/httpd.c fnord-1.9/httpd.c
--- fnord-1.9.orig/httpd.c	2005-01-31 11:10:39.000000000 -0500
+++ fnord-1.9/httpd.c	2005-03-06 22:42:07.761860408 -0500
@@ -25,7 +25,9 @@
 #include "scan.h"
 
 /* uncomment the following line to enable support for CGI */
-// #define CGI
+#ifndef CGI
+# define CGI
+#endif
 
 #ifdef CGI
 /* uncomment the following line to enable support for "index.cgi"
@@ -39,7 +41,9 @@
 
 /* uncomment the following line to enable support for autogenerated
  * directory-listings for directories without index */
-/* #define DIR_LIST */
+#ifndef DIR_LIST
+# define DIR_LIST
+#endif
 
 #ifdef DIR_LIST
 /* uncomment the following line to enable support for system symlink
diff --exclude='*~' -urN fnord-1.9.orig/Makefile fnord-1.9/Makefile
--- fnord-1.9.orig/Makefile	2005-01-31 13:33:58.000000000 -0500
+++ fnord-1.9/Makefile	2005-03-06 22:51:27.914704232 -0500
@@ -1,28 +1,19 @@
-CC=gcc
-CXX=g++
-
-#LIBOWFAT=../libowfat/
-DIET=diet -Os
-
-CFLAGS=-Os -fomit-frame-pointer
-#CFLAGS=-g
+CC:=gcc
+CXX:=g++
 
 all: fnord fnord-cgi fnord-idx
 
 fnord: httpd
 	cp -p $^ $@
-	-strip -R .note -R .comment $@
 
 httpd: httpd.o libowfat.a
 	$(DIET) $(CC) -o $@ $^ $(CFLAGS)
 
 fnord-cgi: httpd-cgi.o libowfat.a
 	$(DIET) $(CC) -o $@ $^ $(CFLAGS)
-	-strip -R .note -R .comment $@
 
 fnord-idx: httpd-idx.o libowfat.a
 	$(DIET) $(CC) -o $@ $^ $(CFLAGS)
-	-strip -R .note -R .comment $@
 
 libowfat.a: httpd.o buffer_1.o buffer_puts.o buffer_flush.o buffer_put.o \
 buffer_putulong.o buffer_2.o buffer_putspace.o buffer_stubborn.o \
@@ -32,19 +23,19 @@
 	-ranlib $@
 
 httpd.o: httpd.c
-	$(DIET) $(CC) -pipe $(CFLAGS) -c $^ -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\"
+	$(DIET) $(CC) $(CFLAGS) -c $^ -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\"
 
 httpd-cgi.o: httpd.c
-	$(DIET) $(CC) -pipe $(CFLAGS) -c httpd.c -o $@ -DCGI -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\"
+	$(DIET) $(CC) $(CFLAGS) -c httpd.c -o $@ -DCGI -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\"
 
 httpd-idx.o: httpd.c
-	$(DIET) $(CC) -pipe $(CFLAGS) -c httpd.c -o $@ -DDIR_LIST -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\"
+	$(DIET) $(CC) $(CFLAGS) -c httpd.c -o $@ -DDIR_LIST -DFNORD=\"fnord/$(shell head -n 1 CHANGES|sed 's/://')\"
 
 %.o: %.c
-	$(DIET) $(CC) -pipe $(CFLAGS) -c $^
+	$(DIET) $(CC) $(CFLAGS) -c $^
 
 %.o: %.cpp
-	$(DIET) $(CXX) -pipe $(CFLAGS) -c $^
+	$(DIET) $(CXX) $(CFLAGS) -c $^
 
 .PHONY: rename clean install server
 server: fnord

--Boundary-00=_/0qODJyeO4OtJWV
Content-Type: text/x-log;
  charset="iso-8859-1";
  name="strace-fnord-cvs.log"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="strace-fnord-cvs.log"

execve("/home/bangert/tmp/httpd/fnord", ["/home/bangert/tmp/httpd/fnord"], [/* 29 vars */]) = 0
uname({sys="Linux", node="idefix", ...}) = 0
brk(0)                                  = 0x8051000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=23376, ...}) = 0
mmap2(NULL, 23376, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f25000
close(3)                                = 0
open("/lib/tls/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\0iQ\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1217880, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f24000
mmap2(NULL, 1125564, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7e11000
mprotect(0xb7f1d000, 27836, PROT_NONE)  = 0
mmap2(0xb7f1e000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10c) = 0xb7f1e000
mmap2(0xb7f22000, 7356, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f22000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7e10000
mprotect(0xb7f1e000, 4096, PROT_READ)   = 0
mprotect(0xb7f40000, 4096, PROT_READ)   = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7e106c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0xb7f25000, 23376)               = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "]b\371\31", 4)                 = 4
close(3)                                = 0
chroot(".")                             = 0
chdir("/")                              = 0
setgroups32(1, [1050])                  = 0
setuid32(101)                           = 0
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
time([1127917787])                      = 1127917787
poll([{fd=0, events=POLLIN, revents=POLLIN}], 1, 20000) = 1
read(0, "GET /vietnam/fansipa1.zip HTTP/1"..., 8187) = 36
time(NULL)                              = 1127917799
poll([{fd=0, events=POLLIN, revents=POLLIN}], 1, 20000) = 1
read(0, "Host: static.fizzelpark.com\r\n", 8151) = 29
time(NULL)                              = 1127917809
poll([{fd=0, events=POLLIN, revents=POLLIN}], 1, 20000) = 1
read(0, "\r\n", 8122)                   = 2
time(NULL)                              = 1127917811
chdir("static.fizzelpark.com:80")       = 0
open("vietnam/fansipa1.zip", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=9999033, ...}) = 0
write(2, "213.133.101.110 200 9999033 stat"..., 82) = 82
brk(0)                                  = 0x8051000
brk(0x8072000)                          = 0x8072000
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
setsockopt(1, SOL_TCP, TCP_CORK, [1], 4) = 0
write(1, "HTTP/1.0 200 OK\r\nServer: fnord/1"..., 140) = 140
sendfile64(1, 3, [0], 9999033)          = 9999033
setsockopt(1, SOL_TCP, TCP_CORK, [0], 4) = 0
exit_group(0)                           = ?

--Boundary-00=_/0qODJyeO4OtJWV--