Package: squid
Version: 2.7.STABLE9-4
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu oneiric ubuntu-patch



*** /tmp/tmpvb3dgG
In Ubuntu, the attached patch was applied to achieve the following:

If the directive 'cache_dir null no-cache' (i.e. don't cache anything)
is present in the squid configuration the config and postinst scripts
do not deal with the scenario and attempt to stat and chown 'no-cache'.

This fix simply checks that target of any ownership changes is actually
a valid target to change.

  * debian/postinst, debian/config:
    - Fix upgrade failures where cache_dir type of null is in use by 
      checking that cache_dir points at a real directory or symbolic
      link (LP: #800468).


Thanks for considering the patch.


-- System Information:
Debian Release: wheezy/sid
  APT prefers oneiric-updates
  APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500, 
'oneiric')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-8-generic (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
=== modified file 'debian/changelog'

=== modified file 'debian/config'
--- debian/config       2010-07-02 13:43:09 +0000
+++ debian/config       2011-06-24 11:01:36 +0000
@@ -61,10 +61,13 @@
        dir=`grepconf2 cache_dir /var/spool/squid`
        usr=`grepconf cache_effective_user proxy`
        grp=`grepconf cache_effective_group proxy`
-               
-       if [ "$(stat -L -c %U $dir)" != "$usr" ] || [ "$(stat -L -c %G $dir)" 
!= "$grp" ] ; then
-         db_input high "squid/fix_cachedir_perms" || true
-         db_go
+       
+       # Check its a directory or link before fixing perms
+       if [ -d $dir ] || [ -L $dir ]; then     
+               if [ "$(stat -L -c %U $dir)" != "$usr" ] || [ "$(stat -L -c %G 
$dir)" != "$grp" ] ; then
+                 db_input high "squid/fix_cachedir_perms" || true
+                 db_go
+               fi
        fi
   fi
 }

=== modified file 'debian/postinst'
--- debian/postinst     2011-03-08 13:42:01 +0000
+++ debian/postinst     2011-06-24 11:57:26 +0000
@@ -126,12 +126,17 @@
                if [ "$FIXLINES" = "false" ]; then
                  echo "squid.conf contains 2.2.5 syntax - not doing anything!" 
                else
-                       if [ "$(stat -c %U $dir)" != "$usr" ] || [ "$(stat -c 
%G $dir)" != "$grp" ] ; then
-                               db_get "squid/fix_cachedir_perms"
-                               if [ "$RET" = "true" ] ; then
-                               chown $usr:$grp $dir -R
+                       # cache_dir type might be 'null' so check that 
+                       # it points to a valid directory or link before deciding
+                       # what todo with permissions
+                       if [ -d $dir ] || [ -L $dir ]; then
+                               if [ "$(stat -c %U $dir)" != "$usr" ] || [ 
"$(stat -c %G $dir)" != "$grp" ] ; then
+                                       db_get "squid/fix_cachedir_perms"
+                                       if [ "$RET" = "true" ] ; then
+                                       chown $usr:$grp $dir -R
+                                       fi
+                                       db_reset "squid/fix_cachedir_perms"
                                fi
-                               db_reset "squid/fix_cachedir_perms"
                        fi
                        if [ "$(stat -c %U /var/log/squid)" != "$usr" ] || [ 
"$(stat -c %G /var/log/squid)" != "$grp" ] ; then
                                # Check if there is an override of ownership

Reply via email to