Bug 253567

Summary: sysutils/anacron: does not start after resume
Product: Ports & Packages Reporter: Walter von Entferndt <walter.von.entferndt>
Component: Individual Port(s)Assignee: Fernando Apesteguía <fernape>
Status: Closed FIXED    
Severity: Affects Some People CC: dz, fernape, walter.von.entferndt
Priority: --- Keywords: patch
Version: LatestFlags: bugzilla: maintainer-feedback? (dz)
fernape: maintainer-feedback? (dz)
walter.von.entferndt: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
call anacron after resume. Needs portvars.diff or obvious minor changes.
walter.von.entferndt: maintainer-approval? (walter.von.entferndt)
Use PORTNAME & COMMENT to easily copy & paste files between ports.
walter.von.entferndt: maintainer-approval? (walter.von.entferndt)
Fixes compiler warnings in the source *.c files.
walter.von.entferndt: maintainer-approval? (walter.von.entferndt)
Patch to make pkg-plist variables work better
dz: maintainer-approval+
All patches combined none

Description Walter von Entferndt 2021-02-16 19:15:25 UTC
Created attachment 222499 [details]
call anacron after resume.  Needs portvars.diff or obvious minor changes.

The anacron utility should be run by it's rc(8) script after resume, since the time to run jobs from the anacrontab(5) might have passed while the system was sleeping.

NOTE: the patch I provide needs the SUB_LIST in the Makefile from the 2nd patch portvars.diff.  Obviously the latter is only reasonable if one wants to copy & paste the patched files between ports; OTOH, it adds a little bit complexity.  If you don't like that, please ommit that patch and adjust the other patch anacron.in.diff.

Thx for your work as maintainer.
Comment 1 Walter von Entferndt 2021-02-16 19:18:46 UTC
Created attachment 222500 [details]
Use PORTNAME & COMMENT to easily copy & paste files between ports.

see NOTES above.
Comment 2 Walter von Entferndt 2021-02-16 19:23:28 UTC
Created attachment 222501 [details]
Fixes compiler warnings in the source *.c files.
Comment 3 Fernando Apesteguía freebsd_committer 2021-02-18 08:06:24 UTC
^Triage: Submitter is not maintainer, can not set maintainer-feedback to '+'
Comment 4 Derik van Zuetphen 2021-02-18 16:22:04 UTC
Created attachment 222554 [details]
Patch to make pkg-plist variables work better
Comment 5 Derik van Zuetphen 2021-02-18 16:24:58 UTC
Hello,

I approve the patches. 

Thanks Walter, for tidying-up the port.

But I think the pkg-plist handling is not complete according to https://docs.freebsd.org/en/books/porters-handbook/#plist

I have added a pkg-plist.diff to fix this. Apply on top of the other patches.

Please have a look if everything is ok (worked for me :-) )

Thanks

-Derik.
Comment 6 Walter von Entferndt 2021-02-18 23:14:13 UTC
(In reply to Derik van Zuetphen from comment #5)
OK, it runs all through w/o errors.  I'm wondering what happens with all those *.orig and empty files.  But since the ports are built in poudriere, I guess they do not hurt and/or you'll take care of that.

Test: Now I suspend... and back again :)
Feb 19 00:09:16 t450s root[48107]: /etc/rc.resume: INFO: starting anacron after resume
Feb 19 00:09:16 t450s anacron[49721]: Anacron 2.3 started on 2021-02-19
Feb 19 00:09:16 t450s anacron[49721]: Will run job `ntpdate' in 1 min.
Feb 19 00:09:16 t450s anacron[49721]: Will run job `periodic-daily' in 5 min.
Feb 19 00:09:16 t450s anacron[49721]: Jobs will be executed sequentially
Comment 7 Walter von Entferndt 2021-03-03 17:42:48 UTC
I can't see the fix in the updates of the /latest/ ports branch (I have both latest & quarterly).  What can I do to help get that done?  Was it that I changed the state to "fixed/CLOSED" is preventing an update?  Then it's a bug in this web interface: it should not allow me to set such flags when I'm not supposed to do that.  Maybe it's just that the maintainer is busy with other stuff, and we'll see an update in a week or two, that's fine with me.

