summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2022-03-02 10:48:13 +0100
committerJustus Winter <justus@sequoia-pgp.org>2022-03-02 11:06:29 +0100
commitcd8defaacd7c8fd86a1536c15ce786f153f1652a (patch)
treef640b83500b52ff557b40178ea9c467de7408020
parentb7c4691a7ccd28bbfd303b90e0f32e62289cac55 (diff)
openpgp: Fix test failure if compression features are disabled.
- Enables the test unconditionally, but avoids the panic if an algorithm is not supported. This is a workaround until we have reworked the compressed data handling. - See https://gitlab.com/sequoia-pgp/sequoia/-/issues/830. - This addresses the same problem like !1235 but in a more general way.
-rw-r--r--openpgp/src/serialize.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/openpgp/src/serialize.rs b/openpgp/src/serialize.rs
index dea98dc1..afbf1646 100644
--- a/openpgp/src/serialize.rs
+++ b/openpgp/src/serialize.rs
@@ -3089,7 +3089,6 @@ mod test {
}
- #[cfg(feature = "compression-deflate")]
#[test]
fn serialize_test_2() {
// Given a packet in serialized form:
@@ -3163,6 +3162,21 @@ mod test {
assert_eq!(pile, pile2);
}
} else {
+ // XXX: We should always parse the packet into a
+ // compressed data packet, even if we don't understand
+ // the algorithm. See
+ // https://gitlab.com/sequoia-pgp/sequoia/-/issues/830.
+ // In the mean time, as a workaround, we check whether
+ // we support the algorithm. Drop this once #830 is
+ // addressed.
+ if let Some(Packet::Unknown(u)) = po {
+ // The first octet is the compression algorithm.
+ let algo: CompressionAlgorithm = u.body()[0].into();
+ if ! algo.is_supported() {
+ continue;
+ }
+ }
+
panic!("Expected a compressed data data packet.");
}
}