Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[debug] wrap qemu command arguments in quotes #55

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

chantra
Copy link
Collaborator

@chantra chantra commented Jan 18, 2024

The command that was printed by vmtest was not wrapping arguments in quotes. When trying to copy/paste the command, one had to find whatever was related to -append and wrap add quotes.

This wraps all argument in quotes so the printed command can be simply copy/pasted.

Before:

[16:34:03] chantra@surya:danobi-vmtest git:(master) $ RUST_LOG=debug cargo run -- -k kernels/bzImage-x86_64 "ls" 2>&1 | cat | grep invocation
[2024-01-18T00:34:10Z DEBUG vmtest::qemu] qemu invocation: qemu-system-x86_64 -nodefaults -display none -serial stdio -enable-kvm -cpu host -qmp unix:/tmp/qmp-264786.sock,server=on,wait=off -chardev socket,path=/tmp/qga-332867.sock,server=on,wait=off,id=qga0 -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 --device virtio-serial -chardev socket,path=/tmp/cmdout-123076.sock,server=on,wait=off,id=cmdout --device virtserialport,chardev=cmdout,name=org.qemu.virtio_serial.0 -virtfs local,id=root,path=/,mount_tag=/dev/root,security_model=none,multidevs=remap -kernel /home/chantra/devel/danobi-vmtest/kernels/bzImage-x86_64 -no-reboot -append rootfstype=9p rootflags=trans=virtio,cache=loose,msize=1048576 rw earlyprintk=serial,0,115200 printk.devkmsg=on console=0,115200 loglevel=7 raid=noautodetect init=/tmp/vmtest-initddkPv.sh panic=-1 -virtfs local,id=shared,path=/home/chantra/devel/danobi-vmtest,mount_tag=vmtest-shared,security_model=none,multidevs=remap -smp 2 -m 4G

After:

[16:34:33] chantra@surya:danobi-vmtest git:(command_quotes) $ RUST_LOG=debug cargo run -- -k kernels/bzImage-x86_64 "ls" 2>&1 | cat | grep invocation
[2024-01-18T00:34:40Z DEBUG vmtest::qemu] qemu invocation: qemu-system-x86_64 "-nodefaults" "-display" "none" "-serial" "stdio" "-enable-kvm" "-cpu" "host" "-qmp" "unix:/tmp/qmp-701433.sock,server=on,wait=off" "-chardev" "socket,path=/tmp/qga-669270.sock,server=on,wait=off,id=qga0" "-device" "virtio-serial" "-device" "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0" "--device" "virtio-serial" "-chardev" "socket,path=/tmp/cmdout-609567.sock,server=on,wait=off,id=cmdout" "--device" "virtserialport,chardev=cmdout,name=org.qemu.virtio_serial.0" "-virtfs" "local,id=root,path=/,mount_tag=/dev/root,security_model=none,multidevs=remap" "-kernel" "/home/chantra/devel/danobi-vmtest/kernels/bzImage-x86_64" "-no-reboot" "-append" "rootfstype=9p rootflags=trans=virtio,cache=loose,msize=1048576 rw earlyprintk=serial,0,115200 printk.devkmsg=on console=0,115200 loglevel=7 raid=noautodetect init=/tmp/vmtest-initXClKT.sh panic=-1" "-virtfs" "local,id=shared,path=/home/chantra/devel/danobi-vmtest,mount_tag=vmtest-shared,security_model=none,multidevs=remap" "-smp" "2" "-m" "4G"

The command that was printed by vmtest was not wrapping arguments in quotes.
When trying to copy/paste the command, one had to find whatever was related to `-append`
and wrap add quotes.

This wraps all argument in quotes so the printed command can be simply copy/pasted.

Before:
```
[16:34:03] chantra@surya:danobi-vmtest git:(master) $ RUST_LOG=debug cargo run -- -k kernels/bzImage-x86_64 "ls" 2>&1 | cat | grep invocation
[2024-01-18T00:34:10Z DEBUG vmtest::qemu] qemu invocation: qemu-system-x86_64 -nodefaults -display none -serial stdio -enable-kvm -cpu host -qmp unix:/tmp/qmp-264786.sock,server=on,wait=off -chardev socket,path=/tmp/qga-332867.sock,server=on,wait=off,id=qga0 -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 --device virtio-serial -chardev socket,path=/tmp/cmdout-123076.sock,server=on,wait=off,id=cmdout --device virtserialport,chardev=cmdout,name=org.qemu.virtio_serial.0 -virtfs local,id=root,path=/,mount_tag=/dev/root,security_model=none,multidevs=remap -kernel /home/chantra/devel/danobi-vmtest/kernels/bzImage-x86_64 -no-reboot -append rootfstype=9p rootflags=trans=virtio,cache=loose,msize=1048576 rw earlyprintk=serial,0,115200 printk.devkmsg=on console=0,115200 loglevel=7 raid=noautodetect init=/tmp/vmtest-initddkPv.sh panic=-1 -virtfs local,id=shared,path=/home/chantra/devel/danobi-vmtest,mount_tag=vmtest-shared,security_model=none,multidevs=remap -smp 2 -m 4G
```
After:
```
[16:34:33] chantra@surya:danobi-vmtest git:(command_quotes) $ RUST_LOG=debug cargo run -- -k kernels/bzImage-x86_64 "ls" 2>&1 | cat | grep invocation
[2024-01-18T00:34:40Z DEBUG vmtest::qemu] qemu invocation: qemu-system-x86_64 "-nodefaults" "-display" "none" "-serial" "stdio" "-enable-kvm" "-cpu" "host" "-qmp" "unix:/tmp/qmp-701433.sock,server=on,wait=off" "-chardev" "socket,path=/tmp/qga-669270.sock,server=on,wait=off,id=qga0" "-device" "virtio-serial" "-device" "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0" "--device" "virtio-serial" "-chardev" "socket,path=/tmp/cmdout-609567.sock,server=on,wait=off,id=cmdout" "--device" "virtserialport,chardev=cmdout,name=org.qemu.virtio_serial.0" "-virtfs" "local,id=root,path=/,mount_tag=/dev/root,security_model=none,multidevs=remap" "-kernel" "/home/chantra/devel/danobi-vmtest/kernels/bzImage-x86_64" "-no-reboot" "-append" "rootfstype=9p rootflags=trans=virtio,cache=loose,msize=1048576 rw earlyprintk=serial,0,115200 printk.devkmsg=on console=0,115200 loglevel=7 raid=noautodetect init=/tmp/vmtest-initXClKT.sh panic=-1" "-virtfs" "local,id=shared,path=/home/chantra/devel/danobi-vmtest,mount_tag=vmtest-shared,security_model=none,multidevs=remap" "-smp" "2" "-m" "4G"
```

Signed-off-by: Manu Bretelle <[email protected]>
@danobi danobi merged commit c175e64 into danobi:master Jan 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants