Package: squid
Version: 2.6.19-1
Severity: normal
Tags: patch

If the 1st cache_dir line in a squid configuration file specifies cache type 
coss, the init script 
will fail to auto-create the specified coss cache file and thus squid will fail.
This is particularly a problem form people using a coss cache file on a tmpfs 
directory, as the cache 
structure needs to be re-created on every reboot.

I have modified the startup script to check for the presence of the cache file, 
as specified in the 
cache_dir line, if the cache type is coss. If not found then 'squid -z' is 
executed.

Patch included.

Regards

Os

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.24
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages squid depends on:
ii  adduser                       3.107      add and remove users and groups
ii  debconf [debconf-2.0]         1.5.21     Debian configuration management sy
ii  libc6                         2.7-10     GNU C Library: Shared libraries
ii  libdb4.6                      4.6.21-6   Berkeley v4.6 Database Libraries [
ii  libldap-2.4-2                 2.4.7-6.2  OpenLDAP libraries
ii  libpam0g                      0.99.7.1-6 Pluggable Authentication Modules l
ii  logrotate                     3.7.1-3    Log rotation utility
ii  lsb-base                      3.2-11     Linux Standard Base 3.2 init scrip
ii  netbase                       4.32       Basic TCP/IP networking system
ii  squid-common                  2.6.19-1   Internet object cache (WWW proxy c

squid recommends no packages.

-- debconf information:
  squid/fix_cachedir_perms: false
  squid/fix_lines: true
--- squid       2008-05-04 21:13:04.000000000 +0100
+++ squid.new   2008-05-04 21:23:35.000000000 +0100
@@ -55,6 +55,19 @@
        echo "$res"
 }
 
+grepconf3 () {
+        w="     " # space tab
+        sq=/etc/squid/$NAME.conf
+        # sed is cool.
+        res=`sed -ne '
+                s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
+                t end;
+                d;
+                :end q' < $sq`
+        [ -n "$res" ] || res=$2
+        echo "$res"
+}
+
 #
 #      Try to increase the # of filedescriptors we can open.
 #
@@ -72,6 +85,7 @@
 
 start () {
        cdr=`grepconf2 cache_dir /var/spool/$NAME`
+       ctp=`grepconf3 cache_dir ufs`
 
        case "$cdr" in
                [0-9]*)
@@ -84,9 +98,9 @@
        #
     # Create spool dirs if they don't exist.
     #
-       if [ -d "$cdr" -a ! -d "$cdr/00" ]
+       if [ -d "$cdr" -a ! -d "$cdr/00" ] || [ "$ctp" = "coss" -a ! -f "$cdr" ]
        then
-               log_warning_msg "Creating squid spool directory structure"
+               log_warning_msg "Creating squid cache structure"
                $DAEMON $SQUID_ARGS -z
        fi
 

Reply via email to