Hi Simon,

On 21-08-2022 23:46, Simon McVittie wrote:
If it wants argv as individual arguments, like I would have expected,
then the second command should be more like:

     sudo lxc-start test && sudo lxc-attach test -- sh -ec "if [ -d ..."

which is how lib/VirtSubproc.py actually runs it.

As usual, it looks like you're totally right (and I was wrong). But still...

paul@mulciber ~ $ sudo lxc-start test && sudo lxc-attach test -- sh -ec "if [ -d /run/systemd/system ]; then echo systemd ; exit 0 ; else echo unknown ; exit 0 ; fi" ; echo $? && sudo lxc-stop test
[sudo] password for paul:
unknown
0
paul@mulciber ~ $ sudo lxc-start test && sudo lxc-attach test -- sh -ec "if [ -d /run/systemd/system ]; then echo systemd ; exit 0 ; else echo unknown ; exit 0 ; fi" ; echo $? && sudo lxc-stop test
systemd
0
paul@mulciber ~ $ sudo lxc-start test && sudo lxc-attach test -- sh -ec "if [ -d /run/systemd/system ]; then echo systemd ; exit 0 ; else echo unknown ; exit 0 ; fi" ; echo $? && sudo lxc-stop test
systemd
0
paul@mulciber ~ $ sudo lxc-copy test -N test2
paul@mulciber ~ $ sudo lxc-start test2 && sudo lxc-attach test2 -- sh -ec "if [ -d /run/systemd/system ]; then echo systemd ; exit 0 ; else echo unknown ; exit 0 ; fi" ; echo $? && sudo lxc-stop test2
unknown
0
paul@mulciber ~/autopkgtest $

If the root cause was me mixing up commands that want a shell one-liner
with commands that want argv, then I would have expected that virt-lxc
would *never* work in the current version, rather than only intermittently
working (but I'm fairly sure it passed its autopkgtest run in my
autopkgtest-virt-qemu, so it must work at least sometimes).

It seems there is a race condition in the setup.

Paul

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to