Blame SOURCES/e2fsprogs-1.45.6-mke2fs-Escape-double-quotes-when-parsing-mke2fs.conf.patch

612539
From 6fa8edd0fde7a540b41d78e45743208c8edab0b1 Mon Sep 17 00:00:00 2001
612539
From: Lukas Czerner <lczerner@redhat.com>
612539
Date: Mon, 2 Nov 2020 15:26:31 +0100
612539
Subject: [PATCH] mke2fs: Escape double quotes when parsing mke2fs.conf
612539
612539
Currently, when constructing the <default> configuration pseudo-file using
612539
the profile-to-c.awk script we will just pass the double quotes as they
612539
appear in the mke2fs.conf.
612539
612539
This is problematic, because the resulting default_profile.c will either
612539
fail to compile because of syntax error, or leave the resulting
612539
configuration invalid.
612539
612539
It can be reproduced by adding the following line somewhere into
612539
mke2fs.conf configuration and forcing mke2fs to use the <default>
612539
configuration by specifying nonexistent mke2fs.conf
612539
612539
MKE2FS_CONFIG="nonexistent" ./misc/mke2fs -T ext4 /dev/device
612539
612539
default_mntopts = "acl,user_xattr"
612539
^ this will fail to compile
612539
612539
default_mntopts = ""
612539
^ this will result in invalid config file
612539
612539
Syntax error in mke2fs config file (<default>, line #4)
612539
       Unknown code prof 17
612539
612539
Fix it by escaping the double quotes with a backslash in
612539
profile-to-c.awk script.
612539
612539
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
612539
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
612539
---
612539
 misc/profile-to-c.awk | 1 +
612539
 1 file changed, 1 insertion(+)
612539
612539
diff --git a/misc/profile-to-c.awk b/misc/profile-to-c.awk
612539
index f964efd6..814f7236 100644
612539
--- a/misc/profile-to-c.awk
612539
+++ b/misc/profile-to-c.awk
612539
@@ -4,6 +4,7 @@ BEGIN {
612539
 }
612539
 
612539
 {
612539
+  gsub("\"","\\\"",$0);
612539
   printf("  \"%s\\n\"\n", $0);
612539
 }
612539
 
612539
-- 
612539
2.26.3
612539