FS#76826 - [etckeeper][pacman] Hooks don't trigger on files changed by post install scripts

Attached to Project: Community Packages
Opened by Arvid Norlander (VorpalGun) - Wednesday, 14 December 2022, 13:52 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:05 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Christian Hesse (eworm)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

etckeeper has a hook of the type:
Type = Path
Target = etc/*

(see /usr/share/libalpm/hooks/zz-etckeeper-post-install.hook)

This runs etckeeper when anything in /etc was changed by a package.
However, when etc is only changed by a post install script (for example: archlinux-keyring does this), etckeeper is not triggered to run.

I'm not sure if it is a bug in pacman or in etckeeper's hook. Is it even fixable?

The goal is that etckeeper commits any changes in /etc before and after a pacman operation. If the hook on etc/* is not reliable, how
should this be done properly?

Additional info:
* package version(s): pacman-6.0.2-5, etckeeper-1.18.18-1
* link to upstream bug report, if any: None yet, as I don't know if it is a pacman or etckeeper bug. Once that is figured out I will report to the appropriate upstream.

Steps to reproduce:
* Install etckeeper: pacman -S etckeeper git
* Set up etckeeper (cd /etc; etckeeper init; etckeeper commit "Initial import")
* Install/upgrade a package that doesn't touch /etc directly, but does change things in /etc in it's post install script (such as an upgrade of archlinux-keyring)

Observe that etckeeper was not triggered and did not commit the changes in /etc.
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:05 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/etckeeper/issues/1
Comment by Christian Hesse (eworm) - Wednesday, 14 December 2022, 14:09 GMT
That behavior is caused by etckeeper as that ships the alpm hook. Currently it has:

Type = Path
Target = etc/*

Changing this to something like...

Type = Package
Target = *

... would bring the behavior you expect.

Perhaps it could even be considered the rename the existing and adding a new hook. A hook 05-etckeeper-post-install.hook could cache all changes caused by package updates, zz-etckeeper-post-install.hook with the changes mentioned above could catch everything changed by other hooks.

I've considered to send these changes upstream myself earlier, but did not yet. Do you want to give it a try?
Comment by Arvid Norlander (VorpalGun) - Wednesday, 14 December 2022, 14:28 GMT
Running a quick test, suggests that "etckeeper post-install" (which is what the hook runs) is very cheap, especially when there is nothing to do. Changing the pre- and post-install hooks to always trigger is the easiest solution, and it doesn't seem to be an overly expensive one.

I'll open an upstream "bug" about this.
Comment by Arvid Norlander (VorpalGun) - Wednesday, 14 December 2022, 14:35 GMT Comment by Arvid Norlander (VorpalGun) - Monday, 19 December 2022, 11:44 GMT
> I've considered to send these changes upstream myself earlier, but did not yet. Do you want to give it a try?

I'm trying this now, I did a quick & dirty modification in place as you suggested.
Comment by Arvid Norlander (VorpalGun) - Tuesday, 20 December 2022, 10:19 GMT
@Christian Hesse (eworm) archlinux-keyring updated today, and this change worked flawlessly.

Did you have some patch floating around for this that you wanted to submit upstream? Or should I do that? I don't want to steal your credit.

Loading...