Skip to contentSkip to conversation

kvm-xfstests: fix wget progress bar support

PATCH Applied Ojaswin Mujoo 2 participants 2 messages Feb 21, 2025 – Mar 14, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm-xfstests: fix wget progress bar support

On fedora 41, running kvm-xfstest for the first time throws the following error:

Unknown option 'show-progress'

This is because fedora uses wget2 where the --show-progress flag has been replaced with --force-progress [1]. Hence modify the code to detect the wget version and use the appropriate flag.

[1] https://gitlab.com/gnuwget/wget2/-/wikis/Home#differing-cli-options-wgetwget2

---
 run-fstests/kvm-xfstests | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
run-fstests/kvm-xfstests +13 -1
index a53cc89..99e504b 100755
@@ -60,7 +60,19 @@ if test -z "$EXPLICIT_ROOT_FS" ; then
 	f=root_fs.img.$ARCH
 	ROOT_FS="$(dirname $DIR)/test-appliance/$f"
 	echo "Downloading $f..."
-	wget -nv --show-progress -O "$ROOT_FS.new" "$DOWNLOAD_BASE_URL/$f"
+
+	# wget1 and 2 have different flags to show progress bar
+	WGET_VERSION=$(wget --version | head -n1 | awk '{print $3}' | cut -d. -f1)
+	if [[ "$WGET_VERSION" -eq 1 ]]; then
+			PROGRESS_FLAG="--show-progress"
+	elif [[ "$WGET_VERSION" -eq 2 ]]; then
+			PROGRESS_FLAG="--force-progress"
+	else
+			# don't show progress bar if we can't determine version
+			PROGRESS_FLAG=""
+	fi
+	wget -nv $PROGRESS_FLAG -O "$ROOT_FS.new" "$DOWNLOAD_BASE_URL/$f"
+
 	mv "$ROOT_FS.new" "$ROOT_FS"
     fi
 fi
Signature · 1 line
2.48.1
#1 lore raw
Quoted 10 lines · Ojaswin Mujoo

On fedora 41, running kvm-xfstest for the first time throws the following error:

Unknown option 'show-progress'

This is because fedora uses wget2 where the --show-progress flag has been replaced with --force-progress [1]. Hence modify the code to detect the wget version and use the appropriate flag.

[...]

Applied, thanks!

[1/1] kvm-xfstests: fix wget progress bar support

      commit: a91591289b55cc3d3d2d730faf024ed986365a0a

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>