Bug 1301677

Summary: File triggers lacking package count argument
Product: [Fedora] Fedora Reporter: Remi Collet <fedora>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jorton, jzeleny, novyjindrich, packaging-team-maint, pknirsch, pmatilai, riehecky, ville.skytta, vondruch
Target Milestone: ---Keywords: FutureFeature, Tracking
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-06-22 11:49:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Remi Collet 2016-01-25 16:31:48 UTC
I'm working on using file triggers for pecl extension (un)registration (in php-pear package)

http://pkgs.fedoraproject.org/cgit/rpms/php-pear.git/commit/?h=private-drop-pecl-dep&id=43a3dfa944725625b5c8b12760713fc55def99f7

It seems to work as expected, but a small question.

During php-pear update, both triggers are run, so all extensions are unregistered (filetriggerun)  and then registered again (transfiletriggerin)

I understand this can be very complex, as the same transaction can remove some pecl extension, update pear, add some other pecl extension.

Can you confirm ? or give explanation on how to improved ?


Shouldn' filetriggerun be run for file
- being removed (removal or update of the package owning the file)
- in rpmdb if final removal of the package containg the trigger

And transfiletriggerin be run for file
- being added (install or update of the package owning the file)
- in rpmdb if initial install of the package containg the trigger

But I could understand this can be very complex, especially if the trigger code change...

Comment 1 Ľuboš Kardoš 2016-01-26 09:41:25 UTC
(In reply to Remi Collet from comment #0)
> I'm working on using file triggers for pecl extension (un)registration (in
> php-pear package)
> 
> http://pkgs.fedoraproject.org/cgit/rpms/php-pear.git/commit/?h=private-drop-
> pecl-dep&id=43a3dfa944725625b5c8b12760713fc55def99f7
> 
> It seems to work as expected, but a small question.
> 
> During php-pear update, both triggers are run, so all extensions are
> unregistered (filetriggerun)  and then registered again (transfiletriggerin)
> 
> I understand this can be very complex, as the same transaction can remove
> some pecl extension, update pear, add some other pecl extension.
> 
> Can you confirm ? or give explanation on how to improved ?
> 
> 
> Shouldn' filetriggerun be run for file
> - being removed (removal or update of the package owning the file)
> - in rpmdb if final removal of the package containg the trigger
It is also called when a package containing the trigger is updated because upgrade consists of installation and uninstallation. This can be useful when the storage (database) for registration of extension will change. Then you need to remove all extension registration from old storage and store them into new one.

Nevertheless we can add an argument for trigger script. From this argument it will be possible to find out if the final removal of the package containing the trigger or just an update is in progress. So we will leave decision if trigger script should be executed during updates of package containing trigger on package maintainers   

> 
> And transfiletriggerin be run for file
> - being added (install or update of the package owning the file)
> - in rpmdb if initial install of the package containg the trigger
This is the same.

> 
> But I could understand this can be very complex, especially if the trigger
> code change...

Comment 2 Remi Collet 2016-01-26 09:54:24 UTC
Thanks for the clarification (it was also my thinking (last line of my comment)

The new arg idea seems interesting...

Comment 3 Jan Kurik 2016-02-24 14:20:35 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 4 Ville Skyttä 2016-08-12 18:43:54 UTC
(In reply to Ľuboš Kardoš from comment #1)
> Nevertheless we can add an argument for trigger script. From this argument
> it will be possible to find out if the final removal of the package
> containing the trigger or just an update is in progress. So we will leave
> decision if trigger script should be executed during updates of package
> containing trigger on package maintainers   

Isn't the $2 argument for regular triggers already there for this purpose? And $1 would be the package containing the trigger?

$1 and $2 seem to be both 0 for my tests with %filetriggerin and %filetriggerun, no matter if it's an initial install, update, or removal. This makes it practically impossible to implement for example the texinfo scriptlets using file triggers (the uninstall phase needs to know if it's the final removal): https://fedoraproject.org/wiki/Packaging:Scriptlets#Texinfo

(The install-info scriptlets are a bit broken though; the uninstall should not actually not be checking for final removal, but instead if an info file will be present after the erase/update operation. But I suppose there's no sane way to do that and that's why they're implemented like they are ATM.)

Comment 5 Vít Ondruch 2017-02-13 16:22:02 UTC
> $1 and $2 seem to be both 0 for my tests with %filetriggerin and
> %filetriggerun, no matter if it's an initial install, update, or removal.
> This makes it practically impossible to implement for example the texinfo
> scriptlets using file triggers (the uninstall phase needs to know if it's
> the final removal):
> https://fedoraproject.org/wiki/Packaging:Scriptlets#Texinfo

Any update on this?

Comment 6 Fedora End Of Life 2017-07-25 19:50:57 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Vít Ondruch 2017-07-26 10:13:44 UTC
I have not tested this recently, but I am not aware of seeing this fixed.

Comment 8 Panu Matilainen 2022-06-22 11:49:43 UTC
This is an upstream matter, there are various short-comings in the file trigger design that will need to be eventually addressed: https://github.com/rpm-software-management/rpm/projects/14