Re: daily(8) scratch and junk files removal
Hi Rafael, Rafael Zalamena wrote on Wed, Jul 02, 2014 at 02:21:25PM -0300: > I've made a quick test and there is no problem in 'tmux-*' existing in > /var/tmp after a reboot. Running 'tmux attach' in a socket with no tmux > process controlling just spits out: 'no sessions' and if you run 'tmux' > a new session starts with no problem. I don't know about 'ssh-*' though. > > With the diff I mailed we should be compatible with people who expect > /tmp to be a symbolic link for /var/tmp, but if we want to fix it for > good we should remove the other /var/tmp exceptions and warn users about > it. While i don't consider linking /tmp and /var/tmp to each other a particularly good idea and expect people will encounter occasional trouble doing so, i'd rather not add even more stuff to the list of things that might break, unless for a good reason. Right now, people having separate /tmp and /var/tmp are not hurt by the /var/tmp exceptions: They simply won't have such files in /var/tmp. So i'd rather leave all the exceptions in place. It is also easier to maintain one consistent list (even two copies of it) that two subtly different lists. So, no further code change required unless i'm missing something. As for warning people: Both /tmp and /var/tmp are directories contained in the default install. It goes without saying that you shouldn't fiddle with them unless you know what you are doing and want the pain. The list of bad ideas you could come up with is infinite. We don't warn people either that moving all files from /bin to /usr/bin and deleting /bin is a bad idea, even though that is likely to hurt even more. Assuming that we don't *recommend* linking the two together somewhere, i don't see a documentation change that might be helpful. Yours, Ingo
Re: daily(8) scratch and junk files removal
On Wed, Jul 02, 2014 at 08:49:34AM -0500, Shawn K. Quinn wrote: > On Tue, 2014-07-01 at 19:07 -0300, Rafael Zalamena wrote: > > I also noted that would only happen on one machine which I had setup > > one partition for /var/tmp and /tmp (and /tmp -> /var/tmp). After some > > investigation I found out that the code that daily(8) uses to clean > > /var/tmp is different from /tmp. > > Putting /var/tmp and /tmp together is a really bad idea. /var/tmp is > supposed to survive a reboot, /tmp isn't. > > -- > Shawn K. Quinn > Thank you for reminding that, I got my setup wrong and I should have done my homework first. It seems that people from a while back also got that wrong: the first appearence of the 'ssh-*' was back in 2000: etc/daily 1.31: Prune /tmp traversal at .X11-unix Since /tmp might be a link to /var/tmp, prune at ssh-* or .X11-unix like the find on /tmp does. I've made a quick test and there is no problem in 'tmux-*' existing in /var/tmp after a reboot. Running 'tmux attach' in a socket with no tmux process controlling just spits out: 'no sessions' and if you run 'tmux' a new session starts with no problem. I don't know about 'ssh-*' though. With the diff I mailed we should be compatible with people who expect /tmp to be a symbolic link for /var/tmp, but if we want to fix it for good we should remove the other /var/tmp exceptions and warn users about it.
Re: daily(8) scratch and junk files removal
On Tue, 2014-07-01 at 19:07 -0300, Rafael Zalamena wrote: > I also noted that would only happen on one machine which I had setup > one partition for /var/tmp and /tmp (and /tmp -> /var/tmp). After some > investigation I found out that the code that daily(8) uses to clean > /var/tmp is different from /tmp. Putting /var/tmp and /tmp together is a really bad idea. /var/tmp is supposed to survive a reboot, /tmp isn't. -- Shawn K. Quinn
Re: daily(8) scratch and junk files removal
Hi Stuart, Stuart Henderson wrote on Wed, Jul 02, 2014 at 01:36:21PM +0100: > I think this is correct. Any nay-sayers? ok schwarze@ > On 2014/07/01 19:07, Rafael Zalamena wrote: > > I noticed a problem in one of my OpenBSD installation where tmux(1) > > would lose its session socket after a few inactive days. Every time > > that happened I quickly fixed it by sending a SIGUSR1 (as suggested by > > the man page) to restore the socket session. > > > > I also noted that would only happen on one machine which I had setup > > one partition for /var/tmp and /tmp (and /tmp -> /var/tmp). After some > > investigation I found out that the code that daily(8) uses to clean > > /var/tmp is different from /tmp. > > > > /tmp: > > Test if /tmp exists and it's not a symlink > > Clean all files unaccessed in 3 days except: ssh-*, > > X11-unix, ICE-unix and portslocks > > Clean all directories unmodified in 3 days except: ssh-*, > > vi.recover, X11-unix, ICE-unix and portslocks > > > > /var/tmp: > > This one has similar rules as /tmp, but instead of cleaning all > > unaccessed files, it says: clean all not directories. > > > > The following diff fixes the issue by ignoring folders belonging to > > tmux(1) sessions. Another solution would be changing the find(1) type > > flag to only remove files (and not 'not directories' which include > > special files like sockets, pipe, devices etc...), but I found the > > first one less intrusive and more correct. > > > > > > Index: etc/daily > > === > > RCS file: /cvs/src/etc/daily,v > > retrieving revision 1.80 > > diff -u -p -r1.80 daily > > --- etc/daily 24 Apr 2014 19:04:54 - 1.80 > > +++ etc/daily 1 Jul 2014 00:49:54 - > > @@ -49,7 +49,7 @@ if [ -d /tmp -a ! -L /tmp ]; then > > cd /tmp && { > > find -x . \ > > \( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \ > > - -o -path ./portslocks \) \ > > + -o -path ./portslocks -o -path './tmux-*' \) \ > > -prune -o -type f -atime +3 -execdir rm -f -- {} \; 2>/dev/null > > find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \ > > ! -path ./.ICE-unix ! -path ./portslocks ! -name . \ > > @@ -60,7 +60,7 @@ if [ -d /var/tmp -a ! -L /var/tmp ]; the > > cd /var/tmp && { > > find -x . \ > > \( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \ > > - -o -path ./portslocks \) \ > > + -o -path ./portslocks -o -path './tmux-*' \) \ > > -prune -o ! -type d -atime +7 -execdir rm -f -- {} \; 2>/dev/null > > find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \ > > ! -path ./.ICE-unix ! -path ./portslocks ! -name . \ > >
Re: daily(8) scratch and junk files removal
I think this is correct. Any nay-sayers? On 2014/07/01 19:07, Rafael Zalamena wrote: > I noticed a problem in one of my OpenBSD installation where tmux(1) > would lose its session socket after a few inactive days. Every time > that happened I quickly fixed it by sending a SIGUSR1 (as suggested by > the man page) to restore the socket session. > > I also noted that would only happen on one machine which I had setup > one partition for /var/tmp and /tmp (and /tmp -> /var/tmp). After some > investigation I found out that the code that daily(8) uses to clean > /var/tmp is different from /tmp. > > /tmp: > Test if /tmp exists and it's not a symlink > Clean all files unaccessed in 3 days except: ssh-*, > X11-unix, ICE-unix and portslocks > Clean all directories unmodified in 3 days except: ssh-*, > vi.recover, X11-unix, ICE-unix and portslocks > > /var/tmp: > This one has similar rules as /tmp, but instead of cleaning all > unaccessed files, it says: clean all not directories. > > The following diff fixes the issue by ignoring folders belonging to > tmux(1) sessions. Another solution would be changing the find(1) type > flag to only remove files (and not 'not directories' which include > special files like sockets, pipe, devices etc...), but I found the > first one less intrusive and more correct. > > > Index: etc/daily > === > RCS file: /cvs/src/etc/daily,v > retrieving revision 1.80 > diff -u -p -r1.80 daily > --- etc/daily 24 Apr 2014 19:04:54 - 1.80 > +++ etc/daily 1 Jul 2014 00:49:54 - > @@ -49,7 +49,7 @@ if [ -d /tmp -a ! -L /tmp ]; then > cd /tmp && { > find -x . \ > \( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \ > - -o -path ./portslocks \) \ > + -o -path ./portslocks -o -path './tmux-*' \) \ > -prune -o -type f -atime +3 -execdir rm -f -- {} \; 2>/dev/null > find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \ > ! -path ./.ICE-unix ! -path ./portslocks ! -name . \ > @@ -60,7 +60,7 @@ if [ -d /var/tmp -a ! -L /var/tmp ]; the > cd /var/tmp && { > find -x . \ > \( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \ > - -o -path ./portslocks \) \ > + -o -path ./portslocks -o -path './tmux-*' \) \ > -prune -o ! -type d -atime +7 -execdir rm -f -- {} \; 2>/dev/null > find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \ > ! -path ./.ICE-unix ! -path ./portslocks ! -name . \ >
daily(8) scratch and junk files removal
I noticed a problem in one of my OpenBSD installation where tmux(1) would lose its session socket after a few inactive days. Every time that happened I quickly fixed it by sending a SIGUSR1 (as suggested by the man page) to restore the socket session. I also noted that would only happen on one machine which I had setup one partition for /var/tmp and /tmp (and /tmp -> /var/tmp). After some investigation I found out that the code that daily(8) uses to clean /var/tmp is different from /tmp. /tmp: Test if /tmp exists and it's not a symlink Clean all files unaccessed in 3 days except: ssh-*, X11-unix, ICE-unix and portslocks Clean all directories unmodified in 3 days except: ssh-*, vi.recover, X11-unix, ICE-unix and portslocks /var/tmp: This one has similar rules as /tmp, but instead of cleaning all unaccessed files, it says: clean all not directories. The following diff fixes the issue by ignoring folders belonging to tmux(1) sessions. Another solution would be changing the find(1) type flag to only remove files (and not 'not directories' which include special files like sockets, pipe, devices etc...), but I found the first one less intrusive and more correct. Index: etc/daily === RCS file: /cvs/src/etc/daily,v retrieving revision 1.80 diff -u -p -r1.80 daily --- etc/daily 24 Apr 2014 19:04:54 - 1.80 +++ etc/daily 1 Jul 2014 00:49:54 - @@ -49,7 +49,7 @@ if [ -d /tmp -a ! -L /tmp ]; then cd /tmp && { find -x . \ \( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \ - -o -path ./portslocks \) \ + -o -path ./portslocks -o -path './tmux-*' \) \ -prune -o -type f -atime +3 -execdir rm -f -- {} \; 2>/dev/null find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \ ! -path ./.ICE-unix ! -path ./portslocks ! -name . \ @@ -60,7 +60,7 @@ if [ -d /var/tmp -a ! -L /var/tmp ]; the cd /var/tmp && { find -x . \ \( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \ - -o -path ./portslocks \) \ + -o -path ./portslocks -o -path './tmux-*' \) \ -prune -o ! -type d -atime +7 -execdir rm -f -- {} \; 2>/dev/null find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \ ! -path ./.ICE-unix ! -path ./portslocks ! -name . \