Verified - I ran the specified command, and saw exactly two lines for both bionic's 1.6.9 and cosmic's 1.7.3; as expected (one for each hook variant).
$ lxc exec apt-bionic -- apt -o AptCli::Hooks::Install::="/usr/bin/printf '{error should be json}\n\n' >&3" install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
E: Hook /usr/bin/printf '{error should be json}\n\n' >&3 reported an error during hello: {error should be json}
E: Hook /usr/bin/printf '{error should be json}\n\n' >&3 reported an error during hello: {error should be json}
$ lxc exec apt-cosmic -- apt -o AptCli::Hooks::Install::="/usr/bin/printf '{error should be json}\n\n' >&3" install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
E: Hook /usr/bin/printf '{error should be json}\n\n' >&3 reported an error during hello: {error should be json}
E: Hook /usr/bin/printf '{error should be json}\n\n' >&3 reported an error during hello: {error should be json}
Verified - I ran the specified command, and saw exactly two lines for both bionic's 1.6.9 and cosmic's 1.7.3; as expected (one for each hook variant).
$ lxc exec apt-bionic -- apt -o AptCli: :Hooks: :Install: :="/usr/ bin/printf '{error should be json}\n\n' >&3" install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
E: Hook /usr/bin/printf '{error should be json}\n\n' >&3 reported an error during hello: {error should be json}
E: Hook /usr/bin/printf '{error should be json}\n\n' >&3 reported an error during hello: {error should be json}
$ lxc exec apt-cosmic -- apt -o AptCli: :Hooks: :Install: :="/usr/ bin/printf '{error should be json}\n\n' >&3" install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
E: Hook /usr/bin/printf '{error should be json}\n\n' >&3 reported an error during hello: {error should be json}
E: Hook /usr/bin/printf '{error should be json}\n\n' >&3 reported an error during hello: {error should be json}