Bug 90981

Summary: "crontab -e" edition fails when /tmp is a symlink
Product: Red Hat Enterprise Linux 3 Reporter: Marc MERLIN <marc_soft>
Component: vimAssignee: Karsten Hopp <karsten>
Status: CLOSED WONTFIX QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: chrisf, garry.optland, redhat, tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-10-19 19:36:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marc MERLIN 2003-05-16 01:57:40 UTC
I did
crontab -e

it popped up $EDITOR (vim), I added a line, saved, and crontab tells me
that I didn't make changes and exits

An strace shows
[WIFEXITED(s) && WEXITSTATUS(s) == 0], 0, NULL) = 16748
fstat64(6, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
write(2, "crontab: no changes made to cron"..., 36crontab: no changes made to
crontab
) = 36
unlink("/tmp/crontab.16747")            = 0
brk(0)                                  = 0x8052000
brk(0x8054000)                          = 0x8054000
time([1053049805])                      = 1053049805
getpid()                                = 16747
rt_sigaction(SIGPIPE, {0x420db0d0, [], SA_RESTORER, 0x420276f8}, {SIG_DFL}, 8) = 0
send(3, "<78>May 15 18:50:05 crontab[1674"..., 59, 0) = 59
rt_sigaction(SIGPIPE, {SIG_DFL}, NULL, 8) = 0
exit_group(0)

Comment 1 Garry Optland 2003-07-16 04:13:19 UTC
marc_soft, is your /tmp directory a symlink by any chance? I have just built two
RH9.0 servers, and on one the /tmp directory links to /var/tmp. It has the same
problem with editing a crontab. The other one without the link works fine.

Comment 2 Marc MERLIN 2003-07-16 04:41:13 UTC
Yes, we also found out that the problem is that /tmp is a symlink.

But the best part is that it works with EDITOR=emacs, but not EDITOR=vim

Comment 3 Marc MERLIN 2003-07-31 18:36:55 UTC
I found the fix:
I symlinked /tmp to /var/tmp/tmp, and I had to modify vimrc as such:
" for crontab -e to work
set backupskip=/tmp/*,/var/tmp/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*

This started breaking with vim 6 (it worked before)

While this isn't a bug, it's quite tough to spot. Maybe it should be in the
release notes or something.

Comment 4 Jens Petersen 2003-07-31 22:33:58 UTC
Re-assigning to vim.

Comment 5 Bastien Nocera 2004-05-25 09:32:45 UTC
Reassigning to RHEL 3, as the problem still happens on that version.

Comment 6 Chris Faulhaber 2004-10-05 15:29:45 UTC
I am also having this problem but after going to the source of 
crontab.c it appears that pixie crontab is working properly and it is 
a problem with vim. (I see it has been reassigned)

It appears that vim assigns a new I-node to the saved or new version 
of the crontab entry only if /tmp is a symlink. If /tmp is not a 
symlink then the I-node remains constant as the command crontab 
expects. 

Hope this is helpful,
Chris


Comment 7 Marc MERLIN 2004-10-05 15:45:16 UTC
If you read the comments, you'll see that I already gave the solution :)
set backupskip=/tmp/*,/var/tmp/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*
                      ^^^^^^^^^^^^^^^
whatever your symlink points to

It's just an issue of documenting this somewhere as it's a change that
can be non trivial to spot

Comment 9 Stephen Rasku 2005-08-18 19:39:35 UTC
I added the backupskip variable as described in comment 7.  The only difference
is I changed /var/tmp/tmp to /usr/tmp since that is what my /tmp directory is
symlinked to.  However it didn't fix the problem.  I still was unable to save
the crontab.

Comment 10 RHEL Program Management 2007-10-19 19:36:10 UTC
This bug is filed against RHEL 3, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products. Since
this bug does not meet that criteria, it is now being closed.
 
For more information of the RHEL errata support policy, please visit:
http://www.redhat.com/security/updates/errata/
 
If you feel this bug is indeed mission critical, please contact your
support representative. You may be asked to provide detailed
information on how this bug is affecting you.