[squid-users] Squid 3.4 refresh_pattern bungled config

From: Tyler Sweet <tyler_at_tsweet.net>
Date: Wed, 31 Jul 2013 16:46:30 -0500

Hello,

I'm having an odd issue with Squid 3.4 on FreeBSD 9.1, compiled from
source. I'm not sure if this is a good place to ask for general
support for 3.4 or not, but I figured I would try.

When using the default configuration file included, the service fails
to start with the error:
FATAL: Bungled /usr/local/etc/squid/squid.conf line 75:
refresh_pattern ^ftp: 1440 20% 10080

As far as I can tell, it's correct. It's the default block of
refresh_patterns, and they worked in 3.1, 3.2, and 3.3. Running with
debug shows:
....snipped...
2013/07/31 16:42:17.618| Intercept.cc(422) ProbeForTproxy: Detect
TPROXY support on port [::]:3129
2013/07/31 16:42:17.618| Intercept.cc(429) ProbeForTproxy: ...Probing
for IPv6 TPROXY support.
2013/07/31 16:42:17.618| Intercept.cc(461) ProbeForTproxy: ...Probing
for IPv4 TPROXY support.
2013/07/31 16:42:17.618| Intercept.cc(472) ProbeForTproxy: IPv4 TPROXY
support detected. Using.
2013/07/31 16:42:17.618| tools.cc(636) leave_suid: leave_suid: PID 4334 called
2013/07/31 16:42:17.618| tools.cc(658) leave_suid: leave_suid: PID
4334 giving up root, becoming 'squid'
2013/07/31 16:42:17.619| cbdata.cc(419) cbdataInternalLock:
cbdataLock: 0x8034a4758=1
2013/07/31 16:42:17.619| cache_cf.cc(556) parseOneConfigFile:
Processing: coredump_dir /var/spool/
2013/07/31 16:42:17.619| cache_cf.cc(556) parseOneConfigFile:
Processing: refresh_pattern ^ftp: 1440 20%
10080
2013/07/31 16:42:17.619| ERROR: A percentage value is missing.
2013/07/31 16:42:17.619| tools.cc(636) leave_suid: leave_suid: PID 4334 called
2013/07/31 16:42:17.619| tools.cc(658) leave_suid: leave_suid: PID
4334 giving up root, becoming 'squid'
FATAL: Bungled /usr/local/etc/squid/squid.conf line 75:
refresh_pattern ^ftp: 1440 20% 10080
Squid Cache (Version 3.4.0.1): Terminated abnormally.
CPU Usage: 0.012 seconds = 0.012 user + 0.000 sys
....snipped....

I'm not sure why this is happening. I tried digging into the source a
bit, and came to where the error is coming from:
/*
 * This function is similar as GetInteger() but the token might contain
 * the percentage symbol (%) and we check whether the value is in the range
 * of [0, 100]
 * So, we accept two types of input: 1. XX% or 2. XX , 0<=XX<=100
 */
int
GetPercentage(void)
{
    int p;
    char *token = strtok(NULL, w_space);

    if (!token) {
        debugs(0, DBG_PARSE_NOTE(DBG_IMPORTANT), "ERROR: A percentage
value is missing.");
        self_destruct();
    }

    //if there is a % in the end of the digits, we remove it and go on.
    char* end = &token[strlen(token)-1];
    if (*end == '%') {
        *end = '\0';
    }

    p = xatoi(token);

    if (p < 0 || p > 100) {
        debugs(0, DBG_PARSE_NOTE(DBG_IMPORTANT), "ERROR: The value '"
<< token << "' is out of range. A percentage should be within [0,
100].");
        self_destruct();
    }

    return p;
}

But, with little (and closer to none at all) knowledge of C, I don't
know how to debug it. Does anyone have any ideas? Has refresh_patterns
been changed in 3.4 to a new syntax?

My compile options are:
Squid Cache: Version 3.4.0.1
configure options: '--with-default-user=squid'
'--bindir=/usr/local/sbin' '--sbindir=/usr/local/sbin'
'--datadir=/usr/local/etc/squid'
'--libexecdir=/usr/local/libexec/squid' '--localstatedir=/var'
'--sysconfdir=/usr/local/etc/squid' '--with-logdir=/var/log/squid'
'--with-pidfile=/var/run/squid/squid.pid'
'--with-swapdir=/var/squid/cache/squid' '--enable-auth'
'--enable-build-info' '--enable-loadable-modules'
'--enable-removal-policies=lru heap' '--disable-epoll'
'--disable-linux-netfilter' '--disable-translation'
'--enable-auth-basic=DB MSNT MSNT-multi-domain NCSA PAM POP3 RADIUS
fake getpwnam NIS' '--enable-auth-digest=file'
'--enable-external-acl-helpers=file_userip time_quota unix_group'
'--enable-auth-negotiate=kerberos wrapper' '--enable-auth-ntlm=fake
smb_lm' '--enable-storeio=diskd rock ufs aufs' '--enable-disk-io=AIO
Blocking DiskDaemon IpcIo Mmapped DiskThreads'
'--enable-log-daemon-helpers=file' '--enable-url-rewrite-helpers=fake'
'--disable-internal-dns' '--enable-htcp' '--disable-forw-via-db'
'--enable-cache-digests' '--enable-wccp' '--enable-wccpv2'
'--enable-eui' '--enable-ipfw-transparent' '--enable-pf-transparent'
'--disable-ipf-transparent' '--disable-follow-x-forwarded-for'
'--disable-ecap' '--disable-icap-client' '--disable-esi'
'--enable-kqueue' '--with-large-files' '--prefix=/usr/local'
'--mandir=/usr/local/man' '--infodir=/usr/local/info/'
'--build=amd64-portbld-freebsd9.1'
'build_alias=amd64-portbld-freebsd9.1' 'CC=cc' 'CFLAGS=-O2 -pipe
-fno-strict-aliasing' 'LDFLAGS= -pthread' 'CPPFLAGS=' 'CXX=c++'
'CXXFLAGS=-O2 -pipe -fno-strict-aliasing' 'CPP=cpp'
'--enable-ltdl-convenience'

Sorry if there was any bad etiquette, I'm not used to mailing lists.
Let me know if I should do something different :)
Thanks for any help!
-Sweet
Received on Wed Jul 31 2013 - 21:47:19 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 01 2013 - 12:00:32 MDT