Bug 22612

Summary: crontab -e failures
Product: Base System Reporter: Don Read <dread>
Component: binAssignee: Diomidis Spinellis <dds>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Don Read 2000-11-05 05:00:01 UTC
crontab -e won't recognize a changed edit (Patch incl)
 ... if the editor exits in < 1 second.

See discussion in freebsd-questions Subject 'crontab -e' woes

In $SRC/usr.sbin/cron/crontab/crontab.c 
edit_cmd() (non-POSIX) has a stat.mtime resolution of 1 second,
so if the tmpfile is created, & the editor finishes within 
the same interval second, crontab decides the file is unchanged.

How-To-Repeat: 
EDITOR=ed
(echo '1s/^/#/'; echo 'wq') | crontab -e

/* may require multiple attempts */
Comment 1 Chris D.Faulhaber freebsd_committer freebsd_triage 2000-11-06 13:16:24 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

Misfiled PR
Comment 2 Jens Schweikhardt freebsd_committer freebsd_triage 2002-03-18 10:00:46 UTC
Responsible Changed
From-To: freebsd-bugs->schweikh

I'll take a look at this.
Comment 3 Jens Schweikhardt freebsd_committer freebsd_triage 2003-12-20 12:53:42 UTC
Responsible Changed
From-To: schweikh->freebsd-bugs

Back to the pool - I'm swamped. 
If anyone addresses this problem, it would be best to 
compute md5s of old and new crontabs instead of looking at modification times.
Comment 4 Diomidis Spinellis freebsd_committer freebsd_triage 2004-09-15 04:07:05 UTC
Responsible Changed
From-To: freebsd-bugs->dds

Was prompted to examine the problem by Ceri Davies after a related 
commit.
Comment 5 Diomidis Spinellis freebsd_committer freebsd_triage 2004-09-15 04:12:23 UTC
State Changed
From-To: open->feedback

Fixed in crontab.c 1.22
Comment 6 Diomidis Spinellis freebsd_committer freebsd_triage 2005-08-08 13:53:42 UTC
State Changed
From-To: feedback->closed

MFC changes to RELENG_5