Bug 89390 - problems with crontab and emacs if $TMP is set
Summary: problems with crontab and emacs if $TMP is set
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: emacs (Show other bugs)
(Show other bugs)
Version: 9
Hardware: All Linux
Target Milestone: ---
Assignee: Jens Petersen
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2003-04-22 19:24 UTC by pjohan
Modified: 2007-04-18 16:53 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-02-18 05:29:06 UTC
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 07:33 UTC, Jens Petersen
no flags Details

Description pjohan 2003-04-22 19:24:18 UTC
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-23 00:31:17 UTC
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 06:18:38 UTC
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 22:30:47 UTC
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 06:37:51 UTC
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 07:21:33 UTC
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 07:33:03 UTC
Created attachment 91271 [details]
Diff of straces with and without TMP set

Comment 7 Jens Petersen 2003-04-24 07:34:27 UTC
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 07:35:26 UTC
When just invoking emacs I mean.

Comment 9 pjohan 2003-04-24 08:16:41 UTC
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 08:22:42 UTC
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 05:47:05 UTC
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 05:29:06 UTC
Closing for now.

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