Bug 89390 - problems with crontab and emacs if $TMP is set
problems with crontab and emacs if $TMP is set
Product: Red Hat Linux
Classification: Retired
Component: emacs (Show other bugs)
All Linux
medium Severity low
: ---
: ---
Assigned To: Jens Petersen
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2003-04-22 15:24 EDT by pjohan
Modified: 2007-04-18 12:53 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-02-18 00:29:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Diff of straces with and without TMP set (3.29 KB, text/plain)
2003-04-24 03:33 EDT, Jens Petersen
no flags Details

  None (edit)
Description pjohan 2003-04-22 15:24:18 EDT
Description of problem:

Crontab does not work properly if emacs is used as the editor and $TMP is set to 
an alternate location (not /tmp).

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

Red Hat 9 (not in 7.1 or 8.0)

How reproducible:

Steps to Reproduce:
1.set $EDITOR or $VISUAL to emacs (if VISUAL is set it will be used rather than
2.set TMP to alternate location where you have writepermission (other than /tmp)
3.run crontab and make som change in your crontab.

Actual results:

crontab: no changes made to crontab

Expected results:

crontab: installing new crontab

Additional info:

the temp-file is actually in /tmp even if you do set $TMP to another value.
emacs does not seem to exit with a strange return value (when I searched about
the problem I found this link
 but the proposed solution gives a correct returnvalue of 0)

Seems to be the same result if $TMP points to a legal directory (where you have
write permission) or not. I do not get this on my RH 7.1 box with emacs-20.7-34,
Comment 1 Jens Petersen 2003-04-22 20:31:17 EDT
Perusing the vixie-cron source doesn't suggest that it supports
using TMP at all.  ICBW but at first glance it looks hardcoded
to /tmp to me.

Do you get any different with "EDITOR=vi"?
Comment 2 pjohan 2003-04-23 02:18:38 EDT
With EDITOR=vi it works fine.

I only get the problem with emacs, not with vi or pico so it might be an error 
in emacs. But it seems like emacs does not terminate with an error code (when I 
made a test it returned a 0) so I don't know why cron doesn't think that the 
file has been changed. The file gets erased afterwards so vixie-cron apparently 
reads it but somehow it doesn't think it's updated. 

Were you able to reproduce following the three steps?
Comment 3 Jens Petersen 2003-04-23 18:30:47 EDT
Here's what I see with vi:

% ls -dl $HOME/tmp
drwx------   12 petersen petersen     4096  4月 17 09:10 /home/petersen/tmp
% EDITOR=vi TMP=$HOME/tmp crontab -e

"/tmp/crontab.10884" 1L, 30C

For you the temp file isn't in "/tmp"?
Comment 4 pjohan 2003-04-24 02:37:51 EDT
As i wrote under "additional information", the temp-file is actually in /tmp 
even if you do set $TMP to another value. But still it does not update 
properly. Have you tried with emacs? As far as I know it's only the emacs-
crontab-$TMP combination that doesn't work so testing with vi(or pico) will not 
give any problems
Comment 5 Jens Petersen 2003-04-24 03:21:33 EDT
Thanks for the clarification - I thought the complaint was that
TMP was being ignored.

Yep, reproduced.  Looks like you're right and it is related to
the exit status of emacs.
Comment 6 Jens Petersen 2003-04-24 03:33:03 EDT
Created attachment 91271 [details]
Diff of straces with and without TMP set
Comment 7 Jens Petersen 2003-04-24 03:34:27 EDT
I don't seem able to reproduce the non-zero exit code
though by invoking from the commandline though.
Comment 8 Jens Petersen 2003-04-24 03:35:26 EDT
When just invoking emacs I mean.
Comment 9 pjohan 2003-04-24 04:16:41 EDT
Ok, when I tried I got a normal exit code from emacs but maybe I missed 
something in how it's invoked from crontab.

Should it be declassified as an emacs bug?
Comment 10 Jens Petersen 2003-04-24 04:22:42 EDT
Not sure, it could be a vixie-cron bug, but I am the package
maintainer of that too, so we can just leave it here for now
I guess.

(xemacs seems to be ok with crontab too.)
Comment 11 Jens Petersen 2004-09-29 01:47:05 EDT
Hmm, I don't need able to reproduce this anymore with current
rawhide (FC3 test releases).

Could you try to test it with that?
Comment 12 Jens Petersen 2005-02-18 00:29:06 EST
Closing for now.

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