Commit Graph

81 Commits

Author SHA1 Message Date
Denys Vlasenko
b097a84d62 config: update size information
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 03:20:17 +01:00
Denys Vlasenko
75568354f6 patch: implement --dry-run
function                                             old     new   delta
static.patch_longopts                                  -     137    +137
patch_main                                          2053    2135     +82
fail_hunk                                            132     139      +7
finish_oldfile                                       119     124      +5
packed_usage                                       32807   32787     -20
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 231/-20)           Total: 211 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14 16:05:26 +02:00
Denys Vlasenko
0c4dbd481a regularize format of source file headers, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-18 16:28:43 +02:00
Denys Vlasenko
72089cf6b4 config: deindent all help texts
Those two spaces after tab have no effect, and always a nuisance when editing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 09:50:55 +02:00
Denys Vlasenko
4eed2c6c50 Update menuconfig items with approximate applet sizes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Denys Vlasenko
1d3a04a3a4 Code style fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-28 01:22:57 +01:00
Aaro Koskinen
cb810c48c0 patch: fix matching failure
Fix matching failure when plist is advanced while checking for buffered
lines - the lines in the hunk that are about to be added should be
skipped when checking for matching context.

Also add a valid test case that fails with current busybox and is fixed
by the change.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-24 11:40:36 +01:00
Aaro Koskinen
2eff59667d patch: fix debug log failure
If we reach the end of plist it means the input has still data while we
are expecting EOF. Fix the log to avoid a crash.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-24 11:38:56 +01:00
Denys Vlasenko
eb5091070f patch: correctly handle "patch FILE_TO_PATCH" form. Closes 7736
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-23 05:13:15 +01:00
Denys Vlasenko
8dff01d06a libbb: introduce and use is_prefixed_with()
function                                             old     new   delta
is_prefixed_with                                       -      18     +18
complete_username                                     78      77      -1
man_main                                             737     735      -2
fsck_device                                          429     427      -2
unpack_ar_archive                                     80      76      -4
strip_unsafe_prefix                                  105     101      -4
singlemount                                         1054    1050      -4
rtc_adjtime_is_utc                                    90      86      -4
resolve_mount_spec                                    88      84      -4
parse_one_line                                      1029    1025      -4
parse_conf                                          1460    1456      -4
may_wakeup                                            83      79      -4
loadkmap_main                                        219     215      -4
get_irqs_from_stat                                   103      99      -4
get_header_cpio                                      913     909      -4
findfs_main                                           79      75      -4
fbsplash_main                                       1230    1226      -4
load_crontab                                         776     771      -5
expand_vars_to_list                                 1151    1146      -5
date_main                                            881     876      -5
skip_dev_pfx                                          30      24      -6
make_device                                         2199    2193      -6
complete_cmd_dir_file                                773     767      -6
run_applet_and_exit                                  715     708      -7
uudecode_main                                        321     313      -8
pwdx_main                                            197     189      -8
execute                                              568     560      -8
i2cdetect_main                                      1186    1176     -10
procps_scan                                         1242    1230     -12
procps_read_smaps                                   1017    1005     -12
process_module                                       746     734     -12
patch_main                                          1903    1891     -12
nfsmount                                            3572    3560     -12
stack_machine                                        126     112     -14
process_timer_stats                                  449     435     -14
match_fstype                                         111      97     -14
do_ipaddr                                           1344    1330     -14
open_list_and_close                                  359     343     -16
get_header_tar                                      1795    1779     -16
prepend_new_eth_table                                340     323     -17
fsck_main                                           1811    1794     -17
find_iface_state                                      56      38     -18
dnsd_main                                           1321    1303     -18
base_device                                          179     158     -21
find_keyword                                         104      82     -22
handle_incoming_and_exit                            2785    2762     -23
parse_and_put_prompt                                 774     746     -28
modinfo                                              347     317     -30
find_action                                          204     171     -33
update_passwd                                       1470    1436     -34
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540)         Total: -522 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12 17:48:34 +01:00
Denys Vlasenko
fe8b5802ba patch: segfault fix. Closes 7916
Fix segfault on this case (malformed --- line):

    -- dwarves.orig 2015-02-25 01:45:27.753000000 +0000
    +++ dwarves     2015-02-25 01:46:08.199000000 +0000
    @@ -1,7 +1,7 @@
     Bashful
     Doc
     Dopey
    -Grouchy
    +Grumpy
     Happy
     Sleepy
     Sneezy

