Bug 1284645

Summary: rpm %transfiletriggerpostun is not called
Product: [Fedora] Fedora Reporter: Zbigniew Jędrzejewski-Szmek <zbyszek>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: jorton, j, jzeleny, klember, novyjindrich, packaging-team-maint, pknirsch, pmatilai, rdieter, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.13.0-3.fc26 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-20 08:29:22 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:
Bug Depends On:    
Bug Blocks: 1288081, 1343357    

Description Zbigniew Jędrzejewski-Szmek 2015-11-23 18:12:28 UTC
Description of problem:
I have the following test packages:

$ rpm -q --filetriggers transfiletriggers
filetriggerin scriptlet (using /bin/sh) -- /usr/share/doc
logger transfiletriggers filetriggerin $*: $(head|xargs echo)
filetriggerun scriptlet (using /bin/sh) -- /usr/share/doc
logger transfiletriggers filetriggerun $*: $(head|xargs echo)
filetriggerpostun scriptlet (using /bin/sh) -- /usr/share/doc
logger transfiletriggers filetriggerpostun $*: $(head|xargs echo)
transfiletriggerin scriptlet (using /bin/sh) -- /usr/share/doc
logger transfiletriggers transfiletriggerin $*: $(head|xargs echo)
transfiletriggerun scriptlet (using /bin/sh) -- /usr/share/doc
logger transfiletriggers transfiletriggerun $*: $(head|xargs echo)
transfiletriggerpostun scriptlet (using /bin/sh) -- /usr/share/doc
logger transfiletriggers transfiletriggerpostun $*: $(head|xargs echo)

$ rpm -q -l transfiletriggers-a
/usr/share/doc/transfiletriggers-a
/usr/share/doc/transfiletriggers-a/README

As in $subject, I don't see %transfiletriggerpostun called.

- installation calls: filetriggerin, transfiletriggerin
- removal calls: transfiletriggerun, filetriggerun, filetriggerpostun
- reinstall calls: transfiletriggerun, filetriggerin, filetriggerun, filetriggerpostun, transfiletriggerin

Version-Release number of selected component (if applicable):
rpm-4.13.0-0.rc1.13.fc24.x86_64

Comment 1 Ľuboš Kardoš 2015-11-25 10:00:39 UTC
There is a different problem. %(trans)filetriggerpostun should be called only for packages that fire a trigger. It shouldn't be called for a package containing
that trigger because the trigger is executed after the package is uninstalled so the trigger is also uninstalled and probably commands called in the trigger are uninstalled as well.

I need to look deeper into this.

Comment 2 Zbigniew Jędrzejewski-Szmek 2015-11-25 13:21:02 UTC
My report wasn't very clear: I was talking about installing/uninstalling/upgrading package transfiletriggers-a.rpm while the triggers were in package transfiletriggers.rpm. Whether %(trans)filetriggerpostun will be called after transfiletriggers.rpm itself is uninstalled is an orthogonal issue.

Comment 3 Vít Ondruch 2015-12-02 13:05:49 UTC
I facing the same issues. I wanted to propose following patch for vim:

From c8e3818f88c5bdb3bb6055b0cc1f38e74657db66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch>
Date: Tue, 1 Dec 2015 15:51:39 +0100
Subject: [PATCH] Add RPM file triggers support.

---
 vim.spec | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/vim.spec b/vim.spec
index 98175e9..6c4183b 100644
--- a/vim.spec
+++ b/vim.spec
@@ -542,6 +542,14 @@ if [ -x /%{_bindir}/gtk-update-icon-cache ]; then
 fi
 update-desktop-database &> /dev/null ||:
 
+# Refresh documentation helptags
+%transfiletriggerin common -- %{_datadir}/%{name}/vimfiles/doc
+vim -c ":helptags %{_datadir}/%{name}/vimfiles/doc" -c :q &> /dev/null
+
+%transfiletriggerpostun common -- %{_datadir}/%{name}/vimfiles/doc
+> %{_datadir}/%{name}/vimfiles/doc/tags
+vim -c ":helptags %{_datadir}/%{name}/vimfiles/doc" -c :q &> /dev/null
+
 %clean
 rm -rf %{buildroot}
 
@@ -756,6 +764,9 @@ rm -rf %{buildroot}
 %{_datadir}/icons/hicolor/*/apps/*
 
 %changelog
+* Tue Dec 01 2015 Vít Ondruch <vondruch> 7.4.945-1
+- Add RPM file triggers support.
+
 * Tue Dec 01 2015 Karsten Hopp <karsten> 7.4.945-1
 - patchlevel 945
 
-- 
2.6.3



Later trying with vim-commentary modified as follows:


diff --git a/vim-commentary.spec b/vim-commentary.spec
index dff1e65..a420639 100644
--- a/vim-commentary.spec
+++ b/vim-commentary.spec
@@ -48,12 +48,12 @@ install -m 644 %{SOURCE1} %{buildroot}%{appdata_dir}
 # Check the AppData add-on to comply with guidelines.
 appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.metainfo.xml
 
-%post
-vim -c ":helptags %{vimfiles}/doc" -c :q &> /dev/null
-
-%postun
-> %{vimfiles}/doc/tags
-vim -c ":helptags %{vimfiles}/doc" -c :q &> /dev/null
+#%post
+#vim -c ":helptags %{vimfiles}/doc" -c :q &> /dev/null
+#
+#%postun
+#> %{vimfiles}/doc/tags
+#vim -c ":helptags %{vimfiles}/doc" -c :q &> /dev/null
 
 %files
 %doc CONTRIBUTING.markdown README.markdown


No matter what I do, the "%{vimfiles}/doc/tags" is never updated during uninstallation of vim-commentary.

Comment 4 Vít Ondruch 2015-12-02 13:25:12 UTC
Just for the sake of completeness, this is what RPM says about the triggers:

$ rpm -q -p --filetriggers ./vim-common-7.4.945-1.fc24.x86_64.rpm 
transfiletriggerin scriptlet (using /bin/sh) -- /usr/share/vim/vimfiles/doc
vim -c ":helptags /usr/share/vim/vimfiles/doc" -c :q &> /dev/null
transfiletriggerpostun scriptlet (using /bin/sh) -- /usr/share/vim/vimfiles/doc
> /usr/share/vim/vimfiles/doc/tags
vim -c ":helptags /usr/share/vim/vimfiles/doc" -c :q &> /dev/null

Comment 5 Jan Kurik 2016-02-24 14:01:14 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 6 Panu Matilainen 2016-11-07 11:50:53 UTC
It's an upstream bug, fixed now:
https://github.com/rpm-software-management/rpm/commit/f6521c50f6836374a0f7995f8f393aaf36e178ea

I'll push updates for this later, right now we need to get the 4.13.0 update through to people.

Comment 7 Panu Matilainen 2016-11-07 13:37:22 UTC
Fixed in rawhide as of rpm-4.13.0-3.fc26, stable version to be done later.

Comment 8 Vít Ondruch 2016-11-07 15:37:03 UTC
Thx, it works for the case above. Going to implement the triggers for vim (bug 1343357) right away ;)