Should I file in a bug report on that a bug reporter should not be allowed to set "maintainer approval"?  Now the description was updated to be more precise?  Seems I misunderstood this. "Set (?) to request MAINTAINER approval"  Since the maintainer's e-mail is known to the system, I found it logical the system asks for my e-mail address here (although that's known, too). My english is not overly bad (english = ancient gaelic? + ancient german with latin grammatics, loosely speaking), so this must have been much more misleading for others whose native tongue is further away from english.
Comment 8 Fernando Apesteguía freebsd_committer 2021-03-04 12:32:51 UTC
(In reply to Walter von Entferndt from comment #7)

Yes, probably. A committer might have passed by and omit this PR since it was already closed. Let's change it to Open and see if someone picks it up.
Comment 9 Derik van Zuetphen 2021-03-04 15:17:39 UTC
I (maintainer) can add a patch with all changes incorporated, if that helps.

Just tell me.

-Derik.
Comment 10 Fernando Apesteguía freebsd_committer 2021-03-04 15:20:29 UTC
(In reply to Derik van Zuetphen from comment #9)
That would probably help: adding a new patch with everything and obsoleting the old ones.

I would commit this myself, but I don't have any means to test this. Another committer might be more suitable.
Comment 11 Walter von Entferndt 2021-03-05 02:31:45 UTC
(In reply to Fernando Apesteguía from comment #10)
I would have provided a clean up (combination) of the patches, but I don't have all the ports maintainer's tools installed, only the std ones like diff & patch.  I saw that e.g. Derik was using a special git-diff or such, IIRC.  Thus I thought I leave it as is & the maintainer takes care of the rest.  Learning all the time: next topic -> TODO list: install ports-maintainers tools to provide better patches in bug reports.

On testing: I can affirm that the combined patches build a working executable & service script that starts anacron @resume.  It runs fine on my machine 12.1-REL now 12.2-REL since Feb. 18th, 2021.  Have to reboot much less than before, fine.
Comment 12 Derik van Zuetphen 2021-03-05 12:12:28 UTC
Created attachment 223000 [details]
All patches combined

Hello,

I have made a combined path of all patches mentioned above.

Please Committer take over :-)

Thank you
-Derik.
Comment 13 Derik van Zuetphen 2021-03-15 07:34:23 UTC
Can a committer have a look at the patches and commit them ....

Thanks
Comment 14 Walter von Entferndt 2021-03-29 18:20:18 UTC
ping

What can I do to help to get this fix commited?  I can only tell it works for me... and the port's maintainer is satisfied, too.  What else is missing?
Comment 15 Fernando Apesteguía freebsd_committer 2021-03-30 14:26:17 UTC
(In reply to Walter von Entferndt from comment #14)
OK, I'll take it. What is it closed Walter?
Comment 16 Walter von Entferndt 2021-03-31 00:12:23 UTC
(In reply to Fernando Apesteguía from comment #15)
I closed it because I felt the need to do SOMETHING...  dunno what that does in the workflow.  All what was written is true & not hoax, was tested on FreeBSD 12.2-RELEASE-p5 (now) & I'd be gratefull if this fix eventually gets committed :)
Comment 17 Fernando Apesteguía freebsd_committer 2021-03-31 05:37:51 UTC
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: @dir /var/spool/%%PORTNAME%%

This part was missing from pkg-plist. No need to upload a new patch. I will commit this from git. The ports collection is now frozen due to the svn->git transition.

Thanks!
Comment 18 commit-hook freebsd_committer 2021-04-07 11:23:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1a76a776c71cf0cf74e8e66586cc64cc6896b558

commit 1a76a776c71cf0cf74e8e66586cc64cc6896b558
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2021-04-07 11:16:00 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2021-04-07 11:20:03 +0000

    sysutils/anacron: Fix start after resume

    The anacron utility should be run by it's rc(8) script after resume, since the
    time to run jobs from the anacrontab(5) might have passed while the system was
    sleeping.

    PR:     253567
    Reported by:    walter.von.entferndt@posteo.net
    Approved by:    dz@426.ch (maintainer)

 sysutils/anacron/Makefile                 | 20 +++++++++++---------
 sysutils/anacron/files/anacron.in         | 31 +++++++++++++++++++++++--------
 sysutils/anacron/files/patch-log.c (new)  | 10 ++++++++++
 sysutils/anacron/files/patch-main.c (new) | 10 ++++++++++
 sysutils/anacron/files/patch-matchrx.c    |  6 +++++-
 sysutils/anacron/files/patch-runjob.c     | 13 +++++++++++--
 sysutils/anacron/files/pkg-message.in     | 15 ++++++++++-----
 sysutils/anacron/pkg-plist                | 12 +++++++-----
 8 files changed, 87 insertions(+), 30 deletions(-)
Comment 19 Fernando Apesteguía freebsd_committer 2021-04-07 11:24:26 UTC
Committed,

Thank you both for your patience!