[elbe-devel] [PATCH] rfs: Prevent cutting OpenPGP armor end line

Bastian Germann bage at linutronix.de
Mon Apr 17 13:47:47 CEST 2023


Stripping the end line via :-1 can result in
"-----END PGP PUBLIC KEY BLOCK-----" being stripped depending on the raw-key
having a terminating line feed or not. Also, stripping the first line via 1:
is not necessary here. Get rid of the list range.

bullseye's gpg will complain about a wrong CRC when the end line is stripped,
which is misleading.

Signed-off-by: Bastian Germann <bage at linutronix.de>
---
 elbepack/rfs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index 1f5c8fb0a5..6974e2d69a 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -287,7 +287,7 @@ class BuildEnv:
             # I could make a none global 'noauth' flag for mirrors
             for i, url in enumerate(self.xml.node('project/mirror/url-list')):
                 if url.has('raw-key'):
-                    key = "\n".join(line.strip(" \t") for line in url.text('raw-key').splitlines()[1:-1])
+                    key = "\n".join(line.strip(" \t") for line in url.text('raw-key').splitlines())
                     self.add_key(unarmor_openpgp_keyring(key), f"elbe-xml-raw-key{i}.gpg")
 
     def initialize_dirs(self, build_sources=False):
-- 
2.39.2



More information about the elbe-devel mailing list