chiark / gitweb /
test suite: stunt gnupg runs gpg again if it exits status 2
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Aug 2017 21:27:28 +0000 (22:27 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 4 Aug 2017 20:44:45 +0000 (21:44 +0100)
Work around gnupg agent connection races by having our stunt gpg
wrapper simply try running gpg again, once, if it exits 2.
This does not fully suppress the bug but it does significantly reduce
the probability.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
tests/tstunt/gpg

index e1c2c476d2b44bca3a9c80061f9a08b7566991c3..7bae4d2ef74ef36da82bb8fd5c78127ab0381ed8 100644 (file)
@@ -21,6 +21,10 @@ dgit (4.1~) experimental; urgency=medium
 
   Test suite:
   * sbuild-gitish: New test case to check running sbuild from git
 
   Test suite:
   * sbuild-gitish: New test case to check running sbuild from git
+  * Work around gnupg agent connection races by having our stunt
+    gpg wrapper simply try running gpg again, once, if it exits 2.
+    This does not fully suppress the bug but it does significantly reduce
+    the probability.
 
  --
 
 
  --
 
index d71aa63f359d601081ef215188ef69d5cc09f120..790c46c86ed9a3d6b6cf2cfa872f8eb6f446c668 100755 (executable)
@@ -1,6 +1,20 @@
 #!/bin/sh
 set -e
 #!/bin/sh
 set -e
-exec                                                   \
+
+for attempt in '' exec; do
+
+set +e
+$attempt                                               \
 $DGIT_TEST_REAL_GPG                                    \
        --agent-program=$DGIT_STUNT_AGENT               \
        "$@"
 $DGIT_TEST_REAL_GPG                                    \
        --agent-program=$DGIT_STUNT_AGENT               \
        "$@"
+rc=$?
+set -e
+
+if [ $rc != 2 ]; then exit $rc; fi
+
+echo >&2 "WARNING - GNUPG FAILED $rc - STUNT GNUPG $attempt $*"
+
+done
+
+exit 127