From bd753023237a37525c3ff67554a2d6b0a5e7bcda Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 28 Apr 2026 12:25:10 +0200 Subject: [PATCH] tests/repo: Make a test more robust by checking files for diff Instead of trying to read them into variables, which could fail if there were null bytes in the key. Fixes: 43642337 ("dir: Try to delete the remote if we failed to add it entirely") --- tests/test-repo.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test-repo.sh b/tests/test-repo.sh index 32dccb20..090e3cd7 100644 --- a/tests/test-repo.sh +++ b/tests/test-repo.sh @@ -138,12 +138,12 @@ port=$(cat httpd-port) echo "bad key" > badkey gpg2_repo_url=$(ostree config --repo=$FL_DIR/repo get --group 'remote "test-gpg2-repo"' url) -gpg2_repo_key=$(cat "$FL_DIR/repo/test-gpg2-repo.trustedkeys.gpg") +cp "$FL_DIR/repo/test-gpg2-repo.trustedkeys.gpg" gpg2_repo_key ${FLATPAK} ${U} remote-modify --gpg-import=badkey test-gpg2-repo >&2 || true gpg2_repo_url2=$(ostree config --repo=$FL_DIR/repo get --group 'remote "test-gpg2-repo"' url) -gpg2_repo_key2=$(cat "$FL_DIR/repo/test-gpg2-repo.trustedkeys.gpg") +cp "$FL_DIR/repo/test-gpg2-repo.trustedkeys.gpg" gpg2_repo_key2 -if [[ "${gpg2_repo_url}" != "${gpg2_repo_url2}" || "${gpg2_repo_key}" != "${gpg2_repo_key2}" ]]; then +if [[ "${gpg2_repo_url}" != "${gpg2_repo_url2}" ]] || ! diff -q gpg2_repo_key gpg2_repo_key2 > /dev/null 2>&1; then assert_not_reached "remote-modify failed but remote was modified" fi