From 92791a3fe15bb2d5c14039fbd531be73255f0c6d Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 1 Jun 2019 04:15:04 +0200 Subject: Fix obscure crash with rsource and $srctree pointing to a symlink Sourcing a file with an absolute path and using rsource in it triggered a relpath() between the absolute path and $srctree. Since e.g. symlink/../bar/ = bar/ is not guaranteed for symlinks, this could lead to the rsource'd file not being found if $srctree pointed to a symlink. Switch to a simpler, more textual method for stripping $srctree from glob results, which should be robust against symlink shenanigans. This also makes the code a bit easier to follow. Discovered by Marc Herbert. Piggyback some minor cleanup. --- tests/sub/Kconfig_symlink_2 | 1 + tests/sub/Kconfig_symlink_3 | 2 ++ tests/sub/sub/Kconfig_symlink_1 | 2 ++ tests/symlink | 1 + 4 files changed, 6 insertions(+) create mode 100644 tests/sub/Kconfig_symlink_2 create mode 100644 tests/sub/Kconfig_symlink_3 create mode 100644 tests/sub/sub/Kconfig_symlink_1 create mode 120000 tests/symlink (limited to 'tests') diff --git a/tests/sub/Kconfig_symlink_2 b/tests/sub/Kconfig_symlink_2 new file mode 100644 index 0000000..aeba985 --- /dev/null +++ b/tests/sub/Kconfig_symlink_2 @@ -0,0 +1 @@ +rsource "Kconfig_symlink_3" diff --git a/tests/sub/Kconfig_symlink_3 b/tests/sub/Kconfig_symlink_3 new file mode 100644 index 0000000..20b4e06 --- /dev/null +++ b/tests/sub/Kconfig_symlink_3 @@ -0,0 +1,2 @@ +config FOUNDME + bool diff --git a/tests/sub/sub/Kconfig_symlink_1 b/tests/sub/sub/Kconfig_symlink_1 new file mode 100644 index 0000000..bceec8b --- /dev/null +++ b/tests/sub/sub/Kconfig_symlink_1 @@ -0,0 +1,2 @@ +# Sources tests/sub/Kconfig_symlink_2, with an absolute path +source "$(KCONFIG_SYMLINK_2)" diff --git a/tests/symlink b/tests/symlink new file mode 120000 index 0000000..565623e --- /dev/null +++ b/tests/symlink @@ -0,0 +1 @@ +sub/sub \ No newline at end of file -- cgit v1.2.3