Bug 90981 - "crontab -e" edition fails when /tmp is a symlink
Summary: "crontab -e" edition fails when /tmp is a symlink
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: vim   
(Show other bugs)
Version: 3.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2003-05-16 01:57 UTC by Marc MERLIN
Modified: 2007-11-30 22:06 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-10-19 19:36:10 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

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
) = 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

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 

Hope this is helpful,

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 Product and 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:
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.

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