This bug was fixed in the package apt - 1.7.0~alpha2 --------------- apt (1.7.0~alpha2) experimental; urgency=medium
* Handle JSON hooks that just close the file/exit and fix some other errors (LP: #1776218) * Use cheaper entropy source for randomizing items to fetch -- Julian Andres Klode <j...@debian.org> Mon, 09 Jul 2018 16:02:45 +0200 ** Changed in: apt (Ubuntu) Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to apt in Ubuntu. https://bugs.launchpad.net/bugs/1776218 Title: New style hook support not robust on removal Status in apt package in Ubuntu: Fix Released Status in apt source package in Bionic: In Progress Bug description: [Impact] The new style (json-rpc) hooks are great. However when using them in snapd we noticed the following problem. When shipping a hook in /etc/apt/apt.conf.d/20snapd.conf like: ``` AptCli::Hooks::Install { "[ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true"; }; ``` this works fine. However when the snapd package is removed apt fails with: ``` ... Purging configuration files for snapd (1337.2.32.8) ... Final directory cleanup Discarding preserved snap namespaces Removing extra snap-confine apparmor rules Removing snapd cache Removing snapd state E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true: Connection reset by peer E: Could not read message separator line after handshake from [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true: Connection reset by peer quiet: end of output. ``` I.e. if the hook is not there apt still expectes a handshake. [Test case] cat > rootdir/etc/apt/apt.conf.d/99-json-hooks << EOF AptCli::Hooks::Install:: "true"; AptCli::Hooks::Search:: "true"; EOF and run an install. This test and some more error handling tests are part of the test suite, too, so autopkgtest covers that for us. [Regression potential] Hooks that do not respond to the initial handshake and just exit with 0 are silently ignored. [Other info] There are some more changes in the patch that fix other cases of error handling: As can be seen above, there are 2 error messages for one error, because the code did not abort early, but tried to carry on, reading more data. It now goes directly to the end. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1776218/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp