Bug 129170 - crontab -e fails with editors which create a new copy of the file
crontab -e fails with editors which create a new copy of the file
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: crontabs (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Vas Dias
Brock Organ
:
Depends On:
Blocks: 170445
  Show dependency treegraph
 
Reported: 2004-08-04 14:20 EDT by Kurtis D. Rader
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: vixie-cron-4.1-8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-08-10 11:04:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Kurtis D. Rader 2004-08-04 14:20:43 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Gecko/20040615 Firefox/0.9

Description of problem:
Certain editors save a file by creating a new file then renaming it.
For example, gedit(1) uses a sequence of operations like this:

    open("/tmp/.gedit-save-6tmgT2",
        O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 20
    umask(022)                              = 077
    write(20, "X=y\nHOME=/home/krader\nPATH=/home"..., 211) = 211
    close(20)                               = 0
    rename("/tmp/crontab.14578", "/tmp/crontab.14578~") = 0
    rename("/tmp/.gedit-save-6tmgT2", "/tmp/crontab.14578") = 0

But crontab(1) keeps a file descriptor open on the original temporary
crontab file and uses fstat64(2) to see if it has changed:

    fstat64(5, {st_mode=S_IFREG|0600, st_size=207, ...}) = 0
    write(2, "crontab: no changes made to cron"..., 36) = 36

Since the original crontab temporary file hasn't changed crontab(1) is
technically correct that no changes were made.

What gedit(1) is doing is perfectly valid. The fault lies with
crontab(1) in my opinion. 


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. export VISUAL=gedit
2. crontab -e
3. Change the crontab, save it, and exit the editor
    

Actual Results:  The changes are not installed and the following is
displayed:

    crontab: no changes made to crontab


Expected Results:  The changes are installed as the new crontab
definition.

Additional info:

This has apparently been reported numerous times. For example,
bugzilla #25992 and bugzilla #89899.
Comment 1 Jason Vas Dias 2004-08-10 11:04:17 EDT
Fixed in vixie-cron-4.1-8 .
Comment 2 Jason Vas Dias 2005-10-14 11:48:08 EDT
This bug is fixed with vixie-cron-4.1-8_EL3, available from:
  http://people.redhat.com/~jvdias/cron/RHEL-3
and should be considered for inclusion in RHEL-3-U7 .

Note You need to log in before you can comment on or make changes to this bug.