Bug#1071124: dpkg: post-invoke hook does not run after failure due to non-superuser (but pre-invoke hook does)

2024-05-14 Thread Guillem Jover
Hi!

On Tue, 2024-05-14 at 18:19:18 +, Ben Ferreri wrote:
> Package: dpkg
> Version: 1.22.6
> Severity: normal
> X-Debbugs-Cc: bferr...@intwineconnect.com

> When attempting to install a package as a non-superuser, the configured
> pre-invoke hook runs, but the post-invoke hook does not. I believe that
> either both hooks should run in this case or neither should.
> 
> For example:
> 
> I have configured both a pre-invoke and post-invoke hook in
> /etc/dpkg/dpkg.cfg.
> I attempt to install a package as a non-root user with `dpkg -i
> mypackage.deb`. The command fails, as expected. However, I observe 
> that the pre-invoke hook has run, but the post-invoke hook has not run.
> 
> I would have expected that if the pre-invoke hook ran, the post-invoke
> hook should also have run.

Ah, indeed. Thanks for the report. I've got this fixed locally, but
I'll ponder a bit more about the correct semantics, when combined with
--force-not-root. For --no-act/--dry-run I think it's clear they
should not be executed though.

Thanks,
Guillem



Bug#1071124: dpkg: post-invoke hook does not run after failure due to non-superuser (but pre-invoke hook does)

2024-05-14 Thread Ben Ferreri
Package: dpkg
Version: 1.22.6
Severity: normal
X-Debbugs-Cc: bferr...@intwineconnect.com

Dear Maintainer,

When attempting to install a package as a non-superuser, the configured
pre-invoke hook runs, but the post-invoke hook does not. I believe that
either both hooks should run in this case or neither should.

For example:

I have configured both a pre-invoke and post-invoke hook in
/etc/dpkg/dpkg.cfg.
I attempt to install a package as a non-root user with `dpkg -i
mypackage.deb`. The command fails, as expected. However, I observe 
that the pre-invoke hook has run, but the post-invoke hook has not run.

I would have expected that if the pre-invoke hook ran, the post-invoke
hook should also have run.



-- Package-specific info:

-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.8.7-arch1-1 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages dpkg depends on:
ii  libbz2-1.0   1.0.8-5.1
ii  libc62.38-10
ii  liblzma5 5.6.1+really5.4.5-1
ii  libmd0   1.1.0-2
ii  libselinux1  3.5-2+b2
ii  libzstd1 1.5.5+dfsg2-2
ii  tar  1.35+dfsg-3
ii  zlib1g   1:1.3.dfsg-3.1

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt2.9.2
pn  debsig-verify  

-- Configuration Files:
/etc/dpkg/dpkg.cfg changed:
no-debsig
log /var/log/dpkg.log
pre-invoke=/bin/dpkg-hook.sh pre
post-invoke=/bin/dpkg-hook.sh post


-- no debconf information