[git commit] hush: fix dot builtin to not search current directory

Denys Vlasenko vda.linux at googlemail.com
Sat Jan 27 18:05:59 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=f7e0feaf977ea5fef0f0819ba67a47dbef9b2e1a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
builtin_source                                       182     209     +27

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/hush.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/shell/hush.c b/shell/hush.c
index cf3c731..2d1cc5c 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -10211,6 +10211,11 @@ static int FAST_FUNC builtin_source(char **argv)
 		arg_path = find_in_path(filename);
 		if (arg_path)
 			filename = arg_path;
+		else /* add "if (!HUSH_BASH_SOURCE_CURDIR)" if users want bash-compat */ {
+			errno = ENOENT;
+			bb_simple_perror_msg(filename);
+			return EXIT_FAILURE;
+		}
 	}
 	input = remember_FILE(fopen_or_warn(filename, "r"));
 	free(arg_path);


More information about the busybox-cvs mailing list