Bug 178304 - [patch] www/squid33 doesn't work in SMP mode
Summary: [patch] www/squid33 doesn't work in SMP mode
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: tmseck
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-03 01:20 UTC by anonymous
Modified: 2013-07-04 22:47 UTC (History)
0 users

See Also:


Attachments
file.diff (3.82 KB, patch)
2013-05-03 01:20 UTC, anonymous
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description anonymous 2013-05-03 01:20:00 UTC
Squid tries to save its ipc sockets in localstatedir(/var/squid)/run/squid which it can't write to.

Fix: Change localstatedir to "/var" so squid uses /var/run/squid instead.
/var/squid/cache/squid => /var/squid/cache
/var/squid/run/squid => /var/run/squid

Patch attached with submission follows:
How-To-Repeat: Add "workers=2" to squid.conf
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-05-04 22:24:49 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-ports-bugs

Ports PR.
Comment 2 Edwin Groothuis freebsd_committer 2013-05-04 22:25:23 UTC
Responsible Changed
From-To: freebsd-ports-bugs->tmseck

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 3 tmseck freebsd_committer 2013-05-05 13:37:36 UTC
Thanks for the report, I'll have a look at the way Squid's work
directory structure is set up in the 3.x ports.
Comment 4 dfilter service freebsd_committer 2013-05-11 12:00:02 UTC
Author: tmseck
Date: Sat May 11 10:59:52 2013
New Revision: 317862
URL: http://svnweb.freebsd.org/changeset/ports/317862

Log:
  - Move Squid's IPC work directory from /var/squid/run/squid/ to
    /var/run/squid/. This should fix issues with SMP mode [1].
  - Rename some variables in pkg-install.in to be consistent with pkg-deinstall.
  - Fix the path of the default cache directory in pkg-message.in.
  - Otherwise no user visible changes.
  
  PR:		ports/178304 [1]
  Approved by:	flo (mentor)

Modified:
  head/www/squid32/Makefile
  head/www/squid32/files/pkg-install.in
  head/www/squid32/files/pkg-message.in
  head/www/squid32/pkg-deinstall
  head/www/squid33/Makefile
  head/www/squid33/files/pkg-install.in
  head/www/squid33/files/pkg-message.in
  head/www/squid33/pkg-deinstall

Modified: head/www/squid32/Makefile
==============================================================================
--- head/www/squid32/Makefile	Sat May 11 10:05:53 2013	(r317861)
+++ head/www/squid32/Makefile	Sat May 11 10:59:52 2013	(r317862)
@@ -38,6 +38,7 @@
 
 PORTNAME=	squid
 PORTVERSION=	3.2.${SQUID_STABLE_VER}
+PORTREVISION=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	ftp://ftp.squid-cache.org/pub/%SUBDIR%/ \
 		http://mirrors.ccs.neu.edu/Squid/ \
@@ -222,10 +223,11 @@ CONFIGURE_ARGS=	--with-default-user=squi
 		--sbindir=${PREFIX}/sbin  \
 		--datadir=${ETCDIR} \
 		--libexecdir=${PREFIX}/libexec/squid \
-		--localstatedir=/var/squid \
+		--localstatedir=/var \
 		--sysconfdir=${ETCDIR} \
 		--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 \

Modified: head/www/squid32/files/pkg-install.in
==============================================================================
--- head/www/squid32/files/pkg-install.in	Sat May 11 10:05:53 2013	(r317861)
+++ head/www/squid32/files/pkg-install.in	Sat May 11 10:59:52 2013	(r317862)
@@ -5,8 +5,8 @@
 
 PATH=/bin:/usr/bin:/usr/sbin
 pkgname=$1
-squid_base="/var/squid"
-squid_cachedir="${squid_base}/cache"
+squid_homedir="/var/squid"
+squid_cache_basedir="${squid_homedir}/cache"
 squid_confdir="${PKG_PREFIX:-%%PREFIX%%}/etc/squid"
 squid_logdir="/var/log/squid"
 squid_rundir="/var/run/squid"
@@ -21,23 +21,23 @@ PRE-INSTALL)
 	;;
 POST-INSTALL)
 	# Since we usually start the Squid master process as ${squid_user}
-	# instead of root make sure that ${squid_base} is writable for it.
-	if [ ! -d ${squid_base} ]; then
-		echo "Creating ${squid_base}..."
+	# instead of root make sure that ${squid_homedir} is writable for it.
+	if [ ! -d ${squid_homedir} ]; then
+		echo "Creating ${squid_homedir}..."
 		install -d -o root -g ${squid_group} \
-		    -m 0775 ${squid_base}
+		    -m 0775 ${squid_homedir}
 	else
-		chgrp ${squid_group} ${squid_base}
-		chmod g+w ${squid_base}
+		chgrp ${squid_group} ${squid_homedir}
+		chmod g+w ${squid_homedir}
 	fi
-	if [ ! -d ${squid_cachedir} ]; then
-		echo "Creating ${squid_cachedir} ..."
+	if [ ! -d ${squid_cache_basedir} ]; then
+		echo "Creating ${squid_cache_basedir} ..."
 		install -d -o ${squid_user} -g ${squid_group} \
-		    -m 0750 ${squid_cachedir}
+		    -m 0750 ${squid_cache_basedir}
 	else
-		chown ${squid_user} ${squid_cachedir}
-		chgrp ${squid_group} ${squid_cachedir}
-		chmod 0750 ${squid_cachedir}
+		chown ${squid_user} ${squid_cache_basedir}
+		chgrp ${squid_group} ${squid_cache_basedir}
+		chmod 0750 ${squid_cache_basedir}
 	fi
 	if [ ! -d ${squid_confdir} ]; then
 		echo "Creating ${squid_confdir}..."

Modified: head/www/squid32/files/pkg-message.in
==============================================================================
--- head/www/squid32/files/pkg-message.in	Sat May 11 10:05:53 2013	(r317861)
+++ head/www/squid32/files/pkg-message.in	Sat May 11 10:59:52 2013	(r317862)
@@ -1,7 +1,7 @@
      o You can find the configuration files for this package in the
        directory %%PREFIX%%/etc/squid.
 
-     o The default cache directory is /var/squid/.
+     o The default cache directory is /var/squid/cache/squid/.
        The default log directory is /var/log/squid/.
 
        Note:

Modified: head/www/squid32/pkg-deinstall
==============================================================================
--- head/www/squid32/pkg-deinstall	Sat May 11 10:05:53 2013	(r317861)
+++ head/www/squid32/pkg-deinstall	Sat May 11 10:59:52 2013	(r317862)
@@ -6,7 +6,6 @@
 PATH=/bin:/usr/bin:/usr/sbin
 squid_homedir="/var/squid"
 squid_cache_basedir="${squid_homedir}/cache"
-squid_state_basedir="${squid_homedir}/run"
 squid_confdir=${PKG_PREFIX}/etc/squid
 squid_logdir="/var/log/squid"
 squid_rundir="/var/run/squid"
@@ -18,7 +17,7 @@ DEINSTALL)
 		cmp -s -z ${f} ${f}.default && rm ${f}
 	done
 	# try to cleanup directories in /var:
-	for d in ${squid_cache_basedir}/squid ${squid_cache_basedir} ${squid_state_basedir}/squid ${squid_state_basedir} ${squid_homedir} ${squid_logdir} ${squid_rundir}; do
+	for d in ${squid_cache_basedir}/squid ${squid_cache_basedir} ${squid_homedir} ${squid_logdir} ${squid_rundir}; do
 		rmdir ${d} 2>/dev/null
 	done
 	;;

Modified: head/www/squid33/Makefile
==============================================================================
--- head/www/squid33/Makefile	Sat May 11 10:05:53 2013	(r317861)
+++ head/www/squid33/Makefile	Sat May 11 10:59:52 2013	(r317862)
@@ -39,6 +39,7 @@
 
 PORTNAME=	squid
 PORTVERSION=	3.3.${SQUID_STABLE_VER}
+PORTREVISION=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	ftp://ftp.squid-cache.org/pub/%SUBDIR%/ \
 		http://mirrors.ccs.neu.edu/Squid/ \
@@ -228,10 +229,11 @@ CONFIGURE_ARGS=	--with-default-user=squi
 		--sbindir=${PREFIX}/sbin  \
 		--datadir=${ETCDIR} \
 		--libexecdir=${PREFIX}/libexec/squid \
-		--localstatedir=/var/squid \
+		--localstatedir=/var \
 		--sysconfdir=${ETCDIR} \
 		--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 \

Modified: head/www/squid33/files/pkg-install.in
==============================================================================
--- head/www/squid33/files/pkg-install.in	Sat May 11 10:05:53 2013	(r317861)
+++ head/www/squid33/files/pkg-install.in	Sat May 11 10:59:52 2013	(r317862)
@@ -5,8 +5,8 @@
 
 PATH=/bin:/usr/bin:/usr/sbin
 pkgname=$1
-squid_base="/var/squid"
-squid_cachedir="${squid_base}/cache"
+squid_homedir="/var/squid"
+squid_cache_basedir="${squid_homedir}/cache"
 squid_confdir="${PKG_PREFIX:-%%PREFIX%%}/etc/squid"
 squid_logdir="/var/log/squid"
 squid_rundir="/var/run/squid"
@@ -21,23 +21,23 @@ PRE-INSTALL)
 	;;
 POST-INSTALL)
 	# Since we usually start the Squid master process as ${squid_user}
-	# instead of root make sure that ${squid_base} is writable for it.
-	if [ ! -d ${squid_base} ]; then
-		echo "Creating ${squid_base}..."
+	# instead of root make sure that ${squid_homedir} is writable for it.
+	if [ ! -d ${squid_homedir} ]; then
+		echo "Creating ${squid_homedir}..."
 		install -d -o root -g ${squid_group} \
-		    -m 0775 ${squid_base}
+		    -m 0775 ${squid_homedir}
 	else
-		chgrp ${squid_group} ${squid_base}
-		chmod g+w ${squid_base}
+		chgrp ${squid_group} ${squid_homedir}
+		chmod g+w ${squid_homedir}
 	fi
-	if [ ! -d ${squid_cachedir} ]; then
-		echo "Creating ${squid_cachedir} ..."
+	if [ ! -d ${squid_cache_basedir} ]; then
+		echo "Creating ${squid_cache_basedir} ..."
 		install -d -o ${squid_user} -g ${squid_group} \
-		    -m 0750 ${squid_cachedir}
+		    -m 0750 ${squid_cache_basedir}
 	else
-		chown ${squid_user} ${squid_cachedir}
-		chgrp ${squid_group} ${squid_cachedir}
-		chmod 0750 ${squid_cachedir}
+		chown ${squid_user} ${squid_cache_basedir}
+		chgrp ${squid_group} ${squid_cache_basedir}
+		chmod 0750 ${squid_cache_basedir}
 	fi
 	if [ ! -d ${squid_confdir} ]; then
 		echo "Creating ${squid_confdir}..."

Modified: head/www/squid33/files/pkg-message.in
==============================================================================
--- head/www/squid33/files/pkg-message.in	Sat May 11 10:05:53 2013	(r317861)
+++ head/www/squid33/files/pkg-message.in	Sat May 11 10:59:52 2013	(r317862)
@@ -1,7 +1,7 @@
      o You can find the configuration files for this package in the
        directory %%PREFIX%%/etc/squid.
 
-     o The default cache directory is /var/squid/.
+     o The default cache directory is /var/squid/cache/squid/.
        The default log directory is /var/log/squid/.
 
        Note:

Modified: head/www/squid33/pkg-deinstall
==============================================================================
--- head/www/squid33/pkg-deinstall	Sat May 11 10:05:53 2013	(r317861)
+++ head/www/squid33/pkg-deinstall	Sat May 11 10:59:52 2013	(r317862)
@@ -6,7 +6,6 @@
 PATH=/bin:/usr/bin:/usr/sbin
 squid_homedir="/var/squid"
 squid_cache_basedir="${squid_homedir}/cache"
-squid_state_basedir="${squid_homedir}/run"
 squid_confdir=${PKG_PREFIX}/etc/squid
 squid_logdir="/var/log/squid"
 squid_rundir="/var/run/squid"
@@ -18,7 +17,7 @@ DEINSTALL)
 		cmp -s -z ${f} ${f}.default && rm ${f}
 	done
 	# try to cleanup directories in /var:
-	for d in ${squid_cache_basedir}/squid ${squid_cache_basedir} ${squid_state_basedir}/squid ${squid_state_basedir} ${squid_homedir} ${squid_logdir} ${squid_rundir}; do
+	for d in ${squid_cache_basedir}/squid ${squid_cache_basedir} ${squid_homedir} ${squid_logdir} ${squid_rundir}; do
 		rmdir ${d} 2>/dev/null
 	done
 	;;
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Juergen Lock freebsd_committer 2013-07-04 22:47:38 UTC
State Changed
From-To: open->closed

Committed. Thanks!