Commit fae8e63b authored by Ariadne Conill's avatar Ariadne Conill

main/busybox: make "source" work like bash again by searching current directory for scripts

See http://lists.busybox.net/pipermail/busybox/2018-January/086146.html for rationale.
parent f101d9b0
From 01f7b9e182e257c12f7a7dec76c6b4168605ecd2 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Fri, 26 Jan 2018 15:15:43 +0100
Subject: ash: introduce a config option to search current directory for
sourced files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
shell/ash.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/shell/ash.c b/shell/ash.c
index 865159d..d2c9372 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -51,6 +51,13 @@
//config: default y
//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
//config:
+//config:config ASH_BASH_SOURCE_CURDIR
+//config: bool "'source' and '.' builtins search current directory after $PATH"
+//config: default n # do not encourage non-standard behavior
+//config: depends ASH_BASH_COMPAT
+//config: help
+//config: This is not compliant with standards. Avoid if possible.
+//config:
//config:config ASH_COMMAND_NOT_FOUND_HOOK
//config: bool "command_not_found_handle hook support"
//config: default y
@@ -12978,10 +12985,14 @@ find_dot_file(char *name)
if (fullname != name)
stunalloc(fullname);
}
+ /* not found in PATH */
- /* not found in the PATH */
+#if ENABLE_ASH_BASH_SOURCE_CURDIR
+ return name;
+#else
ash_msg_and_raise_error("%s: not found", name);
/* NOTREACHED */
+#endif
}
static int FAST_FUNC
--
cgit v0.12
......@@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.27.2
pkgrel=7
pkgrel=8
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
......@@ -40,6 +40,8 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0014-CVE-2017-15873.patch
0015-CVE-2017-15874.patch
0001-ash-introduce-a-config-option-to-search-current.patch
top-buffer-overflow.patch
acpid.logrotate
......@@ -203,9 +205,10 @@ a09a64b3bce8048c58a68dcd2dd9e63c911009c06195d6bb4e5aecfb5700e479c25b34635c608991
74620e589e863f63ad3fed1e37405e385648789d59e8914074f94b2d279728ad54cd497073ff7afe2aac1bca81150fa1b396034206358599281f15fb2dd079d5 0013-CVE-2017-16544.patch
8a9f314c7d08d349957549c59d306d1b608f147e27719a290d421cce288c11adb8593034a6d722688ae3c5dc60a5180f7aa948213987cd5b188340558607cbcb 0014-CVE-2017-15873.patch
93b3188fe3397899a625c203bcc03ddedadb96cceeb38ecad3ad3395d75fdfa7e1ba7cfc34eb8ebc7c70165ae967da474735247bf114398bea00440e90b1bef7 0015-CVE-2017-15874.patch
de61c39a31a7b43d3e23c48e1712faf1a468781a3b18872a937bf507980c474f3d66af815fb1708d282e53def32502f033bb2283926a506cb8f138e0667b1ebd 0001-ash-introduce-a-config-option-to-search-current.patch
524e858b52cb31fb8d24e8c7f18606fff349aeab6a14da9cca3902641f6127980daed73c53586c6e8b41eecda06cdb29c40ff1dde2dc82a318c2649680458921 top-buffer-overflow.patch
a9b1403c844c51934637215307dd9e2adb9458921047acff0d86dcf229b6e0027f4b2c6cdaa25a58407aad9d098fb5685d58eb5ff8d2aa3de4912cdea21fe54c acpid.logrotate
02102f0764ffbec86e97ccab99b3a1e55ffa5b25aa2cdc1fe270d5b575610bdb50568574c7cbd05aba91b13151f84f536b44320c180051cbd77cf258e4fc89a4 busyboxconfig
c201ba9316450bac561a2ec831cabd6e98149e387721a140c95a2b441ed8d7589fb12cab9760315bfef491280e7638781e68905feed9a6fcfc55c0d864608964 busyboxconfig
7759d1611ce72f7aa9e4afbd48f410806b3bd59701fe8a570675898c504c0e15f85bacbc1578f87345197844ee6175117d348acc4fe29a742b7ac96b84fe7386 busyboxconfig-extras
e84087a453f8c9814951c9ad496cce19f8280b80a8ab6a1c8e21385f1facb17e987adc8d1d72c7cb463c04eb0cadd2bd6fb9b6f6c0067ddd21eeacf91ca42f32 bbsuid.c
a1127c8a384294135e11500fde7ead33b73d24b11c21911b08447a4c4ef71d7a9965d6466f60f2da64e3b877213b0a3e924a5add3c5333ee3ecde8c2a91c5e02 dad.if-up
......
......@@ -1071,6 +1071,7 @@ CONFIG_ASH_TEST=y
CONFIG_ASH_HELP=y
CONFIG_ASH_GETOPTS=y
CONFIG_ASH_CMDCMD=y
CONFIG_ASH_BASH_SOURCE_CURDIR=y
CONFIG_ASH_COMMAND_NOT_FOUND_HOOK=y
# CONFIG_CTTYHACK is not set
# CONFIG_HUSH is not set
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment