aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2020-11-02 15:26:31 +0100
committerTheodore Ts'o <tytso@mit.edu>2021-01-19 23:56:20 -0500
commit6fa8edd0fde7a540b41d78e45743208c8edab0b1 (patch)
treed0d513587b8ad9d6f3d10ee7761431659421bba2
parent3ec53092ddb3fb0a44242ae3349b8f6ea14c220e (diff)
downloade2fsprogs-6fa8edd0fde7a540b41d78e45743208c8edab0b1.tar.gz
mke2fs: Escape double quotes when parsing mke2fs.conf
Currently, when constructing the <default> configuration pseudo-file using the profile-to-c.awk script we will just pass the double quotes as they appear in the mke2fs.conf. This is problematic, because the resulting default_profile.c will either fail to compile because of syntax error, or leave the resulting configuration invalid. It can be reproduced by adding the following line somewhere into mke2fs.conf configuration and forcing mke2fs to use the <default> configuration by specifying nonexistent mke2fs.conf MKE2FS_CONFIG="nonexistent" ./misc/mke2fs -T ext4 /dev/device default_mntopts = "acl,user_xattr" ^ this will fail to compile default_mntopts = "" ^ this will result in invalid config file Syntax error in mke2fs config file (<default>, line #4) Unknown code prof 17 Fix it by escaping the double quotes with a backslash in profile-to-c.awk script. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--misc/profile-to-c.awk1
1 files changed, 1 insertions, 0 deletions
diff --git a/misc/profile-to-c.awk b/misc/profile-to-c.awk
index f964efd62..814f7236a 100644
--- a/misc/profile-to-c.awk
+++ b/misc/profile-to-c.awk
@@ -4,6 +4,7 @@ BEGIN {
}
{
+ gsub("\"","\\\"",$0);
printf(" \"%s\\n\"\n", $0);
}