All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1]: Setting KCONFIG_CONFIG can break conf_write
@ 2014-12-18 18:07 Andy Voltz
  2014-12-18 18:07 ` [PATCH] kconfig: allow KCONFIG_CONFIG environment to be full path Andy Voltz
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Voltz @ 2014-12-18 18:07 UTC (permalink / raw)
  To: linux-kbuild

I ran into an issue where if conf --olddefconfig is used to update
a config which is not on the same mounted volume, the conf_write
fails. The final rename of tmpconfig fails to move the file across
volumes.

For example, this fails (on my host /tmp is tmpfs):

$ touch /tmp/test.config
$ export KCONFIG_CONFIG=/tmp/test.config
$ ./scripts/kconfig/conf --olddefconfig Kconfig

This is only an issue when no name is passed to conf_write. When a
name is passed, there is code to determine the directory and write
tmpconfig there.

The following patch uses the same dirname code for the environment
variable, when no name is passed to conf_write.

Let me know what you think.

Thanks,
--
Andy Voltz


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] kconfig: allow KCONFIG_CONFIG environment to be full path
  2014-12-18 18:07 [PATCH 0/1]: Setting KCONFIG_CONFIG can break conf_write Andy Voltz
@ 2014-12-18 18:07 ` Andy Voltz
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Voltz @ 2014-12-18 18:07 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Andy Voltz

When no name arg is passed to conf_write, the .tmpconfig file used to
prepare a new config is created in the working dir. If KCONFIG_CONFIG
specifies a path which is not on the same volume, the rename fails
with 'Invalid cross-device link'.

This change determines the dir passed in KCONFIG_CONFIG, and uses it
as the location for the tmpconfig.

Signed-off-by: Andy Voltz <andy.voltz@timesys.com>
---
 scripts/kconfig/confdata.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index f88d90f..072838b 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -743,26 +743,26 @@ int conf_write(const char *name)
 	char *env;
 
 	dirname[0] = 0;
-	if (name && name[0]) {
-		struct stat st;
-		char *slash;
+	if (!name)
+		name = conf_get_configname();
+
+	struct stat st;
+	char *slash;
 
-		if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
-			strcpy(dirname, name);
-			strcat(dirname, "/");
+	if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
+		strcpy(dirname, name);
+		strcat(dirname, "/");
+		basename = conf_get_configname();
+	} else if ((slash = strrchr(name, '/'))) {
+		int size = slash - name + 1;
+		memcpy(dirname, name, size);
+		dirname[size] = 0;
+		if (slash[1])
+			basename = slash + 1;
+		else
 			basename = conf_get_configname();
-		} else if ((slash = strrchr(name, '/'))) {
-			int size = slash - name + 1;
-			memcpy(dirname, name, size);
-			dirname[size] = 0;
-			if (slash[1])
-				basename = slash + 1;
-			else
-				basename = conf_get_configname();
-		} else
-			basename = name;
 	} else
-		basename = conf_get_configname();
+		basename = name;
 
 	sprintf(newname, "%s%s", dirname, basename);
 	env = getenv("KCONFIG_OVERWRITECONFIG");
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-18 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-18 18:07 [PATCH 0/1]: Setting KCONFIG_CONFIG can break conf_write Andy Voltz
2014-12-18 18:07 ` [PATCH] kconfig: allow KCONFIG_CONFIG environment to be full path Andy Voltz

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.