aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2017-10-20 05:55:08 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2017-10-20 05:55:51 +0000
commitdcad9af52a05da2ee6f3b12bcbb23c225b95417a (patch)
tree4e64dab8df9bf880e05cb2d322e6767b4c333e41 /main/busybox
parent30e67c63dba1de11cfe9a7af61304af3e00a3eff (diff)
downloadaports-dcad9af52a05da2ee6f3b12bcbb23c225b95417a.tar.bz2
aports-dcad9af52a05da2ee6f3b12bcbb23c225b95417a.tar.xz
main/busybox: ash: add support for bash-style command_not_found_handle hook function
This implements support for the command_not_found_handle hook function, which is useful for allowing package managers to suggest packages which could provide the command. Unlike bash, however, we ignore exit codes from the hook function and always return the correct POSIX error code (EX_NOTFOUND).
Diffstat (limited to 'main/busybox')
-rw-r--r--main/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch63
-rw-r--r--main/busybox/APKBUILD5
-rw-r--r--main/busybox/busyboxconfig7
3 files changed, 71 insertions, 4 deletions
diff --git a/main/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch b/main/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
new file mode 100644
index 0000000000..e4ba6ece5b
--- /dev/null
+++ b/main/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
@@ -0,0 +1,63 @@
+From f76c1ddd625b3d9912d9e6df2e90fcb94d08be99 Mon Sep 17 00:00:00 2001
+From: William Pitcock <nenolod@dereferenced.org>
+Date: Thu, 19 Oct 2017 17:24:40 +0000
+Subject: [PATCH] ash: add support for command_not_found_handle hook function,
+ like bash
+
+This implements support for the command_not_found_handle hook function, which is
+useful for allowing package managers to suggest packages which could provide the
+command.
+
+Unlike bash, however, we ignore exit codes from the hook function and always return
+the correct POSIX error code (EX_NOTFOUND).
+
+Signed-off-by: William Pitcock <nenolod@dereferenced.org>
+---
+ shell/ash.c | 24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/shell/ash.c b/shell/ash.c
+index 88e607f08..c3c4f4e93 100644
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -132,6 +132,15 @@
+ //config: you to run the specified command or builtin,
+ //config: even when there is a function with the same name.
+ //config:
++//config:config ASH_COMMAND_NOT_FOUND_HOOK
++//config: bool "command_not_found_handle hook support"
++//config: default y
++//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
++//config: help
++//config: Enable support for the 'command_not_found_handle' hook function,
++//config: from GNU bash, which allows for alternative command not found
++//config: handling.
++//config:
+ //config:endif # ash options
+
+ //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
+@@ -13123,8 +13132,19 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
+ /* We failed. If there was an entry for this command, delete it */
+ if (cmdp && updatetbl)
+ delete_cmd_entry();
+- if (act & DO_ERR)
+- ash_msg("%s: %s", name, errmsg(e, "not found"));
++ if (act & DO_ERR) {
++#ifdef CONFIG_ASH_COMMAND_NOT_FOUND_HOOK
++#define HOOKFN_NAME "command_not_found_handle"
++ char hookfn_name[] = HOOKFN_NAME;
++ struct tblentry *hookp = cmdlookup(hookfn_name, 0);
++ if (hookp != NULL && hookp->cmdtype == CMDFUNCTION) {
++ evalfun(hookp->param.func, 2, (char *[]){ hookfn_name, name }, 0);
++ entry->cmdtype = CMDUNKNOWN;
++ return;
++ } else
++#endif
++ ash_msg("%s: %s", name, errmsg(e, "not found"));
++ }
+ entry->cmdtype = CMDUNKNOWN;
+ return;
+
+--
+2.14.2
+
diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD
index 517311ab27..1967380e29 100644
--- a/main/busybox/APKBUILD
+++ b/main/busybox/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.27.2
-pkgrel=1
+pkgrel=2
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
@@ -19,6 +19,8 @@ subpackages="$pkgname-static $pkgname-suid $pkgname-extras"
options="suid !check"
triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
+ 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
+
0001-ash-exec-busybox.static.patch
0002-app-location-for-cpio-vi-and-lspci.patch
0003-udhcpc-set-default-discover-retries-to-5.patch
@@ -170,6 +172,7 @@ static() {
}
sha512sums="d99e86b652562ebe1a5d50e1ba3877a1d1612997c17cb8d8e4212da181211a9b741a881cb051f14cb3ee8aea40226cf2cde80a076baed265d3bc0a4e96a5031c busybox-1.27.2.tar.bz2
+dc08288c8e9e29d36be7174d58f3bee2d0508465977fb40d39807aa0b03149f7814f8cfed113d0a7589ef49890beb1805ef00f0d37b563447fe875e3cff08d1c 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
1930775839354a63c30970f0d52d00cfd3a8f6b9f48d6de45ea7d2478d080bde7193c1c2cce026dc7337d9ecf0b65f5ff1dd4351c1eb195e6f0c0c5126f10511 0001-ash-exec-busybox.static.patch
a756aa89c4602cd091df0052e2e3d7b45a359fbfe953b70aa3029e3eeb8e5d1772cbf1525bb62df6ce6547f1e5605617195ddae336e1ffe41f5c58d524af6ba6 0002-app-location-for-cpio-vi-and-lspci.patch
fc17ce9b12726e3449518692bf0d4906c36f091534706b5b91c910866bd8cd50d8f7d4b449d54eeed24ee656012a6ef04612bf092874e4b83b0723f852fdce0e 0003-udhcpc-set-default-discover-retries-to-5.patch
diff --git a/main/busybox/busyboxconfig b/main/busybox/busyboxconfig
index cd3d6e53d4..650bc3dad3 100644
--- a/main/busybox/busyboxconfig
+++ b/main/busybox/busyboxconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Busybox version: 1.27.0
-# Thu Jul 6 14:03:45 2017
+# Busybox version: 1.27.2
+# Fri Oct 20 05:53:24 2017
#
CONFIG_HAVE_DOT_CONFIG=y
@@ -10,6 +10,7 @@ CONFIG_HAVE_DOT_CONFIG=y
#
CONFIG_DESKTOP=y
# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_FEDORA_COMPAT is not set
# CONFIG_INCLUDE_SUSv2 is not set
# CONFIG_USE_PORTABLE_CODE is not set
CONFIG_SHOW_USAGE=y
@@ -51,7 +52,6 @@ CONFIG_SYSROOT=""
CONFIG_EXTRA_CFLAGS=""
CONFIG_EXTRA_LDFLAGS=""
CONFIG_EXTRA_LDLIBS=""
-CONFIG_FEDORA_COMPAT=n
#
# Installation Options ("make install" behavior)
@@ -1071,6 +1071,7 @@ CONFIG_ASH_TEST=y
CONFIG_ASH_HELP=y
CONFIG_ASH_GETOPTS=y
CONFIG_ASH_CMDCMD=y
+CONFIG_ASH_COMMAND_NOT_FOUND_HOOK=y
# CONFIG_CTTYHACK is not set
# CONFIG_HUSH is not set
# CONFIG_HUSH_BASH_COMPAT is not set