Keep journal files compatible with older versions
authorMichael Biebl <biebl@debian.org>
Mon, 17 Aug 2020 20:11:19 +0000 (22:11 +0200)
committerMichael Biebl <biebl@debian.org>
Sat, 2 Jan 2021 16:06:01 +0000 (16:06 +0000)
Disable the KEYED-HASH journal feature by default and keep LZ4 (instead
of ZSTD) as default compression for new journal files. Otherwise journal
files are incompatible and can't be read by older journalctl
implementations.

This patch can be dropped in bullseye+1, as journalctl from bullseye
will then be able to read journal files with those features.

Closes: #968055
Gbp-Pq: Topic debian
Gbp-Pq: Name Keep-journal-files-compatible-with-older-versions.patch

src/journal/compress.h
src/journal/journal-file.c

index db7f3999ed7b06a5faf50eecf175cdc3a9fd8a71..6cd9290d45ad49dc9bb2eda25900c26a2f05e208 100644 (file)
@@ -18,14 +18,14 @@ int compress_blob_zstd(const void *src, uint64_t src_size,
 static inline int compress_blob(const void *src, uint64_t src_size,
                                 void *dst, size_t dst_alloc_size, size_t *dst_size) {
         int r;
-#if HAVE_ZSTD
-        r = compress_blob_zstd(src, src_size, dst, dst_alloc_size, dst_size);
-        if (r == 0)
-                return OBJECT_COMPRESSED_ZSTD;
-#elif HAVE_LZ4
+#if HAVE_LZ4
         r = compress_blob_lz4(src, src_size, dst, dst_alloc_size, dst_size);
         if (r == 0)
                 return OBJECT_COMPRESSED_LZ4;
+#elif HAVE_ZSTD
+        r = compress_blob_zstd(src, src_size, dst, dst_alloc_size, dst_size);
+        if (r == 0)
+                return OBJECT_COMPRESSED_ZSTD;
 #elif HAVE_XZ
         r = compress_blob_xz(src, src_size, dst, dst_alloc_size, dst_size);
         if (r == 0)
index bd9f9fe5a2ae4fd96e7559544376d275843ae14f..35a61ff3d572f002d4663a41c4d490eec2ef166d 100644 (file)
@@ -3370,10 +3370,10 @@ int journal_file_open(
                 .prot = prot_from_flags(flags),
                 .writable = (flags & O_ACCMODE) != O_RDONLY,
 
-#if HAVE_ZSTD
-                .compress_zstd = compress,
-#elif HAVE_LZ4
+#if HAVE_LZ4
                 .compress_lz4 = compress,
+#elif HAVE_ZSTD
+                .compress_zstd = compress,
 #elif HAVE_XZ
                 .compress_xz = compress,
 #endif
@@ -3391,7 +3391,7 @@ int journal_file_open(
         if (r < 0) {
                 if (r != -ENXIO)
                         log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_KEYED_HASH environment variable, ignoring.");
-                f->keyed_hash = true;
+                f->keyed_hash = false;
         } else
                 f->keyed_hash = r;