fix compatibility workflow and tests on older GPG
authorShane Jaroch <chown_tee@proton.me>
Sat, 17 Jan 2026 11:17:26 +0000 (06:17 -0500)
committerShane Jaroch <chown_tee@proton.me>
Sat, 17 Jan 2026 11:17:26 +0000 (06:17 -0500)
.github/workflows/compatibility.yaml
tests/system-test-multikey.sh

index d20a6ff819635a98d7b6ffbdf9008b55c291888c..738c261c6d2fb0a70214f18b3d69d93058f8afa5 100644 (file)
@@ -9,17 +9,23 @@ on:
 jobs:
   # Validate 3 versions of git
   git:
-    name: Git Compatibility (${{ matrix.os }})
-    runs-on: ${{ matrix.os }}
-
+    name: Git / GnuPG Compatibility
+    runs-on: ubuntu-latest
+    container:
+      image: ${{ matrix.image }}
     strategy:
       fail-fast: false
       matrix:
-        os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest]
+        image: [ubuntu:20.04, ubuntu:22.04, ubuntu:24.04]
 
     steps:
       - uses: actions/checkout@v4
 
+      - name: Tool versions (check)
+        run: |
+          gpg --version
+          git --version
+
       - name: Install dependencies
         run: |
           sudo apt-get update
@@ -36,8 +42,11 @@ jobs:
     steps:
       - uses: actions/checkout@v4
 
-      - name: Show git version
-        run: git --version
+      - name: Tool versions (check)
+        run: |
+          bash --version
+          zsh --version
+          fish --version
 
       - name: Install Shells
         run: |
index 324be51bb29ba829a9e1a8db303929630bb79afb..03b07d137c9e1be65530a46c657866a9a5267165 100755 (executable)
@@ -14,6 +14,28 @@ print_err() { printf "\033[1;31m[TEST] FAIL: %s\033[0m\n" "$1"; }
 num_commits=5
 files_per_commit=3
 
+# Check GPG version
+gpg_ver=$(gpg --version | head -n1 | awk '{print $3}')
+print_info "GPG Version detected: $gpg_ver"
+
+# Function to check if version strictly less than
+version_lt() {
+       [ "$1" = "$2" ] && return 1 || :
+       [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]
+}
+
+# Determine if we expect the bug (Threshold: >= 2.2.20 assumed for now)
+# Ubuntu 20.04 (2.2.19) does NOT have the bug.
+# Ubuntu 22.04 (2.2.27) likely has it.
+# Arch (2.4.9) definitely has it.
+expect_bug=1
+if version_lt "$gpg_ver" "2.2.20"; then
+       print_warn "GPG version $gpg_ver is old. We do not expect the checksum bug here."
+       expect_bug=0
+else
+       print_info "GPG version $gpg_ver is modern. We expect the checksum bug."
+fi
+
 print_info "Running multi-key clone test..."
 random_source="/dev/urandom"
 random_data_per_file=1024 # Reduced size for faster testing (1KB)
@@ -227,8 +249,12 @@ print_info "Step 6: Reproduction Step - Clone with buried key..."
                print_success "SUCCESS: Checksum error detected but Clone SUCCEEDED. (Fix is working!)"
        elif [ $ret -eq 0 ]; then
                print_warn "WARNING: Clone passed unexpectedly (Checksum error not detected). Bug not triggered."
-               print_err "Exiting due to unexpected pass."
-               exit 1
+               if [ "$expect_bug" -eq 0 ]; then
+                       print_success "SUCCESS: Old GPG version ($gpg_ver) confirmed clean. Pass."
+               else
+                       print_err "FAIL: Exiting due to unexpected pass on modern GPG $gpg_ver."
+                       exit 1
+               fi
        else
                print_err "ERROR: Clone failed with generic error (Checksum error not detected)."
                exit 1
@@ -290,8 +316,12 @@ print_info "Step 7: Reproduction Step - Push with buried key..."
                print_success "SUCCESS: Checksum error detected (Push) but Push SUCCEEDED. (Fix is working!)"
        elif [ $ret -eq 0 ]; then
                print_warn "WARNING: Push passed unexpectedly (Checksum error not detected). Bug not triggered."
-               print_err "Exiting due to unexpected pass."
-               exit 1
+               if [ "$expect_bug" -eq 0 ]; then
+                       print_success "SUCCESS: Old GPG version ($gpg_ver) confirmed clean. Pass."
+               else
+                       print_err "FAIL: Exiting due to unexpected pass on modern GPG $gpg_ver."
+                       exit 1
+               fi
        else
                print_err "ERROR: Push failed with generic error (Checksum error not detected)."
                exit 1