function                                             old     new   delta
patch_main                                          1903    1957     +54

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-11 18:01:34 +01:00
Rob Landley
39ec6a2ad5 patch: make -p count path components, not slashes (think /blah//thing)
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-10 19:59:38 +02:00
Rob Landley
c5f7847659 patch: make it able to create files (again)
I broke patch's ability to create files in November, and nobody noticed in
the ensuing 11 months.  Sigh.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-22 04:58:32 +02:00
Denys Vlasenko
416e978ce8 diff: disable debug code; remove unsupported --dry-run from help text
function                                             old     new   delta
packed_usage                                       28623   28602     -21
do_line                                              121      91     -30
patch_main                                          2086    1923    -163
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-214)           Total: -214 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-19 01:40:31 +02:00
Denys Vlasenko
80c5b6893d libbb: nonblock_safe_read->nonblock_immune_read, remove unused param of xmalloc_reads
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:21:10 +02:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Rob Landley
8027a202a8 patch: fix "patch at the beginning" testcase failure
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-29 03:24:51 +01:00
Denys Vlasenko
400ff226c2 patch: simplify double list helpers
function                                             old     new   delta
dlist_free                                             -      29     +29
fail_hunk                                            130     132      +2
patch_main                                          1987    1982      -5
dlist_add                                             59      54      -5
TOY_llist_pop                                          9       -      -9
TOY_llist_free                                        54       -     -54
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 1/2 up/down: 31/-73)            Total: -42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-21 05:54:28 +01:00
Denys Vlasenko
b82ae98ea4 patch: busyboxify by migrating from toybox to busybox helpers
function                                             old     new   delta
get_line                                              90     128     +38
bbconfig_config_bz2                                 4959    4965      +6
makedevs_main                                       1038    1035      -3
fail_hunk                                            133     130      -3
finish_oldfile                                       174     124     -50
patch_main                                          2066    1987     -79
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/4 up/down: 44/-135)           Total: -91 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-21 05:53:34 +01:00
Alexander Shishkin
6722737ece *: introduce and use xmkstemp. -65 bytes.
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22 13:27:16 +02:00
Lukas Huba
08187356d7 patch: implement -E option
Signed-off-by: Lukas Huba <Huba.Lukas@centrum.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-21 00:43:00 +02:00
Denys Vlasenko
e7599d1cc7 revert last change (wrong author)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-21 00:42:15 +02:00
Gilles Espinasse
f0c7e0c8d5 patch: implement -E option
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-21 00:39:46 +02:00
Denys Vlasenko
c05387d5de *: replace xopen3 with xopen where makes sense
function                                             old     new   delta
uniq_main                                            421     416      -5
sort_main                                            803     798      -5
patch_main                                          2051    2046      -5
cpio_main                                            547     542      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-18 02:38:27 +02:00
Denys Vlasenko
cacb2cd281 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-05 00:13:02 +02:00
Rob Landley
9d113cac42 patch: tweaks
1) Eliminate spurious warnings about possibly reduced hunks.  Instead only
note a possible location if we don't find a non-reversed place to apply it.
(Otherwise, hunks that move code forward around within a file look reversed at
the removal site.)

2) Open the source file read-only, so we can apply patches to read-only files.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-04 00:49:48 +02:00
Denys Vlasenko
e7b0a9e5bc patch: support "patch [FILE [PATCH]]" format
function                                             old     new   delta
xopen_stdin                                            -      15     +15
patch_main                                          2075    2041     -34

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-22 05:39:15 +02:00
Denys Vlasenko
cda815996b patch: fix -N regression
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-17 01:31:40 +02:00
Denys Vlasenko
a4160e15ec patch: add -N and a test for it (fails for now)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 01:33:57 +02:00
Denys Vlasenko
6373bb7740 patch: move closer to toybox code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-13 16:41:15 +02:00
Rob Landley
760d0ebbe5 patch: deal with ommitted ",len" in hunk headers (default len to 1)
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-13 16:40:21 +02:00
Rob Landley
1bbc0cd7f2 patch: replace it with toybox's implementation
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-13 15:50:26 +02:00
Denys Vlasenko
8b8d32ea56 patch: accept and ignore -g NUM
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-22 05:10:33 +01:00
Denys Vlasenko
feadfe742a patch: add more long opts; but remove -g for now
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-22 04:17:07 +01:00
Denys Vlasenko
94ca6943bc *: small code shrinks and compile fix for unicode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:51:09 +01:00
Matheus Izvekov
2e5fa4a69d patch: ignore flag -g. +22 bytes
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:46:39 +01:00
Denys Vlasenko
17c838bc6d patch: add longopts, --dry-run, add one more test
function                                             old     new   delta
patch_main                                          1110    1214    +104
static.patch_longopts                                  -      47     +47
packed_usage                                       26738   26761     +23
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 174/0)             Total: 174 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-24 17:11:55 +02:00
Denys Vlasenko
d7874ed1d4 patch: support -N. By Olivier Duclos (olivier.duclos AT gmail.com)
function                                             old     new   delta
packed_usage                                       26646   26656     +10
patch_main                                          1101    1110      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-20 23:33:19 +02:00
Denis Vlasenko
5415c856ea libbb: [x]fopen_for_{read,write} introduced and used.
(by Valdimir)

