/tmp/portslicense.*

Pan Tsu inyaoo at gmail.com
Wed Mar 23 18:23:08 UTC 2011


"J. Hellenthal" <jhell at DataIX.net> writes:

> On Wed, 23 Mar 2011 10:16, naddy@ wrote:
>> I notice that empty portslicense.* files keep accumulating in /tmp.
>>> From time to time I manually delete them, but shouldn't the ports
>> framework remove them?
>>
>
> I haven't seen this happen once throughout the ports that I use. Can
> you identify the port that its originating from if it is originating
> from ports at all ?

It's the framework itself leaves that garbage when using LICENSES_ASK.

%%
Index: Mk/bsd.licenses.mk
===================================================================
RCS file: /a/.cvsup/ports/Mk/bsd.licenses.mk,v
retrieving revision 1.7
diff -u -p -r1.7 bsd.licenses.mk
--- Mk/bsd.licenses.mk	17 Mar 2011 14:29:58 -0000	1.7
+++ Mk/bsd.licenses.mk	23 Mar 2011 17:53:22 -0000
@@ -493,7 +493,7 @@ _LICENSE_GROUPS:=	${_LICENSE_GROUPS:N${c
 # Prepare information for asking license to the user
 
 .if ${_LICENSE_STATUS} == "ask" && ${_LICENSE_COMB} != "single"
-_LICENSE_ASK_DATA!=	mktemp -t portslicense
+_LICENSE_ASK_DATA!=	mktemp -ut portslicense
 .endif
 
 # Calculate restrictions and set RESTRICTED_FILES when
@@ -596,8 +596,9 @@ ${_LICENSE_COOKIE}:
 .	if !defined(NO_LICENSES_DIALOGS)
 # Dialog interface
 .		if ${_LICENSE_COMB} == "single"
-	@while true; do \
-		tmpfile=$$(mktemp -t portlicenses); \
+	@trap '${RM} -f $$tmpfile' EXIT INT TERM; \
+	tmpfile=$$(mktemp -t portlicenses); \
+	while true; do \
 		${DIALOG} --menu "License for ${PKGNAME} (${_LICENSE})" 21 70 15 accept "Accept license" reject "Reject license" view "View license" 2>"$${tmpfile}"; \
 		result=`${CAT} $${tmpfile}`; \
 		case $${result} in \
@@ -613,6 +614,7 @@ ${_LICENSE_COOKIE}:
 	@${ECHO_CMD} "${lic}:${_LICENSE_FILE_${lic}}" >> ${_LICENSE_ASK_DATA}
 .			endfor
 	@menu_cmd="${DIALOG} --title \"This port requires you to accept at least one license\" --menu \"License for ${PKGNAME} (dual)\" 21 70 15"; \
+	trap '${RM} -f $$tmpfile' EXIT INT TERM; \
 	tmpfile=$$(mktemp -t portlicenses); \
 	for lic in ${_LICENSE_TO_ASK}; do \
 		menu_cmd="$${menu_cmd} VIEW_$${lic} \"View the license $${lic}\" USE_$${lic} \"Accept the license $${lic}\""; \
@@ -638,6 +640,7 @@ ${_LICENSE_COOKIE}:
 	@${ECHO_CMD} "${lic}:${_LICENSE_FILE_${lic}}" >> ${_LICENSE_ASK_DATA}
 .			endfor
 	@menu_cmd="${DIALOG} --title \"This port requires you to accept all mentioned licenses\" --menu \"License for ${PKGNAME} (multi)\" 21 70 15"; \
+	trap '${RM} -f $$tmpfile' EXIT INT TERM; \
 	tmpfile=$$(mktemp -t portlicenses); \
 	for lic in ${_LICENSE_TO_ASK}; do \
 		menu_cmd="$${menu_cmd} VIEW_$${lic} \"View the license $${lic}\""; \
@@ -679,6 +682,7 @@ ${_LICENSE_COOKIE}:
 	@${ECHO_MSG}
 	@exit 1
 .	endif
+	@${RM} -f ${_LICENSE_ASK_DATA}
 .endif
 
 # Create report and catalog
%%


More information about the freebsd-ports mailing list