On Thu, Jun 30, 2011 at 09:43:47AM -0700, Jeremy Evans wrote:
> Fairly simple update. Notable additions include SSL support, filters,
> config modules, better reloading support, speed improvments, many
> bugfixes, and most of our patches being included upstream.
>
> Regress tests have one failure on both amd64 and i386, a segfault in a
> gmtime call:
>
> GNU gdb 6.3
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "i386-unknown-openbsd4.9"...
> Core was generated by `dir_tests'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /usr/lib/libpthread.so.13.1...done.
> Loaded symbols for /usr/lib/libpthread.so.13.1
> Reading symbols from /usr/local/lib/libzmq.so.0.0...done.
> Loaded symbols for /usr/local/lib/libzmq.so.0.0
> Reading symbols from /usr/local/lib/libsqlite3.so.15.1...done.
> Loaded symbols for /usr/local/lib/libsqlite3.so.15.1
> Symbols already loaded for /usr/lib/libpthread.so.13.1
> Reading symbols from /usr/lib/libc.so.58.2...done.
> Loaded symbols for /usr/lib/libc.so.58.2
> Reading symbols from /usr/lib/libstdc++.so.51.0...done.
> Loaded symbols for /usr/lib/libstdc++.so.51.0
> Reading symbols from /usr/lib/libssl.so.16.0...done.
> Reading symbols from /usr/lib/libcrypto.so.19.0...done.
> Loaded symbols for /usr/lib/libcrypto.so.19.0
> Reading symbols from /usr/lib/libm.so.5.3...done.
> Loaded symbols for /usr/lib/libm.so.5.3
> Reading symbols from /usr/libexec/ld.so...done.
> Loaded symbols for /usr/libexec/ld.so
> #0 tzload (name=0x2ead12a0 "GMT", sp=0x2eaf82a0, doextend=1) at
> /usr/src/lib/libc/time/localtime.c:332
> 332 {
> (gdb) bt
> #0 tzload (name=0x2ead12a0 "GMT", sp=0x2eaf82a0, doextend=1) at
> /usr/src/lib/libc/time/localtime.c:332
> #1 0x0eb6b3cc in gmtload (sp=0x2eaf82a0) at
> /usr/src/lib/libc/time/localtime.c:1161
> #2 0x0eb6b495 in gmtsub (timep=0x7f0a8854, offset=0, tmp=0x84b00280) at
> /usr/src/lib/libc/time/localtime.c:1402
> #3 0x0eb6b501 in gmtime_r (timep=0x7f0a8854, p_tm=0x84b00280) at
> /usr/src/lib/libc/time/localtime.c:1437
> #4 0x0eb6bb1f in gmtime (timep=0x7f0a8854) at
> /usr/src/lib/libc/time/localtime.c:1450
> #5 0x1c00cf64 in Dir_find_file (path=0x7f685060, default_type=0x7f685050) at
> src/dir.c:111
> #6 0x1c00326d in test_Dir_find_file () at tests/dir_tests.c:12
> #7 0x1c00331d in all_tests () at tests/dir_tests.c:172
> #8 0x1c0034c9 in taskmain (argc=1, argv=0xcfbe04f8) at tests/dir_tests.c:181
> #9 0x1c009328 in taskmainstart (v=0x0) at src/task/task.c:325
> #10 0x1c009044 in taskstart (y=2092347392, x=0) at src/task/task.c:37
> #11 0x00000000 in ?? ()
>
> Not sure if that's a bug in the test code or a bug in our gmtime
> implementation, though. Simple testing with a ruby application using
> rack-mongrel2 shows no errors.
>
> I plan to commit this next week unless I hear objections.
>
> Jeremy
Can you isolate the testcase to the smallest code that crashes? That would be
easier to debug and diagnoze.
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/www/mongrel2/Makefile,v
> retrieving revision 1.2
> diff -u -p -r1.2 Makefile
> --- Makefile 16 Apr 2011 10:45:09 -0000 1.2
> +++ Makefile 30 Jun 2011 16:21:42 -0000
> @@ -2,10 +2,11 @@
>
> # Some assembly required
> ONLY_FOR_ARCHS =i386 amd64
> +SHARED_ONLY = Yes
>
> COMMENT = language agnostic asynchronous web server
>
> -DISTNAME = mongrel2-1.5
> +DISTNAME = mongrel2-1.7.5
> CATEGORIES = www
>
> HOMEPAGE = http://mongrel2.org/
> @@ -25,7 +26,9 @@ LIB_DEPENDS = net/zeromq \
> databases/sqlite3
>
> USE_GMAKE = Yes
> -ALL_TARGET = openbsd
> +MAKE_ARGS = OPTFLAGS="-I${LOCALBASE}/include" \
> + OPTLIBS="-L${LOCALBASE}/lib"
> +ALL_TARGET = openbsd filters config_modules ${MAKE_ARGS}
>
> EXAMPLE_DIR = ${PREFIX}/share/examples/mongrel2
>
> @@ -37,6 +40,6 @@ post-install:
> tar -cf - -C ${WRKSRC}/examples . | tar -xf - -C ${EXAMPLE_DIR}
> chown -R ${SHAREOWN}:${SHAREGRP} ${EXAMPLE_DIR}
>
> -REGRESS_TARGET = tests
> +REGRESS_TARGET = tests ${MAKE_ARGS}
>
> .include <bsd.port.mk>
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/www/mongrel2/distinfo,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 distinfo
> --- distinfo 1 Apr 2011 22:28:02 -0000 1.1.1.1
> +++ distinfo 30 Jun 2011 15:24:19 -0000
> @@ -1,5 +1,5 @@
> -MD5 (mongrel2-1.5.tar.bz2) = tpn/x++SKtfXA/zTmol5EA==
> -RMD160 (mongrel2-1.5.tar.bz2) = crwmKxVWs+1qCmBYXA1/QoXX7rI=
> -SHA1 (mongrel2-1.5.tar.bz2) = 8XnBFwJVbta/EP4JK6ek4c3OLGc=
> -SHA256 (mongrel2-1.5.tar.bz2) = dCkENkynUXIJj4KNVOTYdpTDgeChZgNVfcXz4CGGizM=
> -SIZE (mongrel2-1.5.tar.bz2) = 733493
> +MD5 (mongrel2-1.7.5.tar.bz2) = wkPvxZ5Zcvo4G9E6fur9xw==
> +RMD160 (mongrel2-1.7.5.tar.bz2) = 5iO7F6Qt+lCdnRTBIIuPtgR/IqI=
> +SHA1 (mongrel2-1.7.5.tar.bz2) = RWVh/gTxwO5KmWz8nerauMV+5tw=
> +SHA256 (mongrel2-1.7.5.tar.bz2) =
> SOSzuolZvgAeW6x14KP+5ijJF7CPEVvgi81TSKxmOwE=
> +SIZE (mongrel2-1.7.5.tar.bz2) = 745357
> Index: patches/patch-Makefile
> ===================================================================
> RCS file: /cvs/ports/www/mongrel2/patches/patch-Makefile,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 patch-Makefile
> --- patches/patch-Makefile 1 Apr 2011 22:28:02 -0000 1.1.1.1
> +++ patches/patch-Makefile 30 Jun 2011 15:50:56 -0000
> @@ -1,41 +1,32 @@
> $OpenBSD: patch-Makefile,v 1.1.1.1 2011/04/01 22:28:02 jeremy Exp $
> ---- Makefile.orig Sun Jan 9 15:18:13 2011
> -+++ Makefile Fri Feb 25 08:40:22 2011
> -@@ -11,7 +11,7 @@ LIB_OBJ=$(filter-out src/mongrel2.o,${OBJECTS})
> - TEST_SRC=$(wildcard tests/*.c)
> +--- Makefile.orig Wed Jun 22 09:25:12 2011
> ++++ Makefile Thu Jun 30 08:50:40 2011
> +@@ -1,5 +1,5 @@
> + CFLAGS=-g -O2 -Wall -Wextra -Isrc -pthread -rdynamic -DNDEBUG $(OPTFLAGS)
> -D_FILE_OFFSET_BITS=64
> +-LIBS=-lzmq -ldl -lsqlite3 $(OPTLIBS)
> ++LIBS=-lzmq -lsqlite3 $(OPTLIBS)
> + PREFIX?=/usr/local
> +
> + get_objs = $(addsuffix .o,$(basename $(wildcard $(1))))
> +@@ -16,7 +16,7 @@ TEST_SRC=$(wildcard tests/*_tests.c)
> TESTS=$(patsubst %.c,%,${TEST_SRC})
> + MAKEOPTS=OPTFLAGS="${NOEXTCFLAGS} ${OPTFLAGS}" OPTLIBS="${OPTLIBS}"
> LIBS="${LIBS}" DESTDIR="${DESTDIR}" PREFIX="${PREFIX}"
>
> -all: bin/mongrel2 tests m2sh
> +all: bin/mongrel2 m2sh
>
> - dev: CFLAGS=-g -Wall -Isrc -Wall -Wextra $(OPTFLAGS)
> + dev: CFLAGS=-g -Wall -Isrc -Wall -Wextra $(OPTFLAGS) -D_FILE_OFFSET_BITS=64
> dev: all
> -@@ -43,6 +43,8 @@ pristine: clean
> - ${MAKE} -C tools/m2sh pristine
> -
> - .PHONY: tests
> -+tests: OPTFLAGS=-I${LOCALBASE}/include
> -+tests: OPTLIBS=-L${LOCALBASE}/lib -pthread
> - tests: build/libm2.a tests/config.sqlite ${TESTS}
> - sh ./tests/runtests.sh
> -
> -@@ -66,7 +68,7 @@ check:
> - m2sh:
> - ${MAKE} OPTFLAGS="${OPTFLAGS}" OPTLIBS="${OPTLIBS}" -C tools/m2sh all
> -
> --install: all install-bin install-m2sh
> -+install: install-bin install-m2sh
> -
> - install-bin:
> - install -d $(PREFIX)/bin/
> -@@ -113,8 +115,8 @@ freebsd: OPTFLAGS=-I/usr/local/include
> - freebsd: OPTLIBS=-L/usr/local/lib -pthread
> - freebsd: all
> -
> --openbsd: OPTFLAGS=-l/usr/local/include
> --openbsd: OPTLIBS=-L/usr/local/lib -pthread
> -+openbsd: OPTFLAGS=-I${LOCALBASE}/include
> -+openbsd: OPTLIBS=-L${LOCALBASE}/lib -pthread
> - openbsd: all
> -
> - solaris: OPTFLAGS=-I/usr/local/include
> +@@ -93,9 +93,9 @@ filters: build/libm2.a
> + config_modules: build/libm2.a
> + ${MAKE} ${MAKEOPTS} -C tools/config_modules all
> +
> +-install: all
> +- install -d $(DESTDIR)/$(PREFIX)/bin/
> +- install bin/mongrel2 $(DESTDIR)/$(PREFIX)/bin/
> ++install:
> ++ install -d $(PREFIX)/bin/
> ++ install bin/mongrel2 $(PREFIX)/bin/
> + ${MAKE} ${MAKEOPTS} -C tools/m2sh install
> + ${MAKE} ${MAKEOPTS} -C tools/config_modules install
> + ${MAKE} ${MAKEOPTS} -C tools/filters install
> Index: patches/patch-src_bsd_specific_c
> ===================================================================
> RCS file: patches/patch-src_bsd_specific_c
> diff -N patches/patch-src_bsd_specific_c
> --- patches/patch-src_bsd_specific_c 1 Apr 2011 22:28:02 -0000 1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,57 +0,0 @@
> -$OpenBSD: patch-src_bsd_specific_c,v 1.1.1.1 2011/04/01 22:28:02 jeremy Exp $
> ---- src/bsd_specific.c.orig Sun Jan 9 15:18:13 2011
> -+++ src/bsd_specific.c Fri Feb 25 08:29:53 2011
> -@@ -71,10 +71,52 @@ error:
> -
> - #else
> -
> -+extern int fdrecv(int fd, void *buf, int n);
> -+extern int fdsend(int fd, void *buf, int n);
> -+
> -+#define BSD_SENDFILE_BUF_SIZE 16384
> -+#include <unistd.h>
> -+
> - /** For the BSDs without sendfile like open and net.**/
> -
> - int bsd_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) {
> -- return -1;
> -+ char buf[BSD_SENDFILE_BUF_SIZE];
> -+ int tot, cur, rem, sent;
> -+ int ret = -1;
> -+ off_t orig_offset;
> -+
> -+ if (offset != NULL) {
> -+ orig_offset = lseek(in_fd, 0, SEEK_CUR);
> -+ check(orig_offset >= 0, "lseek failure when determining current
> position");
> -+ check(lseek(in_fd, *offset, SEEK_SET) >= 0, "lseek failure when
> setting new position");
> -+ }
> -+
> -+ for (tot = 0, rem = count, cur = rem; cur != 0 && tot < count; tot +=
> cur, rem -= cur) {
> -+ if (rem >= BSD_SENDFILE_BUF_SIZE) {
> -+ cur = BSD_SENDFILE_BUF_SIZE;
> -+ } else {
> -+ cur = rem;
> -+ }
> -+
> -+ cur = fdread(in_fd, buf, cur);
> -+ check(cur >= 0, "Internal sendfile emulation failed: fdread: %i", cur);
> -+
> -+ if (cur != 0) {
> -+ sent = fdwrite(out_fd, buf, cur);
> -+ check(sent == cur, "Internal sendfile emulation failed: fdread: %i,
> fdwrite: %i", cur, sent);
> -+ }
> -+ }
> -+
> -+ ret = tot;
> -+
> -+error:
> -+ if (offset != NULL) {
> -+ if (ret != -1) {
> -+ *offset += tot;
> -+ }
> -+ lseek(in_fd, orig_offset, SEEK_SET);
> -+ }
> -+ return ret;
> - }
> -
> - #endif
> Index: patches/patch-src_io_h
> ===================================================================
> RCS file: patches/patch-src_io_h
> diff -N patches/patch-src_io_h
> --- patches/patch-src_io_h 1 Apr 2011 22:28:02 -0000 1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,12 +0,0 @@
> -$OpenBSD: patch-src_io_h,v 1.1.1.1 2011/04/01 22:28:02 jeremy Exp $
> ---- src/io.h.orig Thu Feb 24 11:30:31 2011
> -+++ src/io.h Thu Feb 24 11:31:51 2011
> -@@ -86,7 +86,7 @@ int IOBuf_stream_file(IOBuf *buf, int fd, int len);
> -
> - #define IOBuf_fd(I) ((I)->fd)
> -
> --#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
> -+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) ||
> defined(__OpenBSD__)
> - #define Dir_send bsd_sendfile
> - #else
> - #define Dir_send sendfile
> Index: patches/patch-src_polarssl_net_c
> ===================================================================
> RCS file: patches/patch-src_polarssl_net_c
> diff -N patches/patch-src_polarssl_net_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_polarssl_net_c 30 Jun 2011 15:27:13 -0000
> @@ -0,0 +1,12 @@
> +$OpenBSD$
> +--- src/polarssl/net.c.orig Thu Jun 30 08:27:01 2011
> ++++ src/polarssl/net.c Thu Jun 30 08:27:02 2011
> +@@ -59,7 +59,7 @@ static int wsa_init_done = 0;
> + #include <netdb.h>
> + #include <errno.h>
> +
> +-#if defined(__FreeBSD__)
> ++#if defined(__FreeBSD__) || defined(__OpenBSD__)
> + #include <sys/endian.h>
> + #elif defined(__APPLE__)
> + #include <machine/endian.h>
> Index: patches/patch-src_task_asm_S
> ===================================================================
> RCS file: patches/patch-src_task_asm_S
> diff -N patches/patch-src_task_asm_S
> --- patches/patch-src_task_asm_S 1 Apr 2011 22:28:02 -0000 1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,21 +0,0 @@
> -$OpenBSD: patch-src_task_asm_S,v 1.1.1.1 2011/04/01 22:28:02 jeremy Exp $
> ---- src/task/asm.S.orig Thu Feb 24 13:03:43 2011
> -+++ src/task/asm.S Thu Feb 24 13:05:01 2011
> -@@ -6,10 +6,16 @@
> - #define GET getmcontext
> - #endif
> -
> --#if defined(__OpenBSD__) && defined(__i386__)
> -+#if defined(__OpenBSD__)
> -+#if defined(__i386__)
> - #define NEEDX86CONTEXT 1
> - #define SET setmcontext
> - #define GET getmcontext
> -+#elif defined(__x86_64__)
> -+#define NEEDAMD64CONTEXT 1
> -+#define SET setmcontext
> -+#define GET getmcontext
> -+#endif
> - #endif
> -
> - #if defined(__APPLE__)
> Index: patches/patch-src_task_context_c
> ===================================================================
> RCS file: patches/patch-src_task_context_c
> diff -N patches/patch-src_task_context_c
> --- patches/patch-src_task_context_c 1 Apr 2011 22:28:02 -0000 1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,19 +0,0 @@
> -$OpenBSD: patch-src_task_context_c,v 1.1.1.1 2011/04/01 22:28:02 jeremy Exp $
> ---- src/task/context.c.orig Sun Jan 9 15:18:13 2011
> -+++ src/task/context.c Thu Feb 24 12:36:11 2011
> -@@ -20,9 +20,14 @@
> - #define NEEDSWAPCONTEXT
> - #endif
> -
> --#if defined(__OpenBSD__) && defined(__i386__)
> -+#if defined(__OpenBSD__)
> -+#if defined(__i386__)
> - #define NEEDX86MAKECONTEXT
> - #define NEEDSWAPCONTEXT
> -+#elif defined(__x86_64__)
> -+#define NEEDAMD64MAKECONTEXT
> -+#define NEEDSWAPCONTEXT
> -+#endif
> - #endif
> -
> - #if defined(__linux__) && defined(__arm__)
> Index: patches/patch-src_task_taskimpl_h
> ===================================================================
> RCS file: patches/patch-src_task_taskimpl_h
> diff -N patches/patch-src_task_taskimpl_h
> --- patches/patch-src_task_taskimpl_h 1 Apr 2011 22:28:02 -0000 1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,12 +0,0 @@
> -$OpenBSD: patch-src_task_taskimpl_h,v 1.1.1.1 2011/04/01 22:28:02 jeremy Exp
> $
> ---- src/task/taskimpl.h.orig Thu Feb 24 12:21:50 2011
> -+++ src/task/taskimpl.h Thu Feb 24 12:22:11 2011
> -@@ -88,6 +88,8 @@ extern void makecontext(ucontext_t*, void(*)
> - # define ucontext_t libthread_ucontext_t
> - # if defined __i386__
> - # include "386-ucontext.h"
> -+# elif defined(__x86_64__)
> -+# include "amd64-ucontext.h"
> - # else
> - # include "power-ucontext.h"
> - # endif
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/www/mongrel2/pkg/PLIST,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 PLIST
> --- pkg/PLIST 1 Apr 2011 22:28:02 -0000 1.1.1.1
> +++ pkg/PLIST 30 Jun 2011 15:52:26 -0000
> @@ -1,7 +1,14 @@
> @comment $OpenBSD: PLIST,v 1.1.1.1 2011/04/01 22:28:02 jeremy Exp $
> @bin bin/m2sh
> @bin bin/mongrel2
> +lib/mongrel2/
> +lib/mongrel2/config_modules/
> +lib/mongrel2/config_modules/null.so
> +lib/mongrel2/config_modules/zmq.so
> +lib/mongrel2/filters/
> +lib/mongrel2/filters/null.so
> share/examples/mongrel2/
> +share/examples/mongrel2/.dexy
> share/examples/mongrel2/bbs/
> share/examples/mongrel2/bbs/bbs.lua
> share/examples/mongrel2/bbs/client.py
> @@ -55,6 +62,7 @@ share/examples/mongrel2/configs/any.conf
> share/examples/mongrel2/configs/complex.conf
> share/examples/mongrel2/configs/mongrel2.conf
> share/examples/mongrel2/configs/multi.conf
> +share/examples/mongrel2/configs/multi_handler.conf
> share/examples/mongrel2/configs/sample.conf
> share/examples/mongrel2/http_0mq/
> share/examples/mongrel2/http_0mq/http.py
> @@ -104,10 +112,12 @@ share/examples/mongrel2/python/mongrel2/
> share/examples/mongrel2/python/mongrel2/config/commands.py
> share/examples/mongrel2/python/mongrel2/config/model.py
> share/examples/mongrel2/python/mongrel2/config/rc.py
> +share/examples/mongrel2/python/mongrel2/control.py
> share/examples/mongrel2/python/mongrel2/handler.py
> share/examples/mongrel2/python/mongrel2/request.py
> share/examples/mongrel2/python/mongrel2/sql/
> share/examples/mongrel2/python/mongrel2/sql/config.sql
> +share/examples/mongrel2/python/mongrel2/tnetstrings.py
> share/examples/mongrel2/python/setup.py
> share/examples/mongrel2/python/tests/
> share/examples/mongrel2/python/tests/__init__.py
>
--
Cheers,
Jasper
"Capable, generous men do not create victims, they nurture them."