function                                             old     new   delta
config_open2                                           -      41     +41
config_read                                          507     542     +35
find_pair                                            169     187     +18
fopen_for_write                                        -      14     +14
fopen_for_read                                         -      14     +14
find_main                                            406     418     +12
xfopen_for_write                                       -      10     +10
xfopen_for_read                                        -      10     +10
popstring                                            134     140      +6
parse_inittab                                        396     401      +5
next_token                                           923     928      +5
pack_gzip                                           1659    1661      +2
bb__parsespent                                       117     119      +2
fallbackSort                                        1719    1717      -2
evalvar                                             1376    1374      -2
qrealloc                                              36      33      -3
...
...
...
...
singlemount                                         4579    4569     -10
process_stdin                                        443     433     -10
patch_main                                          1111    1101     -10
ifupdown_main                                       2175    2165     -10
file_action_grep                                      90      80     -10
uuidcache_init                                       649     637     -12
hush_main                                            797     785     -12
read_config                                          230     217     -13
dpkg_main                                           3835    3820     -15
read_line_input                                     3134    3110     -24
sysctl_main                                          232     203     -29
config_open                                           40      10     -30
WARN_BAD_LINE                                         44       -     -44
login_main                                          1714    1575    -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)        Total: -563 bytes
2008-07-21 23:05:26 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
f5d8c90d73 style fixes, no code changes 2008-06-26 14:32:57 +00:00
Denis Vlasenko
8ee649a02e *: more uniform naming: s/xmalloc_getline/xmalloc_fgetline/ 2008-03-26 20:04:27 +00:00
Denis Vlasenko
08ec67bc62 patch: add support for -R. ~ +110 byte. By Pascal Bellard <pascal.bellard AT ads-lu.com>
fbsplash: new applet by Michele Sanges <michele.sanges AT otomelara.it

function                                             old     new   delta
fbsplash_main                                          -    1525   +1525
fb_drawfullrectangle                                   -     118    +118
static.param_value                                     -     100    +100
packed_usage                                       23776   23872     +96
applet_names                                        1843    1852      +9
applet_main                                         1120    1124      +4
read_line_input                                     3156    3158      +2
applet_nameofs                                       560     562      +2
applet_install_loc                                   140     141      +1
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 6/0 up/down: 1857/0)           Total: 1857 bytes
   text    data     bss     dec     hex filename
 799233     641    7380  807254   c5156 busybox_old
 801202     641    7380  809223   c5907 busybox_unstripped
2008-03-26 13:32:30 +00:00
Denis Vlasenko
cc2965fd23 patch: fix vda's thinko: we need to open new_filename.orig, always!
plug memory leak; add testsuite

patch_main                                          1009     988     -21
2008-03-25 14:15:39 +00:00
Denis Vlasenko
64a76d7b44 patch: support for patches without dates and generated with -U1; shrink
function                                             old     new   delta
extract_filename                                       -      92     +92
extract_filename_and_free_line                        70       -     -70
patch_main                                          1096    1009     -87
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 92/-157)           Total: -65 bytes
2008-03-24 18:18:03 +00:00
Denis Vlasenko
c693840fe8 *: whitespace fixes, no code changes 2008-03-24 02:18:03 +00:00
Denis Vlasenko
42cc304e90 lpr: add more accurate comments
*: trailing whitespace removal
2008-03-24 02:05:58 +00:00
Denis Vlasenko
c93b162248 patch: shrink by Pascal Bellard <pascal.bellard AT ads-lu.com> (-80 bytes)
*: removal of #include <getopt.h>
2008-03-23 22:55:25 +00:00
Denis Vlasenko
2a7a451391 patch: don't trash permissions of patched file 2008-03-18 01:38:04 +00:00
Denis Vlasenko
68404f13d4 *: add -Wunused-parameter; fix resulting breakage
function                                             old     new   delta
procps_scan                                         1265    1298     +33
aliascmd                                             278     283      +5
parse_file_cmd                                       116     120      +4
dname_enc                                            373     377      +4
setcmd                                                90      93      +3
execcmd                                               57      60      +3
count_lines                                           72      74      +2
process_command_subs                                 340     339      -1
test_main                                            409     407      -2
mknod_main                                           179     177      -2
handle_incoming_and_exit                            2653    2651      -2
argstr                                              1312    1310      -2
shiftcmd                                             131     128      -3
exitcmd                                               46      43      -3
dotcmd                                               297     294      -3
breakcmd                                              86      83      -3
evalpipe                                             353     349      -4
evalcommand                                         1180    1176      -4
evalcmd                                              109     105      -4
send_tree                                            374     369      -5
mkfifo_main                                           82      77      -5
evalsubshell                                         152     147      -5
typecmd                                               75      69      -6
letcmd                                                61      55      -6
add_cmd                                             1190    1183      -7
main                                                 891     883      -8
ash_main                                            1415    1407      -8
parse_stream                                        1377    1367     -10
alloc_procps_scan                                     55       -     -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148)          Total: -94 bytes
   text    data     bss     dec     hex filename
 797195     658    7428  805281   c49a1 busybox_old
 797101     658    7428  805187   c4943 busybox_unstripped
2008-03-17 09:00:54 +00:00