Bug 18461

Summary: vi.recover misplaced in /var/tmp
Product: Base System Reporter: clefevre <clefevre>
Component: confAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description clefevre 2000-05-09 07:40:00 UTC
	vi.recover should not be in /var/tmp. imagine the case
	where /var/tmp is a memory filesystem. upon reboot,
	everything is lost.

Fix: first, sets a variable $vi_recover to "/var/tmp/vi.recover"
	in /etc/defaults/rc.conf. in /etc/rc, if that variable in
	not to its default value, update /etc/vi.exrc in consequence.
	in all case, use it to determine where are files to recover.
How-To-Repeat: 
	make /var/tmp a memory filesystem in /etc/fstab as :

		swap /var/tmp mfs rw,async,-s65535 0 0

	edit files, left them open, then reboot.
	nothing can be recovered. there all lost.
Comment 1 Gregory Bond 2000-05-09 08:36:14 UTC
> 	vi.recover should not be in /var/tmp. imagine the case
> 	where /var/tmp is a memory filesystem. upon reboot,
> 	everything is lost.

On the contrary, /var/tmp is exactly the right spot for vi.recover, because 
/var/tmp is -explicitly documented- to remain over reboots.  See "man hier".

Anyone who uses mfs for /var/tmp is just plain wrong.
Comment 2 Jeroen Ruigrok/Asmodai 2000-05-13 13:07:23 UTC
-On [20000509 12:01], Gregory Bond (gnb@itga.com.au) wrote:
>
>From: Gregory Bond <gnb@itga.com.au>
>
> > 	vi.recover should not be in /var/tmp. imagine the case
> > 	where /var/tmp is a memory filesystem. upon reboot,
> > 	everything is lost.
> 
> On the contrary, /var/tmp is exactly the right spot for vi.recover, because 
> /var/tmp is -explicitly documented- to remain over reboots.  See "man hier".
> 
> Anyone who uses mfs for /var/tmp is just plain wrong.

I agree with the above sentiment, from hier(7):

     /tmp/    temporary files, usually a mfs(8) memory-based filesystem (the
              contents of /tmp are usually NOT preserved across a system re-
              boot)

     /var/    multi-purpose log, temporary, transient, and spool files
              tmp/       temporary files that are kept between system reboots
                         vi.recover/
                                     the directory where recovery files are
                                     stored

This is also why there is a clear_tmp_enable directive in the rc.conf.

-- 
Jeroen Ruigrok vd Werven/Asmodai    asmodai@[wxs.nl|bart.nl|freebsd.org]
Documentation nutter/C-rated Coder BSD: Technical excellence at its best  
The BSD Programmer's Documentation Project <http://home.wxs.nl/~asmodai>
And every word upon your spiralling cross is but a misled sun, a bitter
 loss...
Comment 3 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2000-05-13 13:17:12 UTC
State Changed
From-To: open->closed

/var/tmp is supposed to be preserved over reboots.  it is /tmp 
that is commonly mounted on MFS systems.  See mail from me 
on this subject.