diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2017-09-24 13:47:04 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2017-09-24 14:03:41 +0200 |
| commit | b9509c0fbc13679393389611a5c4b88b0324306a (patch) | |
| tree | 0fdc411bb8beca88bc2c48899b87f7ceea9e5a27 | |
| parent | 62c63e03ec968f0a38fb6d05222336c4e738dcd2 (diff) | |
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.
| -rw-r--r-- | kconfiglib.py | 15 | ||||
| -rw-r--r-- | tests/Kdefconfig_srctree | 2 |
2 files changed, 6 insertions, 11 deletions
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 diff --git a/tests/Kdefconfig_srctree b/tests/Kdefconfig_srctree index 3aa4505..d2591fa 100644 --- a/tests/Kdefconfig_srctree +++ b/tests/Kdefconfig_srctree @@ -1,5 +1,5 @@ config A string option defconfig_list - default "/sub/defconfig_in_sub" # Assume this doesn't exist + default "sub/defconfig_in_sub" # Assume this doesn't exist default "Kconfiglib/tests/defconfig_2" |
