aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <uwe@kleine-koenig.org>2023-04-04 07:41:46 +0200
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-04-04 08:26:15 -0400
commit636678fc35339ab6939a549c3a9bc1a14610cd98 (patch)
treeea1db34baf0af401cb9ad58f7fd3cb499a9f4d01
parentfa21d509531ef04d1077b95635842f4beae174e9 (diff)
downloadpgpkeys-636678fc35339ab6939a549c3a9bc1a14610cd98.tar.gz
korg-refresh-keys: Fix a race condition
The script called git fetch and git pull. Two assumptions break if the remote repository changed in between. So only merge @{u} instead of pulling. Link: https://lore.kernel.org/r/20230404054146.3201386-1-uwe@kleine-koenig.org Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--scripts/korg-refresh-keys5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/korg-refresh-keys b/scripts/korg-refresh-keys
index 1c6014a..d66b489 100644
--- a/scripts/korg-refresh-keys
+++ b/scripts/korg-refresh-keys
@@ -45,7 +45,10 @@ fi
CHANGED=$(git diff --name-only HEAD @{u} | grep '.asc$')
-git pull $Q
+# Don't use pull here in case upstream moved on since the fetch above. If this
+# happens CHANGED would likely be incomplete and you wouldn't have verified
+# HEAD but continue to import keymaterial from it.
+git merge $Q @{u}
IMPORTFILES=''
for ASCFILE in $CHANGED; do