Hi!

On Tue, 2014-11-04 at 22:16:02 +0100, Christoph Biedl wrote:
> Guillem Jover wrote...
> > Well, because as it stands, it creates trigger cycles, so I don't think
> > it is fit for release. (Those cycles started to get detected recently,
> > then that regressed and stopped being detected, which meant that Jakub
> > closed the other RC bug, but now should be detected correctly again.)
> 
> Ah, that one. I thought it had been dealt with, nevertheless if you
> consider that kind of trigger usage a bad idea, let's get rid of it.

Perfect, thanks!

> > I'm not sure if you mean in general, like in documentation or
> > previous posts about this, or if you mean in the above comment, if the
> > former I'll gladly try to improve the documentation, or write a post
> > to say debian-devel to state that clearly. If the latter, I'll try to
> > explain below why anyway.
> 
> Actually the latter but this deserves broader knowledge anyway.

Ok, I'll make a note to write something up then, for the docs and
maybe a general post on d-d.

> > In this case you want dpkg to trigger for every and each package
> > installed, and you are assuming all packages ship at least a file
> > under /usr (in practice this might do the job, but you'd really want
> > would be to trigger on /).
> 
> Being sophistic (but not serious), /usr/share/doc/ should be sufficient
> due to policy 12.5 "Copyright information" :)

Yeah, that's why I said "in practice". :)

> (...)
> > Please do not access the dpkg database on the filesystem directly,
> > and move the functionality into a new script, or update the existing
> > one to do the equivalent.
> 
> Did so. I was thinking of invoking dpkg-reconfigure instead but that
> might cause nasty effects due to dpkg nesting.

It might, as it seems it's calling dpkg --configure in some cases.

> > > This sounds a bit weird. And creates a problem: Even if I check
> > > $DPKG_HOOK_ACTION for "configure", this hook will be called for each
> > > package if more than just one is being installed. This will increase
> > > load on my side unless there's a way to to detect the *last*
> > > "configure" invocation of a dpkg run in a sane way - that's the job
> > > the trigger served very well.
> > 
> > The hook is executed per dpkg run, not per package action, so if apt
> > bundles say 40 packages in a dpkg call, then there will be only one
> > post-invoke execution. The problem is that if apt does multiple dpkg
> > runs, because for example it is dealing with Essential packages, then
> > yes it will be called multiple times. But the same applies to a
> > trigger as dpkg might end up calling it multiple times depending on
> > when it gets processed, or when it subsequently gets triggered.
> 
> As things just happen, my observation above was the result of an
> unlucky test scenario where I saw several hook invocations. But there
> were also several trigger invocations, so there is no differences.

You might want to restrict the hook based on DPKG_HOOK_ACTION, to avoid
performing operations on actions that are not relevant to you. Probably
you want to hook only on unpack, install, remove and purge, and do an
early return otherwise.

(You could also probably remove the duped code by calling the script
from the maintainer script. And you might need to call db_stop also in
the hook?)

> > Yes, that should do the trick. You can easily check how this behaves
> > on your system by adding something like:
> > 
> > ,--- /etc/dpkg/dpkg.cfg.d/10-post-invoke ---
> > post-invoke "echo Dpkg hook action: $DPKG_HOOK_ACTION"
> > `---
> > 
> > But, let me know if anything is not clear, etc.
> 
> A heads-up: Trailing spaces in that post-invoke line might result in
> completely mis-leading error messages. Will investigate further and
> perhaps file a bug report about that.

Thanks, I fixed this some days ago to ignored trailing whitspace, and
will be targetted at 1.18.x.

> Thanks a lot for your explanations. It was insightful and I love to
> learn from people who are willing to share their knowledge in a
> patient way.

No problem!

Thanks,
Guillem


--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to