aboutsummaryrefslogtreecommitdiff
path: root/libbb (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | libbb: improve stripping of extension from argv[0]Ron Yorston2018-03-311-15/+11
| | | | | | | | | | | | | | | | | | | | Use library routines to reduce the amount of code needed to strip the extension from argv[0] in the BusyBox main function. The name of the executable can now have any of the standard extensions, none at all, or a trailing dot. Related to GitHub issue #20.
* | busybox: let --list-full display nofork/noexec appletsRon Yorston2018-03-291-6/+22
| | | | | | | | | | | | The --list-full option to busybox-w32 was disabled because it didn't make sense to display Unix install paths. Repurpose this option to display whether applets are NOFORK or NOEXEC.
* | win32: save a few bytesRon Yorston2018-03-291-2/+3
| | | | | | | | | | | | | | | | In the recently-added code to pass applet names to child processes use local arrays to build the environment variables rather that allocating them every time. mingw_spawn can call mingw_spawn_proc instead of mingw_spawn_1.
* | ps: display applet names in process listingRon Yorston2018-03-281-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In standalone shell mode all busybox-w32 applets are displayed as 'busybox.exe' in a process listing. I haven't found a satisfactory way to query a running instance of busybox-w32 to determine which applet it's running. Handle a couple of cases: - the process running the process scan knows its own PID and knows which applet it is; - just before invoking applet_main set an environment variable whose name contains the PID and whose value is the current applet name. Children running a process scan will inherit their parent's environment and can therefore match the parent's PID to its applet name.
* | win32: add a function to convert backslashes to slashesRon Yorston2018-03-181-5/+1
| |
* | Merge branch 'busybox' into mergeRon Yorston2018-03-152-11/+9
|\|
| * make busybox more portableSean MacLennan2018-03-042-11/+9
| | | | | | | | | | | | | | | | Move some distro specific include files into the appropriate #ifdef blocks to make the code more portable. Signed-off-by: Sean MacLennan <seanm@seanm.ca> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Minor improvements to buildRon Yorston2018-03-022-18/+15
| | | | | | | | | | | | | | | | | | | | | | | | Exclude source files in libbb that aren't used by busybox-w32. This speeds up the build marginally. They can always be reinstated if necessary. Provide fake routines for everything in inode_hash.c so that it can be excluded. inode_hash.c is now unchanged from upstream. Use last_char_is in has_exe_suffix_or_dot. It doesn't save any bytes but it makes the code neater.
* | Merge branch 'busybox' into mergeRon Yorston2018-03-013-4/+17
|\|
| * libbb: Use return value from is_prefixed_with()Andy Shevchenko2018-02-271-3/+2
| | | | | | | | | | | | | | | | | | | | add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5 (-5) Function old new delta skip_dev_pfx 30 25 -5 Total: Before=779966, After=779961, chg -0.00% Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: allow window size tracking to be disabledRon Yorston2018-02-252-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta lineedit_read_key 269 261 -8 win_changed 47 - -47 read_line_input 3884 3821 -63 cmdedit_setwidth 63 - -63 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/2 up/down: 0/-181) Total: -181 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: compile capability code only if FEATURE_SETPRIV_CAPABILITIES or RUN_INITDenys Vlasenko2018-02-211-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * progress meter: add disabled code for a more stable ETADenys Vlasenko2018-02-131-0/+13
| | | | | | | | | | | | Compiles to ~25 bytes if enabled. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Remove fake signal-handling codeRon Yorston2018-03-011-1/+1
| | | | | | | | | | | | | | | | | | Microsoft Windows has only limited support for signals. busybox-w32 initially papered over this fact by adding definitions for unsupported signals and signal-handling functions. Remove this fake code and deal with the consequences by excluding anything that fails to compile as a result.
* | lineedit: disable window size tracking in default configurationRon Yorston2018-03-012-4/+19
| | | | | | | | | | SIGWINCH isn't available on Microsoft Windows. Make the use of SIGWINCH configurable and disable it by default.
* | win32: additional improvements to handling of executablesRon Yorston2018-02-281-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Consistent processing of file extensions, as described in the previous commit, has been applied to the 'which' applet and the functions find_executable and mingw_spawn_interpreter. In spawnveq check that the file to be executed exists and is executable, and ensure that it won't have any extensions added by spawnve. It's intended that all files passed to spawnve should have their names fully specified. If this isn't the case the tests here will cause errors which will need to be fixed.
* | libbb: ensure build details are only stored onceRon Yorston2018-02-261-1/+1
| | | | | | | | | | Determine the size of the MINGW_VER string at compile time so it's only stored once.
* | win32: move detection of file formats to stat(2)Ron Yorston2018-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the code to detect shell scripts and binary executables from mingw_access to a separate function, has_exec_format. Call this function in do_lstat to decide whether to set the executable bits in the file mode. This will slow down stat but has a couple of advantages: - shell scripts are highlighted in ls output - the test applet can use stat(2) to detect executable files The new function is used to handle another corner case in spawnveq: binary executables without the usual .exe extension are only run by spawnve if the file name ends with '.'. Two minor changes: - file_is_win32_executable has been renamed add_win32_extension to clarify what it does - a call to file_is_executable has been removed from find_command in ash as it resulted in unhelpful error messages.
* | du: use Windows-compatible print formatsRon Yorston2018-02-131-3/+3
| | | | | | | | | | | | | | | | Commit 18afed0f9 replaced %ll* formats with Windows equivalents to silence compiler warnings. Some format strings in du were missed because they weren't compiled or weren't string literals. These fixes make 'du -h' work as expected on Windows XP.
* | Merge branch 'busybox' into mergeRon Yorston2018-02-138-81/+122
|\|
| * libbb: introduce and use bb_getsockname()Denys Vlasenko2018-02-111-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_getsockname - 18 +18 xrtnl_open 88 83 -5 do_iplink 1216 1209 -7 arping_main 1686 1668 -18 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/3 up/down: 18/-30) Total: -12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: shrink wget/tftp progress indicator code a bit moreDenys Vlasenko2018-02-071-29/+27
| | | | | | | | | | | | | | | | | | | | This makes size display 5-char wide instead of 6-char, but now it's smarter (can show sizes in "12.3M" format). function old new delta bb_progress_update 654 622 -32 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: shrink wget/tftp progress indicator code for 32-bitDenys Vlasenko2018-02-071-40/+38
| | | | | | | | | | | | | | function old new delta bb_progress_update 756 654 -102 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fix compile failure in previous commitDenys Vlasenko2018-02-061-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * unzip: do not set directory mode to 0777Denys Vlasenko2018-02-061-6/+10
| | | | | | | | | | | | https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882177 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: commonalize a bit of little-endian CRC32 table generation codeDenys Vlasenko2018-02-011-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta global_crc32_new_table_le - 11 +11 crc32_new_table_le - 9 +9 inflate_unzip_internal 560 556 -4 flash_eraseall_main 823 819 -4 unpack_xz_stream 2403 2394 -9 lzop_main 121 112 -9 gzip_main 187 178 -9 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/5 up/down: 20/-35) Total: -15 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * which: fix TODO with NOFORK+malloc_failure misbehavingDenys Vlasenko2018-01-122-15/+11
| | | | | | | | | | | | | | | | | | | | | | function old new delta find_executable 86 104 +18 which_main 202 194 -8 executable_exists 66 51 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 18/-23) Total: -5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>