aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* win32: unify 'convert and write to console' (no-op)Avi Halachmi (:avih)2023-08-031-17/+44
| | | | | | | | Use one call to do both charToCon and then write it to the console. Technically, this commit only reduces boilerplate code slightly, but it also makes it easier for future modifications to make changes to this sequence in one place.
* win32: fail early if UTF8 isn't supportedRon Yorston2023-07-273-31/+50
| | | | | | | | | When the UTF8 manifest is included in the binary and ACP isn't UTF8 fail at once. This avoids raising false hopes if the binary is run on Window 7/8. On Windows XP it won't even run. When the busybox applet is run without arguments always report the build-time configuration of globbing and the UTF8 manifest.
* Add Unicode version to prerelease buildRon Yorston2023-07-252-1/+1250
|
* Merge pull request #346 from avih/win32-unicode-versionRon Yorston2023-07-251-0/+4
|\ | | | | win32: version with UTF8 manifest: add '(Unicode on/off)'
| * win32: version with UTF8 manifest: add '(Unicode on/off)'Avi Halachmi (:avih)2023-07-241-0/+4
|/ | | | | | When the UTF8 manifest is enabled at build time, then the version now includes a string indicating whether unicode is active (e.g. it's inactive on win 7/8, but should be active on Win10 1903+).
* Merge pull request #340 from avih/win32-unicode-editingRon Yorston2023-07-237-12/+160
|\ | | | | Win32: support unicode editing
| * unicode: identify emoji width and modifiersAvi Halachmi (:avih)2023-07-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | This adds the Emoticons block U+1F600..U+1F64F as double-width codepoints, and the skin tone modifiers range U+1F3FB..U+1F3FF as combining codepoints. The Emoticons variant modifiers U+FE0E and U+FE0F were already in. It's unclear how to test UNICODE_COMBINING_WCHARS and UNICODE_WIDE_WCHARS in general and also here specifically, but at least the data on Emojis width and combinings now exits.
| * win32: use inc_cursor regardless of VT modeAvi Halachmi (:avih)2023-07-231-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | Commit 8ade494 added VT input support and, among others, disabled inc_cursor (in favor of the upstream busybox code) when the terminal has VT input enabled. However, inc_cursor works correctly regardless of the VT mode, and that condition was not required. Revert this condition (but still disable inc_cursor with unicode because it handles wide-glyphs incorrectly).
| * win32: add script to create mingw unicode configAvi Halachmi (:avih)2023-07-221-0/+35
| | | | | | | | | | | | Run ./scripts/mk_mingw64u_defconfig to create (or update) configs/mingw64u_defconfig from configs/mingw64_defconfig while enabling UTF8 manifest, UTF8 input, and unicode editing.
| * win32: support build with FEATURE_UNICODE_SUPPORTAvi Halachmi (:avih)2023-07-225-1/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FEATURE_UTF8_MANIFEST enables Unicode args and filenames on Win 10+. FEATURE_UTF8_INPUT allows the shell prompt to digest correctly Unicode strings (as UTF8) which are typed or pasted. This commit adds support for building with FEATURE_UNICODE_SUPPORT (mostly by supporting 32 bit wchar_t which busybox expects): - Unicode-aware line-edit - for the most part cursor movement/del being (UTF8) codepoint-aware rather than assuming that one-byte equals one-char-on-screen. - Codepoint-aware operations in some other utils, like rev or wc -c. - When UNICODE_COMBINING_WCHARS and UNICODE_WIDE_WCHARS are enabled, some screen-width-aware operations, like with fold, ls, expand, etc. The busybox Unicode support is incomplete, and even less so with the builtin libc replacement functions, like wcwidth, which are active when UNICODE_USING_LOCALE is unset (mingw lacks those functions). FEATURE_CHECK_UNICODE_IN_ENV should be set so that Unicode is not hardcoded but rather depends on the ANSI codepage and some env vars: LC_ALL=C disables Unicode support, else it's enabled if ACP is UTF8. There's at least one known issue where the tab-completion-prefix-case is not updated correctly, e.g. ~/desk<tab> completes to ~/desktop/ instead of ~/Desktop/, because the code which handles it exists only at the non-unicode code paths, but that's not very critical. That seems to be the only case where mingw-specific code is disabled when Unicode is enabled, but there could be other unknown issues. None of the Unicode options is enabled by default, and the next commit will make it easier to create a build which supports Unicode.
| * win32: UTF8 input: improve missing-key-down hackAvi Halachmi (:avih)2023-07-211-11/+47
|/ | | | | | | | | | | | | | The UTF8 input code works around an issue when pasting at the windows console (but not terminal) that sometimes we get key-up without a prior matching key-down - at which case it generates down. However, previously it detected this by comparing an up-event to the last down-event, which could result in false-positive in cases like: X-down Y-down X-up Y-up (e.g. when typing quickly). Now it remembers the last 8 key-down events when searching a prior matching key-down, which fixes an issue of incorrect repeated keys (in the example above Y-up was incorrectly changed to Y-down).
* win32: avoid crashing the console with poll(2)Ron Yorston2023-07-171-1/+1
| | | | | | | | | | | | | | | Commit 8e6991733 (ash: fix 'read' shell built-in (1)) introduced the use of poll(2) in the shell 'read' built-in. When the UTF8 code page is in use this results in the console crashing if a 3 or more byte UTF8 character is entered. The crash is caused by the use of PeekConsoleInputA() which, like ReadConsoleInputA(), is broken. It can be avoided by using PeekConsoleInputW() instead. The number of key events will differ but this doesn't matter in this case as poll(2) effectively runs in a busy loop with a 1ms sleep.
* date: allow system date to be setRon Yorston2023-07-163-25/+24
| | | | | | | | | Implement clock_settime(2) and enable the '-s' option to allow the system time to be set. This requires elevated privileges. The code in date.c is now identical to upstream BusyBox. Costs 256-272 bytes.
* Update default configurationsRon Yorston2023-07-164-10/+18
|
* Merge branch 'busybox' into mergeRon Yorston2023-07-13362-867/+1501
|\
| * hwclock: add get/set parameters optionAndrej Picej2023-07-122-5/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In kernel 5.16 special ioctls were introduced to get/set RTC parameters. Add option to get/set parameters into busybox version of hwclock. Implementation is similar to the one already used in linux-utils hwclock tool. Example of parameter get use: $ hwclock -g 2 The RTC parameter 0x2 is set to 0x2. $ hwclock --param-get bsm The RTC parameter 0x2 is set to 0x2. Example of parameter set use: $ hwclock -p 2=1 The RTC parameter 0x2 will be set to 0x1. $ hwclock -p bsm=2 The RTC parameter 0x2 will be set to 0x2. function old new delta hwclock_main 298 576 +278 .rodata 105231 105400 +169 packed_usage 34541 34576 +35 static.hwclock_longopts 60 84 +24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 506/0) Total: 506 bytes Signed-off-by: Andrej Picej <andrej.picej@norik.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ntpd: fix a warning on 32-bit arch buildDenys Vlasenko2023-07-101-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * i2ctransfer: fix build warningDenys Vlasenko2023-07-101-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Update applet size estimatesDenys Vlasenko2023-07-10265-320/+320
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: tweak comments, no code changesDenys Vlasenko2023-07-101-6/+7
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: remove "volatile" specifier from suppress_intDenys Vlasenko2023-07-101-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta aliascmd 274 278 +4 signal_handler 81 80 -1 static.redirectsafe 144 141 -3 unwindlocalvars 219 215 -4 trapcmd 333 329 -4 setvar 164 160 -4 setpwd 167 163 -4 setinputfile 216 212 -4 setcmd 76 72 -4 readcmd 221 217 -4 raise_exception 26 22 -4 out2str 37 33 -4 out1str 32 28 -4 freejob 89 85 -4 forkchild 616 612 -4 fg_bgcmd 298 294 -4 expandarg 949 945 -4 evaltree 753 749 -4 evalsubshell 173 169 -4 evalpipe 346 342 -4 evalfun 408 404 -4 cdcmd 699 695 -4 ash_main 1240 1236 -4 __pgetc 589 585 -4 unaliascmd 152 147 -5 unalias 51 46 -5 umaskcmd 253 248 -5 stalloc 97 92 -5 shiftcmd 144 139 -5 setinputstring 73 68 -5 redirect 1068 1063 -5 recordregion 81 76 -5 pushstring 160 155 -5 popstring 120 115 -5 popstackmark 69 64 -5 popredir 123 118 -5 popfile 110 105 -5 out1fmt 45 40 -5 newline_and_flush 39 34 -5 ifsfree 66 61 -5 growstackblock 146 141 -5 freestrings 95 90 -5 fmtstr 59 54 -5 flush_stdout_stderr 23 18 -5 dowait 577 572 -5 delete_cmd_entry 52 47 -5 clearcmdentry 98 93 -5 ash_arith 79 74 -5 argstr 1404 1399 -5 evalcommand 1523 1515 -8 removerecordregions 219 209 -10 mklocal 284 274 -10 find_command 893 883 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/52 up/down: 4/-251) Total: -247 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: disable sleep as builtin, closes 15619Denys Vlasenko2023-07-102-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Has a few annoying problems: * sleepcmd() -> sleep_main(), the parsing of bad arguments exits the shell. * sleep_for_duration() in sleep_main() has to be interruptible for ^C traps to work, which may be a problem for other users of sleep_for_duration(). * BUT, if sleep_for_duration() is interruptible, then SIGCHLD interrupts it as well (try "/bin/sleep 1 & sleep 10"). * sleep_main() must not allocate anything as ^C in ash longjmp's. (currently, allocations are only on error paths, in message printing). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libiproute: fix filtering ip6 route by table idYousong Zhou2023-07-091-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise - "ip -6 route show" shows routes from all tables - "ip -6 route show table 200" shows nothing function old new delta print_route 1962 1941 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-21) Total: -21 bytes Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: fix a compile failureDenys Vlasenko2023-07-081-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: disable check for "good" function name, bash does not check thisDenys Vlasenko2023-07-043-11/+17
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 105304 105261 -43 parse_command 1696 1633 -63 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-106) Total: -106 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: quote values in "readonly" outputDenys Vlasenko2023-07-031-4/+11
| | | | | | | | | | | | | | | | | | | | | | function old new delta builtin_readonly 61 107 +46 builtin_export 140 145 +5 .rodata 105321 105304 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 51/-17) Total: 34 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: avoid $((3**999999999999999999)) to take yearsDenys Vlasenko2023-07-021-3/+14
| | | | | | | | | | | | | | function old new delta arith_apply 991 1030 +39 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: do not accept $((36#@))Denys Vlasenko2023-07-021-16/+22
| | | | | | | | | | | | | | | | | | | | function old new delta parse_with_base 170 174 +4 arith_apply 996 991 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-5) Total: -1 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: code shrinkDenys Vlasenko2023-06-301-4/+7
| | | | | | | | | | | | | | | | | | | | function old new delta arith_apply 999 996 -3 evaluate_string 1295 1291 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-7) Total: -7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: code shrinkDenys Vlasenko2023-06-291-11/+13
| | | | | | | | | | | | | | function old new delta arith_apply 1023 996 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: code shrinkDenys Vlasenko2023-06-281-8/+10
| | | | | | | | | | | | | | | | | | | | | | function old new delta arith_apply 1015 1023 +8 evaluate_string 1309 1295 -14 .rodata 105344 105321 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 8/-37) Total: -29 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: improve commentsDenys Vlasenko2023-06-261-2/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: rename TOK_NUM to TOK_VALUE, improve commentsDenys Vlasenko2023-06-261-24/+25
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: bash-compatible handling of too large numbersDenys Vlasenko2023-06-259-44/+118
| | | | | | | | | | | | | | | | | | | | function old new delta parse_with_base - 170 +170 evaluate_string 1477 1309 -168 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 170/-168) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: disable debug againDenys Vlasenko2023-06-191-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: $((1?)) has one-too-small opstack, fix thisDenys Vlasenko2023-06-191-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: fix comments about jammed-together num+num corner casesDenys Vlasenko2023-06-191-8/+16
| | | | | | | | | | | | | | function old new delta evaluate_string 1478 1470 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: add note on ERANGEDenys Vlasenko2023-06-181-4/+11
| | | | | | | | | | | | | | function old new delta evaluate_string 1488 1478 -10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: explain why we use separate &endDenys Vlasenko2023-06-181-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: code shrinkDenys Vlasenko2023-06-181-2/+5
| | | | | | | | | | | | | | function old new delta evaluate_string 1498 1491 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: eliminate redundant endofname()Denys Vlasenko2023-06-181-8/+8
| | | | | | | | | | | | | | function old new delta evaluate_string 1486 1498 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: typo fix in testsDenys Vlasenko2023-06-182-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: code shrinkDenys Vlasenko2023-06-181-11/+12
| | | | | | | | | | | | | | function old new delta evaluate_string 1489 1486 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: decrease stack usage by not allocating copies of variable namesDenys Vlasenko2023-06-181-32/+51
| | | | | | | | | | | | | | | | | | | | | | | | We risk exhaust stack with alloca() with old code. function old new delta arith_apply 990 1023 +33 evaluate_string 1467 1494 +27 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 60/0) Total: 60 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: decrease stack usageDenys Vlasenko2023-06-181-35/+27
| | | | | | | | | | | | | | function old new delta evaluate_string 1412 1467 +55 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: move varcmp() to shell_common.h and use it in hushDenys Vlasenko2023-06-174-50/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta unset_local_var - 112 +112 findvar 31 35 +4 set_vars_and_save_old 144 141 -3 helper_export_local 235 230 -5 set_local_var 425 416 -9 handle_changed_special_names 38 27 -11 builtin_unset 154 141 -13 builtin_getopts 404 391 -13 get_local_var_value 281 260 -21 get_ptr_to_local_var 71 45 -26 unset_local_var_len 139 - -139 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/8 up/down: 116/-240) Total: -124 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: code shrinkDenys Vlasenko2023-06-171-1/+1
| | | | | | | | | | | | | | function old new delta setvar 166 164 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/read: do not allow empty variable nameDenys Vlasenko2023-06-171-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: eliminate some redundant stores on return code pathDenys Vlasenko2023-06-171-20/+23
| | | | | | | | | | | | | | function old new delta evaluate_string 1432 1412 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: change ?: nesting code to not have 63 level nesting limitationDenys Vlasenko2023-06-172-14/+21
| | | | | | | | | | | | | | | | | | | | | | function old new delta evaluate_string 1406 1432 +26 arith 36 29 -7 arith_apply 998 990 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 26/-15) Total: 11 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>