New style hook support not robust on removal
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apt (Ubuntu) |
Fix Released
|
High
|
Julian Andres Klode | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned |
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/
```
AptCli:
```
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/
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.
Changed in apt (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → High |
assignee: | nobody → Julian Andres Klode (juliank) |
tags: | added: id-5b333ce4c9e5f90176d2242c |
description: | updated |
Changed in apt (Ubuntu): | |
status: | In Progress → Fix Committed |
Any chance this can be fixed for 18.04.1 ?