From vangyzen@amelia.vangyzen.net  Sat Nov  8 15:40:41 2003
Return-Path: <vangyzen@amelia.vangyzen.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3ED5116A4D0
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  8 Nov 2003 15:40:41 -0800 (PST)
Received: from amelia.vangyzen.net (trillian.client.intrex.net [209.42.213.136])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5F58E44001
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  8 Nov 2003 15:40:23 -0800 (PST)
	(envelope-from vangyzen@amelia.vangyzen.net)
Received: by amelia.vangyzen.net (Postfix, from userid 1001)
	id 51980FD040; Sat,  8 Nov 2003 17:39:19 -0500 (EST)
Message-Id: <20031108223919.51980FD040@amelia.vangyzen.net>
Date: Sat,  8 Nov 2003 17:39:19 -0500 (EST)
From: Eric van Gyzen <vangyzen@stat.duke.edu>
Reply-To: Eric van Gyzen <vangyzen@stat.duke.edu>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: /tmp/.X0-lock is not removed if clear_tmp_enable is not enabled
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         59065
>Category:       conf
>Synopsis:       /tmp/.X0-lock is not removed if clear_tmp_enable is not enabled
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    mtm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 08 15:50:15 PST 2003
>Closed-Date:    Mon Dec 01 08:38:28 PST 2003
>Last-Modified:  Mon Dec  1 09:00:30 PST 2003
>Originator:     Eric van Gyzen
>Release:        FreeBSD 5.1-RELEASE-p10 i386
>Organization:
Duke University Statistics
>Environment:
FreeBSD 5.1-RELEASE-p10 i386

>Description:
The /tmp/.X0-lock file is removed by /etc/rc.d/cleartmp, which runs only
if the clear_tmp_enable variable is true.  The file should be removed on
boot, unconditionally.

>How-To-Repeat:
N/A

>Fix:
Perhaps someone more familiar with the rc system could suggest a fix...

>Release-Note:
>Audit-Trail:

From: Kris Kennaway <kris@obsecurity.org>
To: Eric van Gyzen <vangyzen@stat.duke.edu>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: conf/59065: /tmp/.X0-lock is not removed if clear_tmp_enable is not enabled
Date: Sun, 9 Nov 2003 14:39:55 -0800

 --6TrnltStXW4iwmi0
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Sat, Nov 08, 2003 at 05:39:19PM -0500, Eric van Gyzen wrote:
 
 > >Description:
 > The /tmp/.X0-lock file is removed by /etc/rc.d/cleartmp, which runs only
 > if the clear_tmp_enable variable is true.  The file should be removed on
 > boot, unconditionally.
 
 I think you got precisely the behaviour you asked for.  Many
 applications use /tmp for storage of lock files and other temporary
 data - if you want them to restart correctly after a reboot, clear
 /tmp.
 
 Kris
 
 --6TrnltStXW4iwmi0
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.3 (FreeBSD)
 
 iD8DBQE/rsI7Wry0BWjoQKURAn0xAKDxG8lZ0UmDASw2Uz9VqTb7zjqsygCfcL1C
 0jw3b0mofLZ87yiz7YuvUwA=
 =fNFc
 -----END PGP SIGNATURE-----
 
 --6TrnltStXW4iwmi0--

From: Eric van Gyzen <vangyzen@stat.duke.edu>
To: Kris Kennaway <kris@obsecurity.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: conf/59065: /tmp/.X0-lock is not removed if clear_tmp_enable is not enabled
Date: Mon, 10 Nov 2003 12:59:39 -0500

 Kris Kennaway wrote:
 > On Sat, Nov 08, 2003 at 05:39:19PM -0500, Eric van Gyzen wrote:
 > > >Description:
 > > The /tmp/.X0-lock file is removed by /etc/rc.d/cleartmp, which runs only
 > > if the clear_tmp_enable variable is true.  The file should be removed on
 > > boot, unconditionally.
 >
 > I think you got precisely the behaviour you asked for.  Many
 > applications use /tmp for storage of lock files and other temporary
 > data - if you want them to restart correctly after a reboot, clear
 > /tmp.
 
 It's true that many applications -- and users -- use /tmp for storage of 
 various things...so many and so various, in fact, that clearing it at boot is 
 too drastic in some environments.  There might be plenty of reasons not to 
 clear /tmp; that's why it's not done by default.
 
 X is a well-known application that practically everyone uses, and there is no 
 imaginable reason NOT to remove the lock file.  It is a special case of a 
 lock file that just happens to be stored in /tmp.  If it were stored in 
 /var/run along with various other lock files (rpcbind.lock, ypbind.lock), it 
 would be removed unconditionally by the cleanvar rc script.  In fact, the old 
 rc system /did/ remove it unconditionally regardless of clear_tmp_enable:
 
   # Clearing /tmp at boot-time seems to have a long tradition.  It doesn't
   # help in any way for long-living systems, and it might accidentally
   # clobber files you would rather like to have preserved after a crash
 [snip]
   case ${clear_tmp_enable} in
 [snip]
   esac
 
   # Remove X lock files, since they will prevent you from restarting X11
   # after a system crash.
   #
   rm -f /tmp/.X*-lock
   rm -fr /tmp/.X11-unix
   mkdir -m 1777 /tmp/.X11-unix
 
 Eric
 
 -- 
 Eric van Gyzen                        Sr. Systems Programmer
 http://www.stat.duke.edu/~vangyzen/   ISDS, Duke University
 
Responsible-Changed-From-To: freebsd-bugs->mtm 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Tue Nov 11 06:55:24 PST 2003 
Responsible-Changed-Why:  
Mike, could you take a look at this please? 
It seems that some pre-rcNG functionality has not been preserved. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59065 
State-Changed-From-To: open->closed 
State-Changed-By: mtm 
State-Changed-When: Mon Dec 1 08:37:28 PST 2003 
State-Changed-Why:  
fix committed. 

Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59065 

From: Mike Makonnen <mtm@identd.net>
To: Ceri Davies <ceri@FreeBSD.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: conf/59065: /tmp/.X0-lock is not removed if clear_tmp_enable is not enabled
Date: Mon, 1 Dec 2003 15:20:47 +0300

 --tmoQ0UElFV5VgXgH
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Tue, Nov 11, 2003 at 06:55:56AM -0800, Ceri Davies wrote:
 > Synopsis: /tmp/.X0-lock is not removed if clear_tmp_enable is not enabled
 > 
 > Responsible-Changed-From-To: freebsd-bugs->mtm
 > Responsible-Changed-By: ceri
 > Responsible-Changed-When: Tue Nov 11 06:55:24 PST 2003
 > Responsible-Changed-Why: 
 > Mike, could you take a look at this please?
 > It seems that some pre-rcNG functionality has not been preserved.
 > 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=59065
 
 Ok, this indeed looks like a bug. I've sent the attached patch to
 re@ for approval.
 
 Cheers.
 -- 
 Mike Makonnen  | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
 mtm@identd.net | Fingerprint: 00E8 61BC 0D75 7FFB E4D3  6BF1 B239 D010 3215 D418
 mtm@FreeBSD.Org| FreeBSD - Unleash the Daemon !
 
 --tmoQ0UElFV5VgXgH
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="cleartmp.diff"
 
 Index: etc/rc.d/cleartmp
 ===================================================================
 RCS file: /home/ncvs/src/etc/rc.d/cleartmp,v
 retrieving revision 1.4
 diff -u -r1.4 cleartmp
 --- etc/rc.d/cleartmp	12 Oct 2002 10:31:31 -0000	1.4
 +++ etc/rc.d/cleartmp	1 Dec 2003 12:14:11 -0000
 @@ -27,20 +27,20 @@
  	(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
  	    find -x . ! -name . ! -name lost+found ! -name quota.user \
  		! -name quota.group -exec rm -rf -- {} \; -type d -prune)
 -
 -	case ${OSTYPE} in
 -	FreeBSD)
 -		# Remove X lock files, since they will prevent you from
 -		# restarting X
 -		#
 -		rm -f /tmp/.X*-lock
 -		rm -fr /tmp/.X11-unix
 -		mkdir -m 1777 /tmp/.X11-unix
 -		;;
 -	NetBSD)
 -		;;
 -	esac
  }
  
  load_rc_config $name
  run_rc_command "$1"
 +
 +case ${OSTYPE} in
 +FreeBSD)
 +	# Remove X lock files, since they will prevent you from
 +	# restarting X
 +	#
 +	rm -f /tmp/.X*-lock
 +	rm -fr /tmp/.X11-unix
 +	mkdir -m 1777 /tmp/.X11-unix
 +	;;
 +NetBSD)
 +	;;
 +esac
 
 --tmoQ0UElFV5VgXgH--
>Unformatted:
