Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 825026 - sys-process/cronie-1.5.7 runs /etc/cron.hourly even with USE=-anacron
Summary: sys-process/cronie-1.5.7 runs /etc/cron.hourly even with USE=-anacron
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-19 16:51 UTC by Thomas Lindroth
Modified: 2022-09-24 21:20 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Lindroth 2021-11-19 16:51:34 UTC
Cronie conditionally installs several files for handling the running of /etc/cron.{daily,hourly,weekly,monthly} jobs. Here they are:
                            +anacron  -anacron (USE flag)
/etc/cron.d/0hourly         X         X
/etc/cron.d/dailyjobs                 X
/etc/cron.hourly/0anacron   X
/etc/anacrontab             X

The main file is /etc/anacrontab which handles the running of daily,weekly,monthly. I does not handle the running of hourly jobs because anacron doesn't have that functionality. Instead the /etc/cron.d/0hourly file is installed just to run /etc/cron.hourly jobs.

/etc/cron.d/0hourly is installed unconditionally even if USE=-anacron. This surprised me since I assumed cronie wouldn't run any /etc/cron.{daily,hourly,weekly,monthly} jobs without the anacron useflag. Could the 0hourly file be installed conditionally on the anacron flag?


The file /etc/cron.d/dailyjobs looks like this:
...
02 4 * * * root [ ! -f /etc/cron.hourly/0anacron ] && run-parts /etc/cron.daily
22 4 * * 0 root [ ! -f /etc/cron.hourly/0anacron ] && run-parts /etc/cron.weekly
42 4 1 * * root [ ! -f /etc/cron.hourly/0anacron ] && run-parts /etc/cron.monthly

The jobs listed there are already handled by /etc/anacrontab and they only run if the file /etc/cron.hourly/0anacron exist. /etc/cron.hourly/0anacron is only installed when USE=+anacron but /etc/cron.d/dailyjobs is only installed when USE=-anacron. This seems meaningless.

I propose stop installing any of the /etc/cron.d/* files with USE=-anacron. If you do so you can probably make the sys-apps/debianutils dependency depend on +anacron as well since it's only used to provide "run-parts" for the /etc/cron.d/0hourly file.
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2022-03-22 18:02:46 UTC
(In reply to Thomas Lindroth from comment #0)
> 
> /etc/cron.d/0hourly is installed unconditionally even if USE=-anacron. This
> surprised me since I assumed cronie wouldn't run any
> /etc/cron.{daily,hourly,weekly,monthly} jobs without the anacron useflag.
> Could the 0hourly file be installed conditionally on the anacron flag?

True. I have moved installation of /etc/cron.d/0hourly to the USE="anacron" block.

> The file /etc/cron.d/dailyjobs looks like this:
> ...
> 02 4 * * * root [ ! -f /etc/cron.hourly/0anacron ] && run-parts
> /etc/cron.daily
> 22 4 * * 0 root [ ! -f /etc/cron.hourly/0anacron ] && run-parts
> /etc/cron.weekly
> 42 4 1 * * root [ ! -f /etc/cron.hourly/0anacron ] && run-parts
> /etc/cron.monthly
> 
> The jobs listed there are already handled by /etc/anacrontab and they only
> run if the file /etc/cron.hourly/0anacron exist.

Wrong, it gets executed, when 
/etc/cron.hourly/0anacron does _not_ exist.


> /etc/cron.hourly/0anacron
> is only installed when USE=+anacron but /etc/cron.d/dailyjobs is only
> installed when USE=-anacron. This seems meaningless.

Yes, so the file can get installed unconditionally.
 
> I propose stop installing any of the /etc/cron.d/* files with USE=-anacron.
> If you do so you can probably make the sys-apps/debianutils dependency
> depend on +anacron as well since it's only used to provide "run-parts" for
> the /etc/cron.d/0hourly file.

Not going to happen because /etc/cron.d/dailyjobs is meant to be run when anacron is not available.
Comment 2 Larry the Git Cow gentoo-dev 2022-03-22 18:13:54 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e064a543ab94d8c2378fe1368292e78f6f6af0f2

commit e064a543ab94d8c2378fe1368292e78f6f6af0f2
Author:     Lars Wendler <polynomial-c@gentoo.org>
AuthorDate: 2022-03-22 18:11:51 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2022-03-22 18:13:45 +0000

    sys-process/cronie: Bump to version 1.6.0
    
    Do some more anacron adjustments. Hopefully all is set now for anacron.
    Use /run instead of /var/run for pidfile.
    
    Bug: https://bugs.gentoo.org/825026
    Closes: https://bugs.gentoo.org/685306
    Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>

 sys-process/cronie/Manifest               |   1 +
 sys-process/cronie/cronie-1.6.0.ebuild    | 116 ++++++++++++++++++++++++++++++
 sys-process/cronie/files/cronie-1.3-initd |   2 +-
 3 files changed, 118 insertions(+), 1 deletion(-)
Comment 3 Larry the Git Cow gentoo-dev 2022-09-24 21:20:11 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=148d949d279f94cfade0bd994b1312aa584e92be

commit 148d949d279f94cfade0bd994b1312aa584e92be
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2022-09-24 21:18:39 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2022-09-24 21:18:39 +0000

    sys-process/cronie: install /etc/cron.d/0hourly unconditionally
    
    Closes: https://bugs.gentoo.org/872656
    Closes: https://bugs.gentoo.org/825026
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-process/cronie/cronie-1.6.1-r2.ebuild | 116 ++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)