aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* win32: use open_read_close() where possibleRon Yorston2018-12-092-12/+4
|
* lineedit: more case-insensitive comparisons in tab completionRon Yorston2018-12-083-0/+27
|
* lineedit: improvements to tab completionRon Yorston2018-12-085-12/+26
| | | | | | | | | | Since getpwent isn't implemented for WIN32 there's no point in enabling FEATURE_USERNAME_COMPLETION. Use case-insensitive comparisons when matching filenames. The code to exclude non-executables when tab completing executables is WIN32-specific and shouldn't omit directories.
* win32: allow execution of empty batch file to succeedRon Yorston2018-12-081-0/+8
| | | | | | | Microsoft Windows' spawnve returns ERROR_BAD_EXE_FORMAT when passed an empty batch file. Work around this by skipping spawnve and returning success.
* win32: (another) fix to file extension testRon Yorston2018-12-071-1/+1
| | | | | | | It turns out '.bat' is a valid batch file name. Reduce the permitted length for filenames to allow for this. Also, actually *use* the file basename in the test this time.
* win32: fix to file extension testRon Yorston2018-12-071-2/+3
| | | | | | | When looking for the special WIN32 file extensions only consider the file's basename, not the full path. Otherwise a file called '.bat', for example, is considered executable by 'ls -a' and the shell tries to run './.bat'.
* win32: improve execution of batch filesRon Yorston2018-12-071-26/+8
| | | | | | | | | It appears that when a batch file is executed the first argument must contain backslashes if it's a relative path. Absolute paths work either way. In both cases the extension is optional. This allows for a considerable simplification of the special case in spawnveq.
* win32: rework adding of extensions to filenamesRon Yorston2018-12-066-98/+64
| | | | | | | | | | | | | | | | | | | | | | | Previously there was one function to handle adding extensions to executable filenames, add_win32_extension(). Refactor this into three functions: add_win32_extension() appends the suffix to the argument string in-place. The argument must be long enough to cope with this, as is the case in ash where path_advance() adds 4 bytes to each filename for just this reason. alloc_win32_extension() is equivalent to the old add_win32_extension(). It allocates a string to hold the new filename then calls the new add_win32_extension() function. The caller is responsible for managing the returned string. auto_win32_extension() calls alloc_win32_extension() and saves the resulting string using auto_string(). It's used where the new filename is consumed immediately or the actual value isn't needed. Rewrite code to use the most appropriate function. Also reorder some code in find_executable() and find_command().
* ash: fix 'type' and 'command -v'Ron Yorston2018-12-051-1/+1
| | | | | | | | | | | | | | The 'type' and 'command -v' builtins could return incorrect information when their argument included a file separator. For example: $ command -v cmd C:/Windows/system32/cmd.exe $ command -v C:/Windows/system32/cmd.exe $ echo $? 127 Fix the faulty logic causing this.
* Merge branch 'busybox' into mergeRon Yorston2018-12-057-30/+58
|\
| * vi: correctly detect when a deletion empties the bufferRon Yorston2018-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Michał Berger has reported two issues: - Repeatedly deleting and undoing the deletion of the last line results in characters being lost from the end of the line. - Deleting the bottom line twice then attempting to undo each of these deletions results in a segfault. The problem seems to be an incorrect test for whether the text buffer is empty. Reported-by: Michał Berger <michallinuxstuff@gmail.com> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * vi: code shrinkDenys Vlasenko2018-11-291-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta char_search 241 247 +6 get_one_address 275 272 -3 colon 2878 2875 -3 do_cmd 4726 4720 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 6/-12) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * vi: fix FEATURE_VI_REGEX_SEARCH to respect LIMITED (one-line) searchDenys Vlasenko2018-11-291-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If busybox is compiled with FEATURE_VI_REGEX_SEARCH enabled, command ":s/x/y/" searches not only in the current line, but continues search after it. This makes range searches (":1,3s/x/y/") work incorrect. For example file "./test": 1 2 3 $ vi ./test :1,2s/3/e/ gives us: 1 2 e function old new delta char_search 213 241 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: do not misinterpret 0x10-0x19 chars in "\xNNN" tooDenys Vlasenko2018-11-291-6/+4
| | | | | | | | | | | | | | function old new delta bb_process_escape_sequence 141 151 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: @ in "\x3@" is not a valid hex digitDenys Vlasenko2018-11-291-2/+10
| | | | | | | | | | | | | | function old new delta bb_process_escape_sequence 134 141 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cat,nl: fix handling of open errorsDenys Vlasenko2018-11-294-7/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ cat -n does_not_exist; echo $? cat: does_not_exist: No such file or directory 1 function old new delta print_numbered_lines 118 129 +11 nl_main 196 201 +5 cat_main 421 425 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 20/0) Total: 20 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: abort if NF set to negative valueDenys Vlasenko2018-11-281-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: fix implementation of access(2)Ron Yorston2018-12-041-2/+5
| | | | | | | | | | | | | | | | | | The WIN32 implementation of access(2) didn't return: - the correct value when a directory was tested for X_OK; - the correct error code when the target existed but execute permission wasn't available.
* | ash: fix a couple of test casesRon Yorston2018-12-042-13/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The ash tests exitcode_EACCES and exitcode_ENOENT both failed. In commit 92dbd3c09 a test was added to tryexec to check that the file being run existed and was executable. The error codes returned by this test were incorrect. The slightly later commit f5783ef14 added a similar test in spawnveq which got the error codes right. Remove the test from tryexec and some superfluous error messages from spawnveq.
* | ash: forkshell tweaksRon Yorston2018-12-041-12/+13
| | | | | | | | | | | | | | | | Make it explicit that the nodeptr array contains pointers to pointers. In debug output show both the location of pointers to be fixed and their contents.
* | ash: more clean upRon Yorston2018-12-031-5/+5
| |
* | ash: code clean upRon Yorston2018-12-031-6/+1
| |
* | ash: improvements to forkshell debugRon Yorston2018-12-031-5/+23
| | | | | | | | | | | | | | | | If forkshell_print is passed a NULL file pointer it opens and closes a local one. Add the pid to the output file name so forkshell_print can be called from both parent and child.
* | ash: annotate pointers in forkshell debugRon Yorston2018-12-021-42/+130
| | | | | | | | | | | | | | Add some text to indicate the purpose of each pointer in the forkshell data block. The code isn't very efficient but it's only used for debug.
* | ash: redefine SAVE_PTR macros to remove testRon Yorston2018-12-021-2/+10
| | | | | | | | | | | | | | | | | | | | | | The SAVE_PTR macros are used to identify pointers that need to be fixed after forkshell. They're initially used in contexts where the nodeptr variable may be NULL, so have a test for this condition. Later uses are in places where nodeptr is known to have a non-NULL value so the macros can be redefined to remove the test. Saves over 100 bytes.
* | ash: consolidate tests for variables not to convertRon Yorston2018-11-291-8/+5
| | | | | | | | | | | | | | We usually convert backslashes to slashes when importing environment variables into the shell. Exceptions are if the user has set the -X option, SYSTEMROOT and COMSPEC. Perform these tests all at once rather than separately.
* | ash: fixes to spawn_forkshellRon Yorston2018-11-291-16/+10
| | | | | | | | | | | | | | If spawn fails: - raise an error in spawn_forkshell, not at each call site; - free the job by calling freejob, not free.
* | nologin: change defaultRon Yorston2018-11-291-1/+1
| |
* | Merge branch 'busybox' into mergeRon Yorston2018-11-2869-641/+2946
|\|
| * testsuite: check CONFIG_DESKTOP before using 'od -t'Chen Qi2018-11-277-5/+7
| | | | | | | | | | | | | | | | The '-t' option for od is enabled by CONFIG_DESKTOP. So check this config before using 'od -t' in test cases. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: allow hush to run embedded scriptsRon Yorston2018-11-2710-32/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | Embedded scripts require a shell to be present in the BusyBox binary. Allow either ash or hush to be used for this purpose. If both are enabled ash takes precedence. The size of the binary is unchanged in the default configuration: both ash and hush are present but support for embedded scripts isn't compiled into hush. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * free: ensure there is a least one space between numbersDenys Vlasenko2018-11-271-3/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * docs: add embedded-scripts.txtRon Yorston2018-11-272-1/+117
| | | | | | | | | | Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: skip 'V' headers (GNU volume label), closes 11526Denys Vlasenko2018-11-271-1/+2
| | | | | | | | | | | | | | function old new delta get_header_tar 1696 1690 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * unlzma: fix too-eager corruption checkDenys Vlasenko2018-11-271-7/+13
| | | | | | | | | | | | | | function old new delta unpack_lzma_stream 2686 2674 -12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: fix too eager autodetection, closes 11531Denys Vlasenko2018-11-273-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta is_suffixed_with - 54 +54 tar_main 1006 1026 +20 open_transformer 92 79 -13 config_file_action 478 458 -20 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/2 up/down: 74/-33) Total: 41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * build system: prevent duplicate applet namesRon Yorston2018-11-271-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | The embedded script feature makes it easier to create applets with duplicate names. Currently in such cases the build succeeds but the resulting executable doesn't work as the developer intended. Catch duplicate names when the applet tables are being generated and make the build fail. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Tweaks to build process for embedded scriptsRon Yorston2018-11-275-23/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Force a rebuild if a script in applets_sh is changed. - Move the dummy usage messages for custom applets to usage.h and change the name from 'dummy' to 'scripted'. - Hide an error from gen_build_files.sh if an embed directory exists but is empty. - Tidy up embedded_scripts script. v2: Remove a couple of unnecessary tests in embedded_scripts, as pointed out by Xabier Oneca. Drop the stripping of comments. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add ECDHE_PSK and remove ARIA cipher idsDenys Vlasenko2018-11-271-8/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add _anon_ cipher definitionsDenys Vlasenko2018-11-261-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: enable TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 cipherDenys Vlasenko2018-11-261-29/+29
| | | | | | | | | | | | | | function old new delta static.ciphers 30 32 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: cipher 009D is not yet supported, don't test for itDenys Vlasenko2018-11-261-4/+3
| | | | | | | | | | | | | | function old new delta tls_handshake 2116 2108 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: speed up prf_hmac_sha256()Denys Vlasenko2018-11-261-40/+39
| | | | | | | | | | | | | | | | | | | | | | function old new delta hmac_sha_precomputed - 58 +58 prf_hmac_sha256 181 222 +41 hmac_sha256 68 - -68 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/0 up/down: 99/-68) Total: 31 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: add comment on sha384Denys Vlasenko2018-11-261-0/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: simplify hmac_begin()Denys Vlasenko2018-11-261-11/+27
| | | | | | | | | | | | | | function old new delta hmac_begin 196 158 -38 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add support for 8 more cipher ids - all tested to workDenys Vlasenko2018-11-261-87/+117
| | | | | | | | | | | | | | | | | | | | function old new delta tls_handshake 2059 2116 +57 static.ciphers - 30 +30 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 87/0) Total: 87 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: fix commentsDenys Vlasenko2018-11-251-1/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: add a comment on expanding list of supported ciphersDenys Vlasenko2018-11-251-7/+30
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: do not leak RSA keyDenys Vlasenko2018-11-252-0/+13
| | | | | | | | | | | | | | function old new delta tls_handshake 1957 2059 +102 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: code shrinkDenys Vlasenko2018-11-252-16/+12
| | | | | | | | | | | | | | | | function old new delta xwrite_and_update_handshake_hash 81 80 -1 tls_handshake 1987 1957 -30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>