squid-1.2.beta5 bugs, patches

From: David Luyer <luyer@dont-contact.us>
Date: Sat, 08 Nov 1997 12:04:00 +0800

--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii

To get squid-1.2.beta5 to compile on Linux 2.0.31 with glibc2.0.5c...

(this first bit is just an optimization to lib/sha.c, as done in
Linux's drivers/random/char.c [the whole function there is much more
optimized])

22c22
< #define f1(x,y,z) ((x & y) | (~x & z))

---
> #define f1(x,y,z)     (z ^ (x & (y ^ z)))
24c24
< #define f3(x,y,z)     ((x & y) | (x & z) | (y & z))
---
> #define f3(x,y,z)     ((x & y) | (z & (x | y)))
(now, to make POLL happy, I put this in include/config.h.in)
165a166,172
> #ifdef HAVE_POLL
> #ifndef POLLRDNORM
> #define POLLRDNORM POLLIN
> #endif
> #ifndef POLLWRNORM
> #define POLLWRNORM POLLOUT
> #endif
> #endif
(This glibc actually has the second done already but not the first)
(then, because some macro somewhere was messing with errno)
161c161
< static int ignoreErrno(int errno);
---
> static int ignoreErrno(int ierrno);
1395c1395
< ignoreErrno(int errno)
---
> ignoreErrno(int ierrno)
1397c1397
<     if (errno == EWOULDBLOCK)
---
>     if (ierrno == EWOULDBLOCK)
1400c1400
<     if (errno == EAGAIN)
---
>     if (ierrno == EAGAIN)
1403c1403
<     if (errno == EALREADY)
---
>     if (ierrno == EALREADY)
1405c1405
<     if (errno == EINTR)
---
>     if (ierrno == EINTR)
Now it compiles.  Then I defined STORE_KEY_SHA and USE_ASYNC_IO.
There's a lot in aiops.h which is defined to return something but
returns nothing, plus an unused variable laying around, but it still
compiled everything; however I had to manually edit -lpthread into
src/Makefile, even though I'd re-run configure.
In src/disk.c
381d380
<     fde *F = &fd_table[fd];
382a382
>     fde *F = &fd_table[fd];
(F isn't used if USE_ASYNC_IO is set)
The resulting binary just dies with (whether I try squid -z or just squid):
FATAL: Received Segment Violation...dying.
(squid): disk.c:194: file_close: Assertion `fd >= 0' failed.
A 'strace' reveals no open() has failed at any point.  It's before it finishes
parsing squid.conf so it doesn't enable full debugging by this point. Anyway,
I made file_close() a macro with the assert() in it to find it was line 284 of
store_dir.c which didn't like me.  Wrapping storeDirCloseSwapLogs() told me 
that
storeWriteCleanLogs was calling it before the storeDir's were setup (in fact,
if store_rebuilding, storeDirCloseSwapLogs()).
I added in here (around line 1931 of store.c):
        if(Config.cacheSwap.swapDirs > 0 &&
           Config.cacheSwap.swapDirs[0].swaplog_fd != -1)
            storeDirCloseSwapLogs();
Not elegant I know, but it should work (? can some swaplogs be open and others
closed - maybe after a reconfigure adds a single swap dir ?).
Now it just segfaults and dies without a core dump (and yes, coredumpsize is
unlimited).  So I undefined ASYNC_IO and SHA cache keys.  That got squid -z
to work.  I put back the SHA cache keys (the reason I was looking at this
version:).  Well, that now worked, and that's enough for today :)
David.
--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:44 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:29 MST