Skip to contentSkip to conversation

tests/qemu-iotests: Fix broken grep command in iotest 207

PATCH In review Thomas Huth 3 participants 3 messages Nov 13, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/qemu-iotests: Fix broken grep command in iotest 207

From: Thomas Huth <[email protected]>

Running "./check -ssh 207" fails for me with lots of lines like this in the output:

+base64: invalid input

While looking closer at it, I noticed that the grep -v "\\^#" command in this test is not working as expected - it is likely meant to filter out the comment lines that are starting with a "#", but at least my version of grep (GNU grep 3.11) does not work with the backslashes here. There does not seem to be a compelling reason for these backslashes, so let's simply drop them to fix this issue.

---
 tests/qemu-iotests/207 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/207 +1 -1
index 41dcf3ff55e..ceab990e648 100755
@@ -119,7 +119,7 @@ with iotests.FilePath('t.img') as disk_path, \
     iotests.img_info_log(remote_path)
 
     keys = subprocess.check_output(
-        'ssh-keyscan 127.0.0.1 2>/dev/null | grep -v "\\^#" | ' +
+        'ssh-keyscan 127.0.0.1 2>/dev/null | grep -v "^#" | ' +
         'cut -d" " -f3',
         shell=True).rstrip().decode('ascii').split('\n')
 
Signature · 1 line
2.51.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Running "./check -ssh 207" fails for me with lots of lines like this in the output:

+base64: invalid input

While looking closer at it, I noticed that the grep -v "\\^#" command in this test is not working as expected - it is likely meant to filter out the comment lines that are starting with a "#", but at least my version of grep (GNU grep 3.11) does not work with the backslashes here. There does not seem to be a compelling reason for these backslashes, so let's simply drop them to fix this issue.

Quoted 4 lines
---
 tests/qemu-iotests/207 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
Quoted 15 lines · Daniel P. Berrangé
Quoted 14 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Running "./check -ssh 207" fails for me with lots of lines like this in the output:

+base64: invalid input

While looking closer at it, I noticed that the grep -v "\\^#" command in this test is not working as expected - it is likely meant to filter out the comment lines that are starting with a "#", but at least my version of grep (GNU grep 3.11) does not work with the backslashes here. There does not seem to be a compelling reason for these backslashes, so let's simply drop them to fix this issue.

Quoted 6 lines
Quoted 4 lines
---
 tests/qemu-iotests/207 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Not quite NBD material, but since it touches iotests and I was preparing a pull request that benefitted from a cleaner run, I went ahead and queued it through my tree.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org