ports/156866: [PATCH] change cachedir location/permission for print/cups-base

Alex Deiter alex.deiter at gmail.com
Sat May 7 16:50:02 UTC 2011


>Number:         156866
>Category:       ports
>Synopsis:       [PATCH] change cachedir location/permission for print/cups-base
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 07 16:50:02 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Alex Deiter
>Release:        9.0-CURRENT-r221271
>Organization:
Fine Solution
>Environment:
FreeBSD blackbox.deiter.ru 9.0-CURRENT-r221271 FreeBSD 9.0-CURRENT-r221271 #0: Sun May  1 11:01:45 MSD 2011     root at blackbox.deiter.net.ru:/usr/obj/usr/src/sys/BLACKBOX  i386

>Description:
1. Change default location for Cups cachedir from /var/cache/cups to /var/db/cups according to man 7 hier:

     /var/      multi-purpose log, temporary, transient, and spool files
     db/        miscellaneous automatically generated system-spe‐
                cific database files

2. Change permission for Cups cachedir from 755 to 775:

Cups original cups-1.4.6/scheduler/Makefile used 775 permission for cups CACHEDIR:

       echo Creating $(CACHEDIR)...
       $(INSTALL_DIR) -m 775 -g $(CUPS_GROUP) $(CACHEDIR)

with 755 permission we have errors in cups errorlog:

E [07/May/2011:18:57:55 +0400] [cups-driverd] Unable to write "/var/cache/cups/ppds.dat" - Permission denied

Could you please review attached patch ?
>How-To-Repeat:
cd /usr/ports/print/cups-base && make install
>Fix:
cd /usr/ports/print/cups-base && patch -p0 < patch-cups-cachedir.txt && make install

Patch attached with submission follows:

--- Makefile.orig	2011-05-07 19:28:06.081328256 +0400
+++ Makefile	2011-05-07 20:08:21.721264845 +0400
@@ -37,6 +37,7 @@
 			--with-icondir=${PREFIX}/share/icons	\
 			--with-menudir=${DESKTOPDIR}		\
 			--with-domainsocket=${CUPS_SOCKET}	\
+			--with-cachedir=${CUPS_CACHEDIR}	\
 			--with-pam-module="unix"		\
 			--enable-ssl
 
@@ -54,6 +55,7 @@
 		XDG_OPEN	"Build with XDG_OPEN as browser" off
 
 CUPS_ETCDIR=	${PREFIX}/etc/cups
+CUPS_CACHEDIR?=	/var/db/cups
 CUPS_SPOOLDIR=	/var/spool/cups
 CUPS_SOCKET?=	/var/run/cups.sock
 WRKSRC=		${WRKDIR}/${PORTNAME}-${DISTVERSION}
@@ -107,6 +109,7 @@
 BUILD_DEPENDS+=	${LOCALBASE}/lib/libcups.a:${PORTSDIR}/${PKGCATEGORY}/cups-client
 COMMENT2=	Server
 USE_RC_SUBR=	cupsd
+PLIST_SUB+=	CACHEDIR="${CUPS_CACHEDIR}"
 .if ${ARCH} == "ia64"
 BROKEN=		stack-protector not supported on ia64
 .endif
@@ -377,8 +380,7 @@
 	${INSTALL} -d ${CUPS_SPOOLDIR}/tmp/
 	${CHOWN} -R ${CUPSOWN}:${CUPSGRP} ${CUPS_SPOOLDIR}/
 	${CHMOD} -R g+w ${CUPS_SPOOLDIR}/
-	${INSTALL} -d /var/cache/cups/
-	${CHOWN} root:${CUPSGRP} /var/cache/cups/
+	${INSTALL} -d -m 775 -g ${CUPSGRP} ${CUPS_CACHEDIR}
 .endif
 
 .if defined(CUPS_CLIENT)
--- pkg-plist.orig	2011-05-07 19:42:51.096314756 +0400
+++ pkg-plist	2011-05-07 19:56:40.569382232 +0400
@@ -3,15 +3,15 @@
 @unexec if pw usershow cups; then pw userdel cups; fi
 @exec mkdir -p /var/spool/cups/tmp || true
 @exec chown -R root:daemon /var/spool/cups
- at exec mkdir -p /var/cache/cups || true
- at exec chown root:cups /var/cache/cups
+ at exec mkdir -p %%CACHEDIR%% || true
+ at exec chown root:cups %%CACHEDIR%%
+ at exec chmod 775 %%CACHEDIR%%
 @exec mkdir -p /var/log/cups || true
 @exec chown cups:daemon /var/log/cups
 @exec mkdir -p %D/etc/cups/ppd || true
 @exec mkdir -p %D/etc/cups/interfaces || true
 @unexec rm -rf /var/spool/cups 2>/dev/null || true
- at unexec rm -rf /var/cache/cups 2>/dev/null || true
- at unexec rmdir /var/cache 2>/dev/null || true
+ at unexec rm -rf %%CACHEDIR%% 2>/dev/null || true
 @unexec rmdir /var/log/cups 2>/dev/null || true
 @unexec rmdir /var/run/cups/certs 2>/dev/null || true
 @unexec rmdir /var/run/cups 2>/dev/null || true


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list