#986542#5
Date:
2021-04-07 09:19:02 UTC
From:
To:
needrestart currently wastes time each time we spawn dpkg to monitor
for unpacks. It should instead use Dpkg::Pre-Invoke and
DPkg::Post-Invoke and analyse the state difference like etckeeper
does.

You can check both which things were installed, as well as whether
there is a package in an erronous state this way, which also ends up
being more correct - just because dpkg produced an error does not
necessarily mean the outcome is an error.

The dpkg hook causes test suite failures in apt when needrestart is
installed, as it can't write to /run/needrestart (please don't ask me
why). Yes, I guess we can work around dpkg hooks writing in the middle
of our scripts, but this is really all madness.

(204/273) Testcase test-failing-maintainer-scripts:  P P P P P P P P P P
P P P P P P P P P P P P P P P PReading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  dependee
  The following NEW packages will be installed:
    dependee failure-postinst
    0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/2520 B of archives.
    After this operation, 20.5 kB of additional disk space will be used.
    Get:1 file:/tmp/tmp.KEeJrchuqp/aptarchive unstable/main ppc64el
    dependee ppc64el 1.0 [1224 B]
    Get:2 file:/tmp/tmp.KEeJrchuqp/aptarchive unstable/main ppc64el
    failure-postinst ppc64el 1.0 [1296 B]
    PRE: START
    PRE: MaiN
    PRE: ENd
    Selecting previously unselected package dependee.
    (Reading database ...
    (Reading database ... 50%
    (Reading database ... 100%
    (Reading database ... 0 files and directories currently installed.)
    Preparing to unpack .../pool/dependee_1.0_ppc64el.deb ...
    Unpacking dependee (1.0) ...
    touch: cannot touch '/run/needrestart/unpacked': Permission denied
    Selecting previously unselected package failure-postinst.
    Preparing to unpack .../failure-postinst_1.0_ppc64el.deb ...
    Unpacking failure-postinst (1.0) ...
    Setting up dependee (1.0) ...
    Setting up failure-postinst (1.0) ...
    WARNING: CHROOTing to /tmp/tmp.KEeJrchuqp/rootdir was ignored!
    REWRITE execvp call /var/lib/dpkg/info/failure-postinst.postinst
    into /tmp/tmp.KEeJrchuqp/rootdir
    dpkg: error processing package failure-postinst (--configure):
     installed failure-postinst package post-installation script
     subprocess returned error exit status 29
     Errors were encountered while processing:
      failure-postinst
      touch: POST: START
      POST: MaiN
      POST: ENd
      W: Using config option »dpkg::stoponerror« of type UNDEFINED as a
      type BOOL
      E: Sub-process /tmp/tmp.KEeJrchuqp/rootdir/usr/bin/dpkg returned
      an error code (1)
      Test for proper execution of invoke scripts in console log … FAIL
       P P P P P P P P P P P P P P P P P P P P
       Running test-failing-maintainer-scripts -> FAILED