All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2 of 6] pkg-utils: kconfig helpers: use single iso double quoting
Date: Mon, 14 Jul 2014 13:50:26 +0200	[thread overview]
Message-ID: <53e04c0bd837ebc96e93.1405338626@localhost> (raw)
In-Reply-To: <patchbomb.1405338624@localhost>

The echo statements in the kconfig helpers are currently using double
quotes. For KCONFIG_SET_OPT this is problematic when the value argument
itself contains a double quote (a string value). In this case, the statement
    echo "$(1)=$(2)" >> $(3)
would become:
    echo "FOO="string value"" >> /some/path/.config
resulting in the string
    FOO=string value
in the config file, rather than the properly quoted
    FOO="string value"

The linux package worked around this by escaping the quote characters, but
a prettier solution is to use single quoting in the helpers (or
alternatively use no quoting at all).
A side effect of this change is that a $variable in the key or value would
no longer be interpreted by the shell, removing any unexpected behavior.

This change is only really necessary for KCONFIG_SET_OPT, but for symmetry
reasons the other helpers are updated too.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

---
 linux/linux.mk       |  2 +-
 package/pkg-utils.mk |  6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -r 4a53bf323d8a -r 53e04c0bd837 linux/linux.mk
--- a/linux/linux.mk	Wed Jul 09 20:27:38 2014 +0200
+++ b/linux/linux.mk	Sun Jul 13 09:34:05 2014 +0200
@@ -180,7 +180,7 @@
 	# rebuilt using the linux26-rebuild-with-initramfs target.
 	$(if $(BR2_TARGET_ROOTFS_INITRAMFS),
 		touch $(BINARIES_DIR)/rootfs.cpio
-		$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_SOURCE,\"$(BINARIES_DIR)/rootfs.cpio\",$(@D)/.config)
+		$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_SOURCE,"$(BINARIES_DIR)/rootfs.cpio",$(@D)/.config)
 		$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_ROOT_UID,0,$(@D)/.config)
 		$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_ROOT_GID,0,$(@D)/.config))
 	$(if $(BR2_ROOTFS_DEVICE_CREATION_STATIC),,
diff -r 4a53bf323d8a -r 53e04c0bd837 package/pkg-utils.mk
--- a/package/pkg-utils.mk	Wed Jul 09 20:27:38 2014 +0200
+++ b/package/pkg-utils.mk	Sun Jul 13 09:34:05 2014 +0200
@@ -35,17 +35,17 @@
 
 define KCONFIG_ENABLE_OPT # (option, file)
 	$(SED) "/\\<$(1)\\>/d" $(2)
-	echo "$(1)=y" >> $(2)
+	echo '$(1)=y' >> $(2)
 endef
 
 define KCONFIG_SET_OPT # (option, value, file)
 	$(SED) "/\\<$(1)\\>/d" $(3)
-	echo "$(1)=$(2)" >> $(3)
+	echo '$(1)=$(2)' >> $(3)
 endef
 
 define KCONFIG_DISABLE_OPT # (option, file)
 	$(SED) "/\\<$(1)\\>/d" $(2)
-	echo "# $(1) is not set" >> $(2)
+	echo '# $(1) is not set' >> $(2)
 endef
 
 # Helper functions to determine the name of a package and its

  parent reply	other threads:[~2014-07-14 11:50 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 11:50 [Buildroot] [PATCH 0 of 6] uclibc: fix handling of configuration file Thomas De Schampheleire
2014-07-14 11:50 ` [Buildroot] [PATCH 1 of 6] pkg-utils: kconfig helpers: add basic usage documentation Thomas De Schampheleire
2014-07-14 14:02   ` Yann E. MORIN
2014-07-14 16:39   ` Arnout Vandecappelle
2014-07-14 11:50 ` Thomas De Schampheleire [this message]
2014-07-14 14:26   ` [Buildroot] [PATCH 2 of 6] pkg-utils: kconfig helpers: use single iso double quoting Yann E. MORIN
2014-07-14 16:41   ` Arnout Vandecappelle
2014-07-14 11:50 ` [Buildroot] [PATCH 3 of 6] uclibc: replace custom kconfig helpers with those provided by pkg-utils Thomas De Schampheleire
2014-07-14 14:36   ` Yann E. MORIN
2014-07-14 14:39     ` Thomas De Schampheleire
2014-07-14 14:40       ` Yann E. MORIN
2014-07-14 11:50 ` [Buildroot] [PATCH 4 of 6] uclibc: rename SETUP_DOT_CONFIG to FIXUP_DOT_CONFIG Thomas De Schampheleire
2014-07-14 14:33   ` Thomas Petazzoni
2014-07-14 14:39     ` Yann E. MORIN
2014-07-14 14:43       ` Thomas De Schampheleire
2014-07-14 16:21         ` Yann E. MORIN
2014-07-14 16:44         ` Arnout Vandecappelle
2014-07-14 19:51           ` Thomas De Schampheleire
2014-07-15  6:09             ` Arnout Vandecappelle
2014-07-14 11:50 ` [Buildroot] [PATCH 5 of 6] uclibc: menuconfig: take into account initial settings from config file Thomas De Schampheleire
2014-07-14 16:55   ` Arnout Vandecappelle
2014-07-14 19:54     ` Thomas De Schampheleire
2014-07-15  6:10       ` Arnout Vandecappelle
2014-07-14 11:50 ` [Buildroot] [PATCH 6 of 6] uclibc: update-config: preserve freshly configured settings Thomas De Schampheleire
2014-07-14 17:05   ` Arnout Vandecappelle
2014-07-15 18:33     ` Thomas De Schampheleire
2014-07-16  5:43       ` Arnout Vandecappelle
2014-07-17 17:57         ` Thomas De Schampheleire
2014-07-17 23:28           ` Arnout Vandecappelle
2014-07-18  5:29             ` Thomas De Schampheleire
2014-07-14 16:34 ` [Buildroot] [PATCH 0 of 6] uclibc: fix handling of configuration file Arnout Vandecappelle
2014-07-15 17:36 ` Thomas Petazzoni
2014-07-15 18:38   ` Thomas De Schampheleire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53e04c0bd837ebc96e93.1405338626@localhost \
    --to=patrickdepinguin@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.