From 18e4c6108e1957a886c1df5054cff73d35a62006 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Wed, 29 Nov 2023 12:04:06 -0800 Subject: apt-key: remove carriage returns from armored keyrings before dearmoring Without this, the awk script returns nothing if the armored keyring uses Windows/DOS-style CRLF line endings (since awk is designed for processing Unix text files). This would result in a NO_PUBKEY error during the signature verification part of an apt-get update. --- cmdline/apt-key.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmdline') diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index 80b0c2ade..4f3e9c8e1 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -446,7 +446,8 @@ dearmor_keyring() { # The awk script is more complex through to skip surrounding garbage and # to support multiple keys in one file (old gpgs generate version headers # which get printed with the original and hence result in garbage input for base64 - awk '/^-----BEGIN/{ x = 1; } + awk '{ gsub(/\r/,"") } +/^-----BEGIN/{ x = 1; } /^$/{ if (x == 1) { x = 2; }; } /^[^=-]/{ if (x == 2) { print $0; }; } /^-----END/{ x = 0; }' | base64 -d -- cgit v1.2.3-70-g09d2