From 294863a3a7d6936ce159dfb5945ef16b9c1898ee Mon Sep 17 00:00:00 2001 From: "Brett T. Warden" Date: Mon, 26 Aug 2024 10:04:41 -0700 Subject: [PATCH] Redirect URL override messages to STDERR Previously, these messages were printed to STDOUT: Overriding version and content URLs with... Overriding content URL with... Overriding version URL with... But especially with --quiet, the output to STDOUT should be strictly the requested data. So print these as warnings instead. --- src/swupd_lib/globals.c | 6 +++--- test/functional/mirror/mirror-set-unset.bats | 6 +++--- .../os-install/install-statedir-cache-offline.bats | 10 +++++----- test/functional/usability/usa-config-file.bats | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/swupd_lib/globals.c b/src/swupd_lib/globals.c index 2a7b71956..2db635107 100644 --- a/src/swupd_lib/globals.c +++ b/src/swupd_lib/globals.c @@ -551,7 +551,7 @@ static bool global_parse_opt(int opt, char *optarg) } return true; case 'u': - print("Overriding version and content URLs with %s\n", optarg); + warn("Overriding version and content URLs with %s\n", optarg); set_version_url(optarg); set_content_url(optarg); return true; @@ -563,11 +563,11 @@ static bool global_parse_opt(int opt, char *optarg) } return true; case 'c': - print("Overriding content URL with %s\n", optarg); + warn("Overriding content URL with %s\n", optarg); set_content_url(optarg); return true; case 'v': - print("Overriding version URL with %s\n", optarg); + warn("Overriding version URL with %s\n", optarg); set_version_url(optarg); return true; case 'F': diff --git a/test/functional/mirror/mirror-set-unset.bats b/test/functional/mirror/mirror-set-unset.bats index c965a933f..94517c01d 100755 --- a/test/functional/mirror/mirror-set-unset.bats +++ b/test/functional/mirror/mirror-set-unset.bats @@ -74,7 +74,7 @@ teardown_file() { run sudo sh -c "$SWUPD mirror --set -u https://example.com/swupd-file $SWUPD_OPTS" assert_status_is 0 expected_output=$(cat <<-EOM - Overriding version and content URLs with https://example.com/swupd-file + Warning: Overriding version and content URLs with https://example.com/swupd-file Mirror url set Distribution: Swupd Test Distro Installed version: 10 @@ -108,7 +108,7 @@ teardown_file() { run sudo sh -c "$SWUPD mirror --set -c https://example.com/swupd-file $SWUPD_OPTS" assert_status_is 0 expected_output=$(cat <<-EOM - Overriding content URL with https://example.com/swupd-file + Warning: Overriding content URL with https://example.com/swupd-file Mirror url set Distribution: Swupd Test Distro Installed version: 10 @@ -142,7 +142,7 @@ teardown_file() { run sudo sh -c "$SWUPD mirror --set -v https://example.com/swupd-file $SWUPD_OPTS" assert_status_is 0 expected_output=$(cat <<-EOM - Overriding version URL with https://example.com/swupd-file + Warning: Overriding version URL with https://example.com/swupd-file Mirror url set Distribution: Swupd Test Distro Installed version: 10 diff --git a/test/functional/os-install/install-statedir-cache-offline.bats b/test/functional/os-install/install-statedir-cache-offline.bats index 7ace64731..db0c837fb 100755 --- a/test/functional/os-install/install-statedir-cache-offline.bats +++ b/test/functional/os-install/install-statedir-cache-offline.bats @@ -32,7 +32,7 @@ test_setup() { assert_status_is "$SWUPD_OK" expected_output=$(cat <<-EOM - Overriding version and content URLs with https://localhost + Warning: Overriding version and content URLs with https://localhost Installing OS version 10 Downloading missing manifests... No packs need to be downloaded @@ -63,7 +63,7 @@ test_setup() { assert_status_is "$SWUPD_COULDNT_LOAD_MANIFEST" expected_output=$(cat <<-EOM - Overriding version and content URLs with https://localhost + Warning: Overriding version and content URLs with https://localhost Installing OS version 10 Downloading missing manifests... Error: Failed to connect to update server: https://localhost/10/Manifest.os-core.tar @@ -92,7 +92,7 @@ test_setup() { assert_status_is "$SWUPD_COULDNT_LOAD_MOM" expected_output=$(cat <<-EOM - Overriding version and content URLs with https://localhost + Warning: Overriding version and content URLs with https://localhost Installing OS version 10 Error: Failed to connect to update server: https://localhost/10/Manifest.MoM.sig Possible solutions for this problem are: @@ -121,7 +121,7 @@ test_setup() { assert_status_is "$SWUPD_COULDNT_DOWNLOAD_FILE" expected_output=$(cat <<-EOM - Overriding version and content URLs with https://localhost + Warning: Overriding version and content URLs with https://localhost Installing OS version 10 Downloading missing manifests... No packs need to be downloaded @@ -153,7 +153,7 @@ test_setup() { assert_status_is "$SWUPD_OK" expected_output=$(cat <<-EOM - Overriding version and content URLs with https://localhost + Warning: Overriding version and content URLs with https://localhost Installing OS version 10 Downloading missing manifests... Error: Failed to connect to update server: https://localhost/10/pack-os-core-from-0.tar diff --git a/test/functional/usability/usa-config-file.bats b/test/functional/usability/usa-config-file.bats index 375f737ab..dd1426812 100755 --- a/test/functional/usability/usa-config-file.bats +++ b/test/functional/usability/usa-config-file.bats @@ -160,8 +160,8 @@ test_setup() { run sudo sh -c "$SWUPD info $SWUPD_OPTS -v https://anotherurl.com" assert_status_is "$SWUPD_OK" expected_output=$(cat <<-EOM - Overriding version and content URLs with https://someurl.com - Overriding version URL with https://anotherurl.com + Warning: Overriding version and content URLs with https://someurl.com + Warning: Overriding version URL with https://anotherurl.com Distribution: Swupd Test Distro Installed version: 10 Version URL: https://anotherurl.com