RPM Community Forums

Mailing List Message of <rpm-users>

trigger ordering

From: Bela Lubkin <filbo@armory.com>
Date: Thu 11 Nov 2010 - 04:58:22 CET
Message-ID: <201011101958.aa13011@deepthought.armory.com>
[ This was originally composed as mail directly to Jeff Johnson, then I
came to my senses and decided a mailing list is more appropriate.  So
"you" that I am speaking to is Jeff or suitable proxy ;-} ]

I have a question and I'm 99.5% sure I have the right answer.  I'm
writing you because although I have the right answer, I feel the RPM
docs are quite unclear about this and should be fixed.  [ Below I find
the necessary doc; however *this* doc is still unclear and should be
improved... ]

Refer to the discussion <http://rpm5.org/community/rpm-users/0416.html>
and the referenced doc <http://rpm5.org/docs/api/triggers.html>.  This
section is what is unclear to me:

  any-%triggerin (%triggerin from other packages set off by new install)
  new-%triggerin
  old-%triggerun
  any-%triggerun (%triggerun from other packages set off by old uninstall)

That is: the first and last lines are adequately clear, and I don't have
any real issues with "old-%triggerun", but "new-%triggerin" could be
taken in at least two radically different ways (maybe more, but these
are the ones that get me).  I'm sure this seems perfectly clear to you,
who have been steeped in the sequencing of RPM installs for who knows
how many years, but for those of us who just occasionally use this
stuff, it's a bit boggling.

The two interpretations are:

  new-%triggerin might mean:

     1. "fire any %triggerin scripts of new' which pertain to packages
         BEING INSTALLED RIGHT NOW BY THE SAME  COMMAND INVOCATION"

Like I said, I'm 99.5% certain that I know the right answer (1), but I'm
still worried about the 0.5% chance it's (2).  And more to the point, I
definitely understand why other people might have the same doubt, but
not have the grounding to (fairly) firmly believe it's (1).

Please change the doc to read:

  any-%triggerin (%triggerin from other packages set off by new install)
  new-%triggerin (set off by packages already installed + being installed now)
  old-%triggerun
  any-%triggerun (%triggerun from other packages set off by old uninstall)

Actually, wait a sec.  Why would old-%triggerun be fired at all?  I
suppose it *could* list a trigger for *itself* being uninstalled, but if
so, I would consider that merely a case of "any-%triggerun".  Likewise,
if multiple packages are being removed at once, this package's
"old-%triggerun" might fire in response to some other package also
exiting the building, but again, that's an instance of "any-%triggerun".
So I *think* that line of the doc is just wrong.

It also begs a further clarification.  Suppose that packages "foo" and
"bar" are both already installed on the system, and foo has:

  %triggerun -- bar

Obviously if you run , foo's trigger will run.

What if you run ?  Will foo's trigger run because bar is
being removed, even though foo will also be gone by the end of the whole
transaction?

Does order matter; i.e., will  behave differently?

Same for %triggerpostun.

Fully expanding the question, I'm asking what happens in these 8 cases +
2 meta questions:

  scenario 1: foo & bar both already installed, foo has "%triggerun --
              bar"

  Q1a:            A1a: foo's trigger runs
  Q1b:        A1b: ??
  Q1c:        A1c: ??
  Q1d: if A1b & A1c are the same, is this because of the underlying
       principle or because of same emergent outcomes of different
       internal processing?   A1d: ??
  Q1e:            A1e: foo's trigger doesn't run (irrelevant
                                   -- person asking this question is
                                      confused about subject/object)

  scenario 2: foo & bar both already installed, foo has "%triggerpostun
              -- bar"

  Q2a:            A2a: foo's trigger runs
  Q2b:        A2b: ??
  Q2c:        A2c: ??
  Q2d:  same as Q1d           A2d: same as A1d?
  Q2e:            A2e: foo's trigger doesn't run (irrelevant)

That page also mentions "triggerprein" but doesn't spread it out fully
-- I see in more recent emails you're talking like it exists, so it's
not an incompletely removed aborted idea but an incompletely added idea?

Ah, just found <http://rpm5.org/docs/rpm-guide.html> "Setting Triggers"
which brings my certainty up to 100%, but still leaves many of the side
questions open.

For instance these sentences: "The %triggerpostun script is run after
the target package has been removed.  It is not run if your package is
removed.":

The 2nd sentence could be meant as a simple reminder of the
subject/object roles ("removing YOUR package is not what fires this
trigger");

-- or as specific info ("if YOUR package has a %triggerpostun for
package OTHER, and both are removed at the same time, the fact that
YOUR package is being removed in the same transaction means that it
loses the opportunity it would normally have had to fire its
%triggerpostun regarding OTHER").

Thanks,

>Bela<
Received on Fri Nov 12 00:47:14 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.