From b9509c0fbc13679393389611a5c4b88b0324306a Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sun, 24 Sep 2017 13:47:04 +0200 Subject: Fix defconfig srctree absolute/relative mixup bug This code in zconf.l says !=, not ==. Thought the behavior seemed weird. if (!f && name != NULL && name[0] != '/') { env = getenv(SRCTREE); if (env) { sprintf(fullname, "%s/%s", env, name); f = fopen(fullname, "r"); } } return f; Thankfully only broken for a short while. Also gives much simpler code. --- kconfiglib.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index fab1fb9..d87f9cc 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -292,9 +292,9 @@ class Config(object): past the first one (and prints a warning). If the environment variable 'srctree' was set when the Config was - created, each defconfig specified with an absolute path will be + created, each defconfig specified with a relative path will be searched for in $srcdir if it is not found at the specified path (i.e., - if /foo/defconfig is not found, $srctree/foo/defconfig will be looked + if foo/defconfig is not found, $srctree/foo/defconfig will be looked up). WARNING: A wart here is that scripts/kconfig/Makefile sometimes uses @@ -311,15 +311,10 @@ class Config(object): filename = self._expand_sym_refs(filename) if os.path.exists(filename): return filename - # defconfig not found. If the path is an absolute path and + # defconfig not found. If the path is a relative path and # $srctree is set, we also look in $srctree. - if os.path.isabs(filename) and self.srctree is not None: - # The os.path.relpath() de-absolutizes the path, e.g. - # /foo/bar/baz -> foo/bar/baz. os.path.join() ignores the - # first argument if the second argument is an absolute - # path. - filename = os.path.join(self.srctree, - os.path.relpath(filename, os.sep)) + if not os.path.isabs(filename) and self.srctree is not None: + filename = os.path.join(self.srctree, filename) if os.path.exists(filename): return filename -- cgit v1.2.3