summaryrefslogtreecommitdiff
path: root/libbb (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * libbb: optionally honour libc provided SIGRTMIN/SIGRTMAX in get_signum()Rasmus Villemoes2018-10-311-23/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an application documents that it responds such and such to SIGRTMIN+n, that almost always means with respect to the libc-provided SIGRTMIN. Hence I disagree with the "more correct" in commit 7b276fc17594. In any case, this is rather unfortunate: 36 34 (the first shell is bash). We probably can't change default behaviour after 7 years, but at least we can provide a config option. We avoid a little code generation (repeated calls to __libc_current_sigrtmin) by stashing SIGRTMIN/SIGRTMAX in local variables, but it does cost ~50 bytes. The next patch serves as penance for that. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * printf: fix printf "%u\n" +18446744073709551614Denys Vlasenko2018-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | function old new delta conv_strtoll 19 32 +13 conv_strtoull 49 61 +12 bb_strtoll 89 84 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 25/-5) Total: 20 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * printf: fix printing +-prefixed numbersBernhard Reutner-Fischer2018-10-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks to Cristian Ionescu-Idbohrn for noticing. Also fix "%d" ' 42' to skip leading whitespace. function old new delta print_direc 435 454 +19 bb_strtoll 99 103 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0) Total: 23 bytes Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* | libbb: add missing define that breaks non-default buildsRon Yorston2018-10-261-0/+2
| |
* | Merge branch 'busybox' into mergeRon Yorston2018-10-084-3/+22
|\|
| * unzip: use printable_string() for printing filenamesDenys Vlasenko2018-09-303-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta unzip_main 2726 2792 +66 printable_string2 - 57 +57 identify 4329 4336 +7 expmeta 659 663 +4 add_interface 99 103 +4 beep_main 286 289 +3 changepath 192 194 +2 builtin_type 115 117 +2 devmem_main 469 470 +1 input_tab 1076 1074 -2 create_J 1821 1819 -2 poplocalvars 314 311 -3 doCommands 2222 2214 -8 do_load 918 902 -16 printable_string 57 9 -48 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 8/6 up/down: 146/-79) Total: 67 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * date: do not allow "month #20" and such, closes 11356Denys Vlasenko2018-09-231-0/+14
| | | | | | | | | | | | | | function old new delta parse_datestr 906 961 +55 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-09-105-3/+86
|\|
| * remove_file: don't call rmdir if remove_file return failureChen Yu2018-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When deleting a directory, the directory should not be removed if the file in the subdirectory fails to be deleted. Background information: When I tested the kernel using LTP (linux-test-project).I found the mv command have some issue. The LTP test case use the mv command to move the directory t1 in the cgroup file system to the /tmp directory. becase files in the cgroup file system are not allowed to be removed. so the mv reported "Permission denied", but I used the ls command to view the results and found that the directory t1 had been removed from the cgroup file system. For the same test case, I used the mv tool in the GNU coreutils, and the directory t1 will not be removed. the following testcase use busybox mv: / # mount -t cgroup -o cpu cgroup /cpu / # cd /cpu /cpu # mkdir -p t1 /cpu # ls cgroup.clone_children cpu.cfs_period_us cpu.stat t1 cgroup.procs cpu.cfs_quota_us notify_on_release tasks cgroup.sane_behavior cpu.shares release_agent /cpu # mv t1 /tmp mv: can't remove 't1/cgroup.procs': Operation not permitted mv: can't remove 't1/cpu.cfs_period_us': Operation not permitted mv: can't remove 't1/cpu.stat': Operation not permitted mv: can't remove 't1/cpu.shares': Operation not permitted mv: can't remove 't1/cpu.cfs_quota_us': Operation not permitted mv: can't remove 't1/tasks': Operation not permitted mv: can't remove 't1/notify_on_release': Operation not permitted mv: can't remove 't1/cgroup.clone_children': Operation not permitted /cpu # ls cgroup.clone_children cpu.cfs_period_us cpu.stat cgroup.procs cpu.cfs_quota_us notify_on_release tasks cgroup.sane_behavior cpu.shares release_agent /cpu # This patch fixed it, don't call rmdir if remove_file return failure, and under certain file systems, the mv could work normally. Signed-off-by: Chen Yu <yu.chen3@zte.com.cn> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: fix potential NULL pointer useDenys Vlasenko2018-09-031-0/+2
| | | | | | | | | | | | | | function old new delta unicode_conv_to_printable2 193 216 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: fix use-after-free in copy_fileDenys Vlasenko2018-09-031-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: in xmalloc_fgets(), use size_t for bb_get_chunk_from_file()Denys Vlasenko2018-09-021-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Revert "libbb: remove unnecessary variable in xmalloc_fgets"Denys Vlasenko2018-09-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | The variable is in fact necessary. commit 2da9724b56169f00bd7fb6b9a11c9409a7620981 Author: Quentin Rameau <quinq@fifth.space> Date: Sun Apr 1 17:05:35 2018 +0200 libbb: remove unnecessary variable in xmalloc_fgets Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fix !CONFIG_FLOAT_DURATION buildDenys Vlasenko2018-08-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Complie libbb/duration.c if ping[6] is selectedDenys Vlasenko2018-08-031-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * extend fractional duration support to "top -d N.N" and "timeout"Denys Vlasenko2018-08-031-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta parse_duration_str - 168 +168 sleep_for_duration - 157 +157 top_main 885 928 +43 timeout_main 269 312 +43 handle_input 571 614 +43 duration_suffixes - 40 +40 sfx 40 - -40 sleep_main 364 79 -285 ------------------------------------------------------------------------------ (add/remove: 4/1 grow/shrink: 3/1 up/down: 494/-325) Total: 169 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox'Ron Yorston2018-07-259-10/+72
|\|
| * hush: fix nested redirects colliding with script fdsDenys Vlasenko2018-07-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This necessitates switch from libc FILE api to a simple homegrown replacement. The change which fixes the bug here is the deleting of restore_redirected_FILEs(); line. It was prematurely moving (restoring) script fd#3. The fix is: we don't even _want_ to restore scrit fds, we are perfectly fine with them being moved. The only reason we tried to restore them is that FILE api did not allow moving of FILE->fd. function old new delta refill_HFILE_and_getc - 93 +93 hfopen - 90 +90 hfclose - 66 +66 pseudo_exec_argv 591 597 +6 hush_main 1089 1095 +6 builtin_source 209 214 +5 save_fd_on_redirect 197 200 +3 setup_redirects 320 321 +1 fgetc_interactive 235 236 +1 i_peek_and_eat_bkslash_nl 99 97 -2 expand_vars_to_list 1103 1100 -3 restore_redirects 99 52 -47 fclose_and_forget 57 - -57 remember_FILE 63 - -63 ------------------------------------------------------------------------------ (add/remove: 3/2 grow/shrink: 6/3 up/down: 271/-172) Total: 99 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * whitespace fixesDenys Vlasenko2018-07-172-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cp: optional --reflink supportDenys Vlasenko2018-07-131-0/+19
| | | | | | | | | | | | | | | | function old new delta cp_main 428 512 +84 copy_file 1676 1742 +66 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * usage: do not print trailing space for commands which have no argumentsDenys Vlasenko2018-07-091-2/+5
| | | | | | | | | | | | | | function old new delta bb_show_usage 120 130 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hexdump: fix short file of zero butes treated as dupDenys Vlasenko2018-07-031-5/+9
| | | | | | | | | | | | | | function old new delta bb_dump_dump 1466 1491 +25 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * testsuite/mount.tests: fix false positiveDenys Vlasenko2018-06-281-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: crypt() in newer glibc requires include <crypt.h>Denys Vlasenko2018-06-271-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * restore documentation on the build config languageKartik Agaram2018-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | Kconfig-language.txt was deleted in commit 4fa499a17b52b back in 2006. Move to docs/ as suggested by Xabier Oneca: http://lists.busybox.net/pipermail/busybox/2014-May/080914.html Also update references to it everywhere. Signed-off-by: Kartik Agaram <akkartik@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * whitespace fixDenys Vlasenko2018-05-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * realpath,readlink -f: coreutils compat, closes 11021Denys Vlasenko2018-05-241-0/+30
| | | | | | | | | | | | | | function old new delta xmalloc_realpath_coreutils - 121 +121 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: reinstate code in read_line_input to handle non-ttysRon Yorston2018-05-251-4/+5
| | | | | | | | | | | | | | | | | | Commit f7c592f6d "win32: exclude termios code" excluded some code to handle line input when stdin or stdout aren't ttys. It turns out that this is required when 'busybox sh -i' is run from an MSYS2 shell. See GitHub issue #115. Revert this part of the commit.
* | Update copyright dateRon Yorston2018-05-131-1/+1
| |
* | Merge branch 'busybox' into mergeRon Yorston2018-05-132-4/+21
|\|
| * libbb: new option FEATURE_ETC_SERVICES: if off, /etc/services reads often ↵Denys Vlasenko2018-04-171-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | avoided In practice, "wget http://host.com/" always uses port 80. People explicitly set non-standard ports via options or parameters ("telnet 1.2.3.4 567" or "telnet 1.2.3.4 ftp") instead of modifying /etc/services. function old new delta telnet_main 1466 1464 -2 rdate_main 215 198 -17 fakeidentd_main 269 252 -17 parse_url 459 392 -67 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-103) Total: -103 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * less: fix fallout from "use common routine to set raw termios"Denys Vlasenko2018-04-161-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Testcase: (sleep 10; ls) | busybox less [...] ~ LICENSE ~ Makefile ~ Makefile.custom ~ Makefile.flags [...] less did not want this part: + /* dont convert NL to CR+NL on output */ + newterm->c_oflag &= ~(ONLCR); function old new delta get_termios_and_make_raw 108 115 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-04-098-45/+67
|\|
| * bzip2: fix two crashes on corrupted archivesDenys Vlasenko2018-04-081-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As it turns out, longjmp'ing into freed stack is not healthy... function old new delta unpack_usage_messages - 97 +97 unpack_bz2_stream 369 409 +40 get_next_block 1667 1677 +10 get_bits 156 155 -1 start_bunzip 212 183 -29 bb_show_usage 181 120 -61 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/3 up/down: 147/-91) Total: 56 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: switch bb_ask_noecho() to "mallocing" string return APIDenys Vlasenko2018-04-071-14/+31
| | | | | | | | | | | | | | | | | | | | | | function old new delta bb_ask_noecho 313 330 +17 get_cred_or_die 125 115 -10 passwd_main 995 958 -37 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 17/-47) Total: -30 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xargs: use bb_ask_y_confirmation_FILE() instead of homegrown copyDenys Vlasenko2018-04-072-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_ask_y_confirmation_FILE - 83 +83 inetd_main 2033 2043 +10 udhcp_send_kernel_packet 295 301 +6 rmescapes 306 310 +4 send_tree 353 355 +2 i2cdetect_main 674 672 -2 confirm_or_abort 43 38 -5 get_terminal_width_height 242 234 -8 bb_ask_y_confirmation 76 10 -66 xargs_main 823 755 -68 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/5 up/down: 105/-149) Total: -44 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: rename bb_ask -> bb_ask_noecho, bb_ask_confirmation -> ↵Denys Vlasenko2018-04-075-10/+10
| | | | | | | | | | | | bb_ask_y_confirmation Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * telnet: move winsize detection closer to I/O loop, delete non-functioning ↵Denys Vlasenko2018-04-071-11/+1
| | | | | | | | | | | | debug code Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * placate gcc-8.0.1 warningsDenys Vlasenko2018-04-061-3/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: fix "unset PS1/PS2", and put them into initial variable setDenys Vlasenko2018-04-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | "unset PS1/PS2" causes prompts to be empty strings function old new delta hush_main 1031 1089 +58 goto_new_line 27 33 +6 fgetc_interactive 244 245 +1 unset_local_var 155 149 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 65/-6) Total: 59 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: more backslash to slash conversionsRon Yorston2018-04-081-1/+2
| | | | | | | | | | | | | | | | | | Convert backslashes to slashes: - in the main program's argv[0] - in the shell's file argument Also, fix the code to remove the .exe extension from argv[0] in the main program.
* | win32: exclude termios codeRon Yorston2018-04-052-7/+14
| | | | | | | | | | The code to manipulate terminal settings serves no purpose in WIN32. Use conditional compilation to exclude much of it.
* | ps: obtain applet names from other BusyBox processesRon Yorston2018-04-041-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the code which passed applet names to child processes using environment variables. This only allowed ps to display names for its ancestors. Instead attempt to read applet names from the memory of unrelated processes. The Microsoft documentation alone wasn't enough to figure out how to do this. Additional hints from: https://stackoverflow.com/questions/4298331/exe-or-dll-image-base-address https://stackoverflow.com/questions/14467229/get-base-address-of-process
* | win32: improvements to get_terminal_width_heightRon Yorston2018-04-031-0/+2
| | | | | | | | | | | | | | | | - move winansi_get_terminal_width_height from winansi.c to ioctl.c, the only caller; - check both stdout and stderr for a connection to a console; - omit unnecessary code in get_terminal_width_height (because the WIN32 implementation ignores the file descriptor).
* | ash: reinstate applet name variable after forkshellRon Yorston2018-04-031-6/+8
| | | | | | | | | | | | When 'sh --forkshell' is invoked the BB_APPLET_<pid> environment variable is set, but then it's cleared when the environment of the child process is restored. Reinstate it in reinitvar.
* | Merge branch 'busybox' into mergeRon Yorston2018-04-024-17/+22
|\|
| * libbb: new function bb_die_memory_exhaustedDenys Vlasenko2018-04-013-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_die_memory_exhausted - 10 +10 xstrdup 28 23 -5 xsetenv 27 22 -5 xrealloc 32 27 -5 xputenv 22 17 -5 xmalloc 30 25 -5 xfdopen_helper 40 35 -5 xasprintf 44 39 -5 wget_main 2387 2382 -5 open_socket 54 49 -5 glob_brace 419 414 -5 bb_get_chunk_from_file 146 141 -5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/11 up/down: 10/-55) Total: -45 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sed: prevent overflow of length from bb_get_chunk_from_fileQuentin Rameau2018-04-011-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fragment did not work right: temp = bb_get_chunk_from_file(fp, &len); if (temp) { /* len > 0 here, it's ok to do temp[len-1] */ char c = temp[len-1]; With "int len" _sign-extending_, temp[len-1] can refer to a wrong location if len > 0x7fffffff. Signed-off-by: Quentin Rameau <quinq@fifth.space> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: remove unnecessary variable in xmalloc_fgetsQuentin Rameau2018-04-011-3/+1
| | | | | | | | | | Signed-off-by: Quentin Rameau <quinq@fifth.space> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: use BUILD_BUG_ON in utoa_to_buf()Denys Vlasenko2018-03-281-4/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>