diff options
author | Ron Yorston <rmy@pobox.com> | 2023-03-23 11:29:34 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-03-23 11:29:34 +0000 |
commit | f491e57d1ce04ec8124b9605268e5ecd3b1fb489 (patch) | |
tree | 9b1c096fe44b8f52f26920b583a7d50e0afde785 | |
parent | 138e956a2e34d1b708366b6286687766a7176341 (diff) | |
download | busybox-w32-f491e57d1ce04ec8124b9605268e5ecd3b1fb489.tar.gz busybox-w32-f491e57d1ce04ec8124b9605268e5ecd3b1fb489.tar.bz2 busybox-w32-f491e57d1ce04ec8124b9605268e5ecd3b1fb489.zip |
drop: cdrop and pdrop don't need shell
The cdrop and pdrop variants don't require the binary to include
a shell. Removing this dependency makes it possible to build
cdrop/pdrop as a much smaller standalone binaries.
Update the default configuration to build a standalone make binary
to exclude drop/cdrop/pdrop.
-rw-r--r-- | configs/make32_defconfig | 12 | ||||
-rw-r--r-- | configs/make64_defconfig | 12 | ||||
-rw-r--r-- | miscutils/drop.c | 26 |
3 files changed, 38 insertions, 12 deletions
diff --git a/configs/make32_defconfig b/configs/make32_defconfig index 2c5c15ba9..354c2eb87 100644 --- a/configs/make32_defconfig +++ b/configs/make32_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Busybox version: 1.36.0.git | 3 | # Busybox version: 1.37.0.git |
4 | # Thu Nov 10 11:18:15 2022 | 4 | # Thu Mar 23 11:11:07 2023 |
5 | # | 5 | # |
6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
7 | # CONFIG_PLATFORM_POSIX is not set | 7 | # CONFIG_PLATFORM_POSIX is not set |
@@ -145,6 +145,9 @@ CONFIG_LAST_SUPPORTED_WCHAR=0 | |||
145 | # CONFIG_UNICODE_BIDI_SUPPORT is not set | 145 | # CONFIG_UNICODE_BIDI_SUPPORT is not set |
146 | # CONFIG_UNICODE_NEUTRAL_TABLE is not set | 146 | # CONFIG_UNICODE_NEUTRAL_TABLE is not set |
147 | # CONFIG_UNICODE_PRESERVE_BROKEN is not set | 147 | # CONFIG_UNICODE_PRESERVE_BROKEN is not set |
148 | # CONFIG_LOOP_CONFIGURE is not set | ||
149 | # CONFIG_NO_LOOP_CONFIGURE is not set | ||
150 | CONFIG_TRY_LOOP_CONFIGURE=y | ||
148 | 151 | ||
149 | # | 152 | # |
150 | # Applets | 153 | # Applets |
@@ -784,6 +787,9 @@ CONFIG_FEATURE_CROND_DIR="" | |||
784 | # CONFIG_DEVFSD_VERBOSE is not set | 787 | # CONFIG_DEVFSD_VERBOSE is not set |
785 | # CONFIG_FEATURE_DEVFS is not set | 788 | # CONFIG_FEATURE_DEVFS is not set |
786 | # CONFIG_DEVMEM is not set | 789 | # CONFIG_DEVMEM is not set |
790 | # CONFIG_DROP is not set | ||
791 | # CONFIG_CDROP is not set | ||
792 | # CONFIG_PDROP is not set | ||
787 | # CONFIG_FBSPLASH is not set | 793 | # CONFIG_FBSPLASH is not set |
788 | # CONFIG_FLASH_ERASEALL is not set | 794 | # CONFIG_FLASH_ERASEALL is not set |
789 | # CONFIG_FLASH_LOCK is not set | 795 | # CONFIG_FLASH_LOCK is not set |
@@ -1015,6 +1021,7 @@ CONFIG_DHCPD_LEASES_FILE="" | |||
1015 | # CONFIG_FEATURE_UDHCPC_ARPING is not set | 1021 | # CONFIG_FEATURE_UDHCPC_ARPING is not set |
1016 | # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set | 1022 | # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set |
1017 | CONFIG_UDHCPC_DEFAULT_SCRIPT="" | 1023 | CONFIG_UDHCPC_DEFAULT_SCRIPT="" |
1024 | CONFIG_UDHCPC6_DEFAULT_SCRIPT="" | ||
1018 | # CONFIG_UDHCPC6 is not set | 1025 | # CONFIG_UDHCPC6 is not set |
1019 | # CONFIG_FEATURE_UDHCPC6_RFC3646 is not set | 1026 | # CONFIG_FEATURE_UDHCPC6_RFC3646 is not set |
1020 | # CONFIG_FEATURE_UDHCPC6_RFC4704 is not set | 1027 | # CONFIG_FEATURE_UDHCPC6_RFC4704 is not set |
@@ -1151,6 +1158,7 @@ CONFIG_ASH_GETOPTS=y | |||
1151 | CONFIG_ASH_CMDCMD=y | 1158 | CONFIG_ASH_CMDCMD=y |
1152 | CONFIG_ASH_NOCONSOLE=y | 1159 | CONFIG_ASH_NOCONSOLE=y |
1153 | CONFIG_ASH_NOCASEGLOB=y | 1160 | CONFIG_ASH_NOCASEGLOB=y |
1161 | CONFIG_ASH_IGNORE_CR=y | ||
1154 | # CONFIG_CTTYHACK is not set | 1162 | # CONFIG_CTTYHACK is not set |
1155 | # CONFIG_HUSH is not set | 1163 | # CONFIG_HUSH is not set |
1156 | # CONFIG_SHELL_HUSH is not set | 1164 | # CONFIG_SHELL_HUSH is not set |
diff --git a/configs/make64_defconfig b/configs/make64_defconfig index 5fa5c4ebc..6564603c8 100644 --- a/configs/make64_defconfig +++ b/configs/make64_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Busybox version: 1.36.0.git | 3 | # Busybox version: 1.37.0.git |
4 | # Thu Nov 10 11:18:15 2022 | 4 | # Thu Mar 23 11:13:36 2023 |
5 | # | 5 | # |
6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
7 | # CONFIG_PLATFORM_POSIX is not set | 7 | # CONFIG_PLATFORM_POSIX is not set |
@@ -145,6 +145,9 @@ CONFIG_LAST_SUPPORTED_WCHAR=0 | |||
145 | # CONFIG_UNICODE_BIDI_SUPPORT is not set | 145 | # CONFIG_UNICODE_BIDI_SUPPORT is not set |
146 | # CONFIG_UNICODE_NEUTRAL_TABLE is not set | 146 | # CONFIG_UNICODE_NEUTRAL_TABLE is not set |
147 | # CONFIG_UNICODE_PRESERVE_BROKEN is not set | 147 | # CONFIG_UNICODE_PRESERVE_BROKEN is not set |
148 | # CONFIG_LOOP_CONFIGURE is not set | ||
149 | # CONFIG_NO_LOOP_CONFIGURE is not set | ||
150 | CONFIG_TRY_LOOP_CONFIGURE=y | ||
148 | 151 | ||
149 | # | 152 | # |
150 | # Applets | 153 | # Applets |
@@ -784,6 +787,9 @@ CONFIG_FEATURE_CROND_DIR="" | |||
784 | # CONFIG_DEVFSD_VERBOSE is not set | 787 | # CONFIG_DEVFSD_VERBOSE is not set |
785 | # CONFIG_FEATURE_DEVFS is not set | 788 | # CONFIG_FEATURE_DEVFS is not set |
786 | # CONFIG_DEVMEM is not set | 789 | # CONFIG_DEVMEM is not set |
790 | # CONFIG_DROP is not set | ||
791 | # CONFIG_CDROP is not set | ||
792 | # CONFIG_PDROP is not set | ||
787 | # CONFIG_FBSPLASH is not set | 793 | # CONFIG_FBSPLASH is not set |
788 | # CONFIG_FLASH_ERASEALL is not set | 794 | # CONFIG_FLASH_ERASEALL is not set |
789 | # CONFIG_FLASH_LOCK is not set | 795 | # CONFIG_FLASH_LOCK is not set |
@@ -1015,6 +1021,7 @@ CONFIG_DHCPD_LEASES_FILE="" | |||
1015 | # CONFIG_FEATURE_UDHCPC_ARPING is not set | 1021 | # CONFIG_FEATURE_UDHCPC_ARPING is not set |
1016 | # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set | 1022 | # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set |
1017 | CONFIG_UDHCPC_DEFAULT_SCRIPT="" | 1023 | CONFIG_UDHCPC_DEFAULT_SCRIPT="" |
1024 | CONFIG_UDHCPC6_DEFAULT_SCRIPT="" | ||
1018 | # CONFIG_UDHCPC6 is not set | 1025 | # CONFIG_UDHCPC6 is not set |
1019 | # CONFIG_FEATURE_UDHCPC6_RFC3646 is not set | 1026 | # CONFIG_FEATURE_UDHCPC6_RFC3646 is not set |
1020 | # CONFIG_FEATURE_UDHCPC6_RFC4704 is not set | 1027 | # CONFIG_FEATURE_UDHCPC6_RFC4704 is not set |
@@ -1151,6 +1158,7 @@ CONFIG_ASH_GETOPTS=y | |||
1151 | CONFIG_ASH_CMDCMD=y | 1158 | CONFIG_ASH_CMDCMD=y |
1152 | CONFIG_ASH_NOCONSOLE=y | 1159 | CONFIG_ASH_NOCONSOLE=y |
1153 | CONFIG_ASH_NOCASEGLOB=y | 1160 | CONFIG_ASH_NOCASEGLOB=y |
1161 | CONFIG_ASH_IGNORE_CR=y | ||
1154 | # CONFIG_CTTYHACK is not set | 1162 | # CONFIG_CTTYHACK is not set |
1155 | # CONFIG_HUSH is not set | 1163 | # CONFIG_HUSH is not set |
1156 | # CONFIG_SHELL_HUSH is not set | 1164 | # CONFIG_SHELL_HUSH is not set |
diff --git a/miscutils/drop.c b/miscutils/drop.c index 9ebee3f04..6effc1831 100644 --- a/miscutils/drop.c +++ b/miscutils/drop.c | |||
@@ -16,14 +16,14 @@ | |||
16 | //config:config CDROP | 16 | //config:config CDROP |
17 | //config: bool "cdrop" | 17 | //config: bool "cdrop" |
18 | //config: default y | 18 | //config: default y |
19 | //config: depends on PLATFORM_MINGW32 && SH_IS_ASH | 19 | //config: depends on PLATFORM_MINGW32 |
20 | //config: help | 20 | //config: help |
21 | //config: Run a command without elevated privileges using cmd.exe | 21 | //config: Run a command without elevated privileges using cmd.exe |
22 | 22 | ||
23 | //config:config PDROP | 23 | //config:config PDROP |
24 | //config: bool "pdrop" | 24 | //config: bool "pdrop" |
25 | //config: default y | 25 | //config: default y |
26 | //config: depends on PLATFORM_MINGW32 && SH_IS_ASH | 26 | //config: depends on PLATFORM_MINGW32 |
27 | //config: help | 27 | //config: help |
28 | //config: Run a command without elevated privileges using PowerShell | 28 | //config: Run a command without elevated privileges using PowerShell |
29 | 29 | ||
@@ -56,6 +56,7 @@ | |||
56 | #include "libbb.h" | 56 | #include "libbb.h" |
57 | #include <winsafer.h> | 57 | #include <winsafer.h> |
58 | #include <lazyload.h> | 58 | #include <lazyload.h> |
59 | #include "NUM_APPLETS.h" | ||
59 | 60 | ||
60 | int drop_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 61 | int drop_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
61 | int drop_main(int argc, char **argv) | 62 | int drop_main(int argc, char **argv) |
@@ -101,26 +102,35 @@ int drop_main(int argc, char **argv) | |||
101 | 102 | ||
102 | if (argc == 1 || strcmp(argv[1], "-c") == 0 | 103 | if (argc == 1 || strcmp(argv[1], "-c") == 0 |
103 | IF_CDROP(|| strcmp(argv[1], "/c") == 0)) { | 104 | IF_CDROP(|| strcmp(argv[1], "/c") == 0)) { |
105 | switch (*applet_name) { | ||
104 | #if ENABLE_PDROP | 106 | #if ENABLE_PDROP |
105 | if (*applet_name == 'p') { | 107 | case 'p': |
106 | arg = "powershell.exe"; | 108 | arg = "powershell.exe"; |
107 | exe = find_first_executable(arg); | 109 | exe = find_first_executable(arg); |
108 | } else | 110 | break; |
109 | #endif | 111 | #endif |
110 | #if ENABLE_CDROP | 112 | #if ENABLE_CDROP |
111 | if (*applet_name == 'c') { | 113 | case 'c': |
112 | arg = "cmd.exe"; | 114 | arg = "cmd.exe"; |
113 | exe = find_first_executable(arg); | 115 | exe = find_first_executable(arg); |
114 | } else | 116 | break; |
115 | #endif | 117 | #endif |
116 | { | 118 | #if ENABLE_DROP |
119 | case 'd': | ||
117 | arg = "sh"; | 120 | arg = "sh"; |
118 | exe = xstrdup(bb_busybox_exec_path); | 121 | exe = xstrdup(bb_busybox_exec_path); |
122 | break; | ||
123 | #endif | ||
124 | default: | ||
125 | // Never executed, just to silence warnings. | ||
126 | arg = argv[0]; | ||
127 | exe = NULL; | ||
128 | break; | ||
119 | } | 129 | } |
120 | } else { | 130 | } else { |
121 | arg = *a++; | 131 | arg = *a++; |
122 | 132 | ||
123 | #if ENABLE_FEATURE_PREFER_APPLETS | 133 | #if ENABLE_FEATURE_PREFER_APPLETS && NUM_APPLETS > 1 |
124 | if (!has_path(arg) && find_applet_by_name(arg) >= 0) { | 134 | if (!has_path(arg) && find_applet_by_name(arg) >= 0) { |
125 | exe = xstrdup(bb_busybox_exec_path); | 135 | exe = xstrdup(bb_busybox_exec_path); |
126 | } else | 136 | } else |