Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3339035pxx; Mon, 2 Nov 2020 06:28:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBHk0xQOIoem9M2/AvfuEo38lbezrGVRY2cysHILMt0PGd5mUuP1C4Kix2s1cFFNVj1+z3 X-Received: by 2002:a50:8245:: with SMTP id 63mr17013670edf.133.1604327290381; Mon, 02 Nov 2020 06:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604327290; cv=none; d=google.com; s=arc-20160816; b=J55FR/nqva/O5MxfhkAHzOk7cScSFwyfR9IsCRCRNfURYTKz25EO43BwoF8LiIliFy Jwp/4FW0Y5JQXsOkxMUiWypL7IBMqSgokpFpx1z82plNJZ3tL6WL/qQIGn2X9h530C08 yYCCQiuiWzEwHfbXgmrp4xf27YlCGqHhaVqVfSg/QPQrZgN4tTO6TJVmDOOA/IyG/Aka r9NxgY3iAvN414JPvKt1H/dYzkp1wmQQI6NvrB7UZM2UNhfQWe2NT2mFT7EB7RX0rHPV 1kO/zy9hrez+A29zUze5por8Xyv22oHsKA5F+BKCEaQ45YbiMRh0kfvzbh95T/L5Ow3Y UDBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=JCSykoCJDyi6EQuX6/vLK0UKyPSyCuVNi1wrevWalTk=; b=ev4JuNi4d6sS/pNwHEQx+ZU/gVMywZa/0Bib0HhILnG1EgGOgWOkf0NrePoylG9+zu IqV7A9gJK5ubsog3HNFFDldvRmdfZV95pW2DbLQOefr2VrCE7wWxLHtRhGPYENTJcZCP FbAKxVd4GctEale2XvvjEEDaxyFxd186QeQi+sJ8jg/81E1UVfvoMcu0BjVsTp8mqRoT Qq4iI4QbGD1iprtqTmjsCeSVT7TjyhzkYLqZu/DnSQSUyh0yHY0T0kLaw9Z8r+lnWLYx hxXORus7CJ8pdYC8saFKqsrVVzBZH6TMdbfbladRyMM05dAID6qtPxl9V2PH3sGBbNC4 azzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B9ojKrth; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si11381356edp.327.2020.11.02.06.27.39; Mon, 02 Nov 2020 06:28:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B9ojKrth; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725926AbgKBO0j (ORCPT + 99 others); Mon, 2 Nov 2020 09:26:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34330 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725925AbgKBO0i (ORCPT ); Mon, 2 Nov 2020 09:26:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604327197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=JCSykoCJDyi6EQuX6/vLK0UKyPSyCuVNi1wrevWalTk=; b=B9ojKrthKDFYPKlntHKCuoZrDdmTDs1T6VZmtVihCBmiHnn5ikYZEzTtopnR/KJLPmsHhj PAwe6tzbHI7rbMedy6TRYG3I2YGbCjYY+n4sMcFmy6Pece+yaLLaZM/FDAYt8Vw8IFcuQc Qw0p85nL08cTCuVXNLLgPyQJKqAknzk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-124-w4gGmjJKPyyl3abEXbwnrQ-1; Mon, 02 Nov 2020 09:26:35 -0500 X-MC-Unique: w4gGmjJKPyyl3abEXbwnrQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D197801FCC for ; Mon, 2 Nov 2020 14:26:34 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 065406198E for ; Mon, 2 Nov 2020 14:26:33 +0000 (UTC) From: Lukas Czerner To: linux-ext4@vger.kernel.org Subject: [PATCH] mke2fs: Escape double quotes when parsing mke2fs.conf Date: Mon, 2 Nov 2020 15:26:31 +0100 Message-Id: <20201102142631.87627-1-lczerner@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Currently, when constructing the 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 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 (, 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 --- misc/profile-to-c.awk | 1 + 1 file changed, 1 insertion(+) diff --git a/misc/profile-to-c.awk b/misc/profile-to-c.awk index f964efd6..814f7236 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); } -- 2.26.2