aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-01-07vi: fix reading of file after last lineRon Yorston
If the :r command is used to read a file after the last line of the buffer the last line of the buffer and the first line of the file are joined. An extra blank line appears at the end of the buffer. file 1 file 1 file 1file 2 file 2 file 2 ~ ~ The insertion point is normally at the start of the line following the specified line. When the specified line is the last one the next_line function baulks at moving to the non-existent following line. Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-07vi: failure to open file is not an error when initialising bufferRon Yorston
Commit 32afd3a introduced these regressions on the master branch: Starting vi with no filename on the command line gives the status message "'(null)' Bad address" instead of "- No file 1/1 100%". Starting vi with a non-existent file on the command line gives the status message "'new.txt' No such file or directory" instead of "- new.txt 1/1 100%" Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-07depmod: fix recent breakage in modules.dep generationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-06libpwdgrp: line counting in error meesages is broken, remove itTito Ragusa
Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05swaponoff: add support for -eRené Rhéaume
Signed-off-by: René Rhéaume <rene.rheaume@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05mpstat: code shrinkDenys Vlasenko
function old new delta get_uptime 134 129 -5 get_irqs_from_stat 110 103 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05free: handle "cached" value tooGuillermo Rodriguez
function old new delta free_main 356 481 +125 Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05libbb: code shrink by factoring out common update_utmp_DEAD_PROCESSDenys Vlasenko
function old new delta update_utmp_DEAD_PROCESS - 17 +17 telnetd_main 1685 1674 -11 mark_terminated 56 45 -11 handle_sigchld 74 63 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05deleting unused ntpd_simple.cDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05libpwdgrp: fixes suggested by Tito, comment tweaksDenys Vlasenko
function old new delta bb_internal_getpwent_r 100 121 +21 parse_common 202 203 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-04ntpd: relicense ntpd applet to ISC-style licenseAdam Tkac
OpenNTPd is licensed under ISC-style license so it's good idea to keep ntpd applet under same license to avoid mess, instead of having our changes to be under GPL. Names of original code's authors are added. Signed-off-by: Adam Tkac <vonsch@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-04libpwdgrp: another code shrinkDenys Vlasenko
function old new delta massage_data_for_r_func - 110 +110 bb_internal_getpwent_r 173 100 -73 getXXnam_r 176 95 -81 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 110/-154) Total: -44 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-04libpwdgrp: code shrinkDenys Vlasenko
function old new delta parse_common 206 205 -1 getgrouplist_internal 229 225 -4 bb_internal_getpwent_r 182 173 -9 getXXnam 232 222 -10 getXXnam_r 216 176 -40 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-64) Total: -64 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03libpwdgrp: getgrXXX: empty string is not a member name, do not store itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03fix a SEGV in previous commitDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03libpwdgrp: fix counting of commas in group listDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03libpwdgrp: store getXXnam result in a single malloc blockDenys Vlasenko
This saves a bit of memory but more importantly, allows to create xmalloc_getpwnam() API where result can be deleted simply using free(). function old new delta getXXnam 134 173 +39 parse_common 188 212 +24 convert_to_struct 277 290 +13 get_S 90 88 -2 tokenize 129 126 -3 bb_internal_getpwent_r 175 172 -3 getXXnam_r 208 198 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/4 up/down: 76/-18) Total: 58 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03libpwdgrp: make db->def[] one byte shorterDenys Vlasenko
In the future I will need another uint8_t, want to fit it w/o using another word on 32 bits. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03libpwdgrp: use a better estimate of max struct sizeDenys Vlasenko
Previous code's trick with bitwise OR was giving this on 32-bit x86: sizeof(struct passwd):28 sizeof(struct group):16 sizeof(struct spwd):36 sizeof(struct_result):60 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03libpwdgrp: reinstate Tito's optional atexit freeingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03libpwdgrp: fix a memory leak in getXXnam (we did not save address of string buf)Denys Vlasenko
function old new delta convert_to_struct 261 269 +8 const_sp_db 20 24 +4 const_pw_db 20 24 +4 const_gr_db 20 24 +4 tokenize 144 147 +3 parse_common 185 188 +3 get_S 82 85 +3 bb_internal_getpwent_r 188 185 -3 gr_off 4 - -4 getXXnam 171 165 -6 pw_off 7 - -7 getgrouplist_internal 237 229 -8 getXXnam_r 215 207 -8 sp_off 9 - -9 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 7/4 up/down: 29/-45) Total: -16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-03libpwdgrp: tweak comments, replace one xmalloc with xzallocDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-02libpwdgrp: use FAST_FUNC to make "matching ABI" optimization more likely to ↵Denys Vlasenko
succeed See bb_internal_get*nam_r size reduction: function old new delta bb_internal_getpwent_r 167 176 +9 getXXnam_r 204 206 +2 sulogin_main 326 325 -1 su_main 471 470 -1 read_line_input 3832 3831 -1 print_stat 865 864 -1 prepare_socket_fd 283 282 -1 load_crontab 777 776 -1 fork_job 456 455 -1 do_shm 884 883 -1 do_sem 637 636 -1 do_msg 783 782 -1 complete_username 124 123 -1 bb_internal_getgrouplist 71 70 -1 xgetpwuid 27 25 -2 xgetpwnam 27 25 -2 xgetgrnam 27 25 -2 xgetgrgid 27 25 -2 uid2uname 18 16 -2 login_main 980 978 -2 gid2group 18 16 -2 get_shell_name 54 52 -2 change_identity 50 48 -2 bb_internal_initgroups 50 48 -2 argstr 1261 1259 -2 print_perms 177 174 -3 inetd_main 2077 2074 -3 run_applet_no_and_exit 446 442 -4 fileaction_setowngrp 89 85 -4 deluser_main 312 308 -4 bb_internal_getpwuid 19 15 -4 bb_internal_getpwnam 11 7 -4 bb_internal_getgrnam 14 10 -4 bb_internal_getgrgid 19 15 -4 adduser_main 865 861 -4 passwd_main 989 984 -5 get_passwd 97 92 -5 data_extract_all 887 882 -5 check_user_passwd 490 485 -5 get_groups 81 75 -6 ftpd_main 2178 2171 -7 bb_internal_getspnam_r 42 18 -24 bb_internal_getpwnam_r 39 15 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/41 up/down: 11/-153) Total: -142 bytes text data bss dec hex filename 923167 928 17676 941771 e5ecb busybox_old 923023 928 17676 941627 e5e3b busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-02libpwdgrp: rewritten to use malloced implementationTito Ragusa
This removed buffer size limitations. function old new delta convert_to_struct - 269 +269 getXXnam_r - 204 +204 parse_common - 185 +185 getXXnam - 164 +164 tokenize - 126 +126 bb_internal_getpwent_r 102 167 +65 get_S 30 88 +58 getgrouplist_internal 195 240 +45 const_sp_db - 20 +20 const_pw_db - 20 +20 const_gr_db - 20 +20 bb_internal_endpwent 27 36 +9 bb_internal_endgrent 27 36 +9 decode_one_format 726 734 +8 bb_internal_setpwent 17 24 +7 volume_id_probe_iso9660 319 322 +3 scriptreplay_main 204 207 +3 mkfs_minix_main 2684 2687 +3 id_main 478 480 +2 hash_find 233 235 +2 pstree_main 321 322 +1 gr_off 3 4 +1 expand_one_var 1579 1578 -1 pwf 4 - -4 grf 4 - -4 pack_gzip 1787 1780 -7 addattr32 67 56 -11 buffer_fill_and_print 191 178 -13 dpkg_main 2944 2927 -17 bb_internal_setgrent 17 - -17 bb_internal_getpwuid 38 19 -19 bb_internal_getgrgid 44 19 -25 bb_internal_getpwnam 38 11 -27 bb_internal_getgrnam 44 14 -30 bb_internal_fgetpwent_r 51 - -51 bb_internal_fgetgrent_r 51 - -51 bb_internal_getspnam_r 121 42 -79 bb_internal_getpwnam_r 121 39 -82 bb_internal_getgrent_r 102 - -102 bb__parsepwent 110 - -110 bb_internal_getpwuid_r 113 - -113 bb_internal_getgrgid_r 113 - -113 bb__parsespent 120 - -120 bb_internal_getgrnam_r 121 - -121 bb__pgsreader 213 - -213 bb__parsegrent 226 - -226 ------------------------------------------------------------------------------ (add/remove: 8/13 grow/shrink: 14/11 up/down: 1224/-1556) Total: -332 bytes text data bss dec hex filename 923471 928 17684 942083 e6003 busybox_old 923167 928 17676 941771 e5ecb busybox_unstripped Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-01modprobe: revert checking for /, stop doing basename() on modprobe argsDenys Vlasenko
function old new delta process_module 726 719 -7 filename2modname 81 67 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-21) Total: -21 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-31Makefile: fix cscope targetBartosz Golaszewski
This target doesn't work with current directory layout. Just make cscope index all .c and .h files. While we're at it: add cscope output files to .gitignore. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-29ash: fix a SEGV in ${#1}Denys Vlasenko
function old new delta varvalue 760 805 +45 evalvar 648 603 -45 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-25udhcpd: account for script delay in leaseJohn Schroeder
Prevent nasty surprises if script runs longer than lease time / 2. Signed-off-by: John Schroeder <jschroed@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-24Start 1.24.0 development cycleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-24Bump version to 1.23.0Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-24libbb: add sanity check in bb_arg_max()Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-22randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-22Make it possible to override LOGIN_FAIL_DELAY in CONFIG_EXTRA_CFLAGSPeter Kümmel
Signed-off-by: Peter Kümmel <syntheticpp@gmx.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-21udhcpc: account for script run timeDenys Vlasenko
Based on the following user report: I ran into an issue where I was seeing a long delay in the scripts called in udhcp_run_script. I was using an old version of OpenWrt (kamikaze) and a satellite modem. An NTP script was being called and the modem would sometimes take a long time to respond to the DNS lookup when it was offline. This delay started affecting my lease time. The lease that I would get from my satellite modem before it was online would be short: only 60 seconds. The delay with NTP and the modem would typically be about 18 seconds. This would cause the first DHCP renew request from dhcpc to be a little late. Under certain circumstances, I could even see the first DHCP renew to occur after the lease had expired! function old new delta udhcpc_main 2816 2837 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-18nanddump: don't show --bb in usage when disabledBaruch Siach
The --bb options now depends on LONG_OPTS. Omit mentions of --bb from usage text when LONG_OPTS is disabled. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-17nandwrite: fix build when long options are disabledBaruch Siach
The Required_argument macro is only defined when long options are enabled. Fixes the following build error: miscutils/nandwrite.c: In function 'nandwrite_main': miscutils/nandwrite.c:120:10: error: expected ',' or ';' before 'Required_argument' Reported-by: Christian Kästner <kaestner at cs.cmu.edu> Signed-off-by: Baruch Siach <baruch at tkos.co.il> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-15lineedit: don't block when looking for escape sequence in vi-modeRon Yorston
In vi-mode lineedit tries to detect some escape sequences. After the ESC it reads the next character to check for certain values. This read should have a timeout or a user-entered ESC to switch to command mode doesn't properly handle the next character. Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-11tar: fix "tar -cJ" ignoring -J option. closes 7706Denys Vlasenko
function old new delta tar_main 895 938 +43 vfork_compressor 206 191 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 43/-15) Total: 28 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-10lineedit: don't fall back to simple line input if tty is in raw modeDenys Vlasenko
Testcase: shell command input after python ^Z should still work Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-10Config: select PLATFORM_LINUX if using sendfile()Bartosz Golaszewski
Man entry for sendfile: Not specified in POSIX.1-2001, or other standards. Other UNIX systems implement sendfile() with different semantics and prototypes. It should not be used in portable programs. Select PLATFORM_LINUX if enabling FEATURE_USE_SENDFILE. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-10flashcp: change BUFSIZE to 4kJacob Kjaergaard
some flash partitions can be smaller than the existing BUFSIZE thus write BUFSIZE will fail with "no space left on device" Signed-off-by: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-07make xmalloc_open_zipped_read_close result NUL terminatedDenys Vlasenko
Compat with xmalloc_open_read_close Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-07libarchive: add capability to unpack to mem.bufferDenys Vlasenko
The performance and number of processes for a "depmod -a" with gzipped modules was abysmal. This patch adds a code path without fork, benefiting all users of xmalloc_open_zipped_read_close. "modinfo radeon.ko.gz", a single-file reader, got 30% faster. "depmod -a", which used to fork over 800 times, got 20% faster. Heavily based on a patch by Lauri Kasanen <curaga@operamail.com> function old new delta setup_transformer_on_fd - 159 +159 transformer_write - 122 +122 fork_transformer - 112 +112 xmalloc_open_zipped_read_close 63 118 +55 read_bunzip 1866 1896 +30 xtransformer_write - 19 +19 unzip_main 2449 2462 +13 bbunpack 755 766 +11 unpack_lzma_stream 2717 2723 +6 unpack_xz_stream 2393 2397 +4 unpack_Z_stream 1173 1175 +2 inflate_unzip 111 105 -6 check_signature16 70 63 -7 unpack_bz2_stream 359 349 -10 unpack_unxz 12 - -12 unpack_unlzma 12 - -12 unpack_uncompress 12 - -12 unpack_gunzip 12 - -12 unpack_bunzip2 12 - -12 open_transformer 106 92 -14 inflate_unzip_internal 1945 1916 -29 unpack_gz_stream 693 655 -38 open_zipped 89 47 -42 setup_unzip_on_fd 142 53 -89 ------------------------------------------------------------------------------ (add/remove: 4/5 grow/shrink: 7/8 up/down: 533/-295) Total: 238 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-07Rename transformer_aux_data_t -> transformer_state_tDenys Vlasenko
No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-30man: do not mangle $MANPATH in memoryDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-27libbb: use sendfile() to copy data between file descriptorsBartosz Golaszewski
Busybox already uses sendfile in httpd. This patch proposes to use it globally to copy data between file descriptors. It speeds up the copying on slow systems a lot - below are the times needed to copy a 450Mb file with and without this option enabled on a BeagleBone Black: sendfile: user 0m0.000s sys 0m8.170s read/write 4k: user 0m0.470s sys 0m16.300s function old new delta bb_full_fd_action 394 474 +80 Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-27man: accept a list of dirs in $MANPATHDenys Vlasenko
function old new delta add_MANPATH - 143 +143 man_main 852 731 -121 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 143/-121) Total: 22 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-26libbb: use ARG_MAX for bb_arg_max() only if it's 60k+Denys Vlasenko
Sometimes ARG_MAX is small (like 32k) yet sysconf(_SC_ARG_MAX) is big, and people prefer using the bigger value. OTOH, with sufficiently large ARG_MAX, further wins from sysconf(_SC_ARG_MAX) being bigger are exponentially smaller: you can see 4 times fewer fork+execs when you run find, but when each execed process already takes a thousand parameters it's likely execution time is dominated by what that process does with each parameter. Thus, with this change ARG_MAX is used if it's sufficiently big, otherwise sysconf(_SC_ARG_MAX) is used. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-26bbunit: fix WANT_TIMING compilationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-26gitignore: add testsuite/echo-neBartosz Golaszewski
Signed-off-by: Bartosz Golaszewski <bartekgola at gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>