Some systems where we run tests on do not have a 4.x bash, so they do
not have readarray. While it looked a bit nicer than messing with
`head` and `tail`, we do not really need it, so we might as well not use
it.
Reported-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/common.filter | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 3833206327..345c3ca03e 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -138,13 +138,13 @@ _do_filter_img_create()
# Split the line into the pre-options part ($filename_part, which
# precedes ", fmt=") and the options part ($options, which starts
# with "fmt=")
- # (And just echo everything before the first "^Formatting")
- readarray formatting_line < <($SED -e 's/, fmt=/\n/')
+ read formatting_line
- filename_part=${formatting_line[0]}
- unset formatting_line[0]
+ # Split line at the first ", fmt="
+ formatting_line=$(echo "$formatting_line" | $SED -e 's/, fmt=/\nfmt=/')
- options="fmt=${formatting_line[@]}"
+ filename_part=$(echo "$formatting_line" | head -n 1)
+ options=$(echo "$formatting_line" | tail -n +2)
# Set grep_data_file to '\|data_file' to keep it; make it empty
# to drop it.
--
2.26.2
On 7/10/20 11:32 AM, Max Reitz wrote: > Some systems where we run tests on do not have a 4.x bash, so they do > not have readarray. While it looked a bit nicer than messing with > `head` and `tail`, we do not really need it, so we might as well not use > it. > > Reported-by: Claudio Fontana <cfontana@suse.de> > Signed-off-by: Max Reitz <mreitz@redhat.com> > --- > tests/qemu-iotests/common.filter | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Max Reitz <mreitz@redhat.com> writes: > Some systems where we run tests on do not have a 4.x bash, so they do > not have readarray. While it looked a bit nicer than messing with > `head` and `tail`, we do not really need it, so we might as well not use > it. I've fixed the cirrus build failure by brew installing a more recent bash. However if we prefer we could do this. > > Reported-by: Claudio Fontana <cfontana@suse.de> > Signed-off-by: Max Reitz <mreitz@redhat.com> > --- > tests/qemu-iotests/common.filter | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter > index 3833206327..345c3ca03e 100644 > --- a/tests/qemu-iotests/common.filter > +++ b/tests/qemu-iotests/common.filter > @@ -138,13 +138,13 @@ _do_filter_img_create() > # Split the line into the pre-options part ($filename_part, which > # precedes ", fmt=") and the options part ($options, which starts > # with "fmt=") > - # (And just echo everything before the first "^Formatting") > - readarray formatting_line < <($SED -e 's/, fmt=/\n/') > + read formatting_line > > - filename_part=${formatting_line[0]} > - unset formatting_line[0] > + # Split line at the first ", fmt=" > + formatting_line=$(echo "$formatting_line" | $SED -e 's/, fmt=/\nfmt=/') > > - options="fmt=${formatting_line[@]}" > + filename_part=$(echo "$formatting_line" | head -n 1) > + options=$(echo "$formatting_line" | tail -n +2) > > # Set grep_data_file to '\|data_file' to keep it; make it empty > # to drop it. -- Alex Bennée
© 2016 - 2025 Red Hat, Inc.