Bug #436

Cron removes crontab after editting

Added by Luke Stuart about 4 years ago. Updated over 3 years ago.

Status:ClosedStart date:09/27/2010
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:-
Affected versions:

Description

After editting /etc/crontab/root with crontab -e, the crontab for root is deleted. This appears to take place when any of the default periodic jobs are executed. It does not appear to happen if the crontab never editted.

Test: I added a line to the root crontab to execute a script every 10 minutes. The script simply writes a line to stdout.
The line I added to crontab looks like this: */10 * * * * /root/crontest
I used the crontab -e command to edit the crontab. After writing away the change, a file called 'cron.update' appears in /etc/crontabs/, containing a single line: root

Cron executes my job without issues until the first of the default periodic jobs is executed. At this point it removes both the 'update.cron' file and the root crontab completely. A backup of the crontab is kept in /var/spool/cron/cron.root.***

The above example is not completely reliable for the reason that the removal of the crontab does not necessarily occur on the execution of the first subsequent periodic job, but definitely at some point thereafter.

As I mentioned, if the crontab is never editted, this doesnt happen.

Associated revisions

Revision 8ee00785
Added by Timo Teräs almost 4 years ago

main/busybox: fix disappearing crontabs bug

It's uninitialized memory use bug. The relevant parts are rewritten
in busybox-1.18.x and later, so this patch applies only to the
busybox-1.17.x versions. Fixes #436.

Revision 1677b385
Added by Timo Teräs almost 4 years ago

main/busybox: fix disappearing crontabs bug

It's uninitialized memory use bug. The relevant parts are rewritten
in busybox-1.18.x and later, so this patch applies only to the
busybox-1.17.x versions. Fixes #436.
(cherry picked from commit 8ee0078586a14008b9915450dbc719051ed7d3d0)

History

#1 Updated by Natanael Copa about 4 years ago

  • Project changed from Alpine build tools to Alpine Linux

#2 Updated by Leonardo Arena about 4 years ago

Same problem here

#4 Updated by Matt Smith about 4 years ago

Temporary work-around seems to be to edit the user's crontab directly, e.g.:
nano /etc/crontabs/root

#5 Updated by Jeff Bilyk almost 4 years ago

We just experienced the same issue when running on Alpine 2.1.3. busybox-1.17.3-r3

#6 Updated by Timo Teräs almost 4 years ago

This appears to be busybox-1.17.x bug. It looks like the relevant parts of the code are rewritten in busybox-1.18.x and later. I was able to reproduce this on bb-1.17.4, but not in busybox.git.

Ncopa, do we have plans to upgrade busybox to 1.18.x on alpine-2.1.x? Or should I patch bb-1.17 to fix this issue?

#7 Updated by Timo Teräs almost 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

#9 Updated by Natanael Copa over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF