aboutsummaryrefslogtreecommitdiff
path: root/archival/dpkg.c
AgeCommit message (Collapse)Author
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: update size informationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-18regularize format of source file headers, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-08getopt32: remove applet_long_optionsDenys Vlasenko
FEATURE_GETOPT_LONG made dependent on LONG_OPTS. The folloving options are removed, now LONG_OPTS enables long options for affected applets: FEATURE_ENV_LONG_OPTIONS FEATURE_EXPAND_LONG_OPTIONS FEATURE_UNEXPAND_LONG_OPTIONS FEATURE_MKDIR_LONG_OPTIONS FEATURE_MV_LONG_OPTIONS FEATURE_RMDIR_LONG_OPTIONS FEATURE_ADDGROUP_LONG_OPTIONS FEATURE_ADDUSER_LONG_OPTIONS FEATURE_HWCLOCK_LONG_OPTIONS FEATURE_NSENTER_LONG_OPTS FEATURE_CHCON_LONG_OPTIONS FEATURE_RUNCON_LONG_OPTIONS They either had a small number of long options, or their long options are essential. Example: upstream addgroup and adduser have ONLY longopts, we should probably go further and get rid of non-standard short options. To this end, make addgroup and adduser "select LONG_OPTS". We had this breakage caused by us even in our own package! #if ENABLE_LONG_OPTS || !ENABLE_ADDGROUP /* We try to use --gid, not -g, because "standard" addgroup * has no short option -g, it has only long --gid. */ argv[1] = (char*)"--gid"; #else /* Breaks if system in fact does NOT use busybox addgroup */ argv[1] = (char*)"-g"; #endif xargs: its lone longopt no longer depends on DESKTOP, only on LONG_OPTS. hwclock TODO: get rid of incompatible -t, -l aliases to --systz, --localtime Shorten help texts by omitting long option when short opt alternative exists. Reduction of size comes from the fact that store of an immediate (an address of longopts) to a fixed address (global variable) is a longer insn than pushing that immediate or passing it in a register. This effect is CPU-agnostic. function old new delta getopt32 1350 22 -1328 vgetopt32 - 1318 +1318 getopt32long - 24 +24 tftpd_main 562 567 +5 scan_recursive 376 380 +4 collect_cpu 545 546 +1 date_main 1096 1095 -1 hostname_main 262 259 -3 uname_main 259 255 -4 setpriv_main 362 358 -4 rmdir_main 191 187 -4 mv_main 562 558 -4 ipcalc_main 548 544 -4 ifenslave_main 641 637 -4 gzip_main 192 188 -4 gunzip_main 77 73 -4 fsfreeze_main 81 77 -4 flock_main 318 314 -4 deluser_main 337 333 -4 cp_main 374 370 -4 chown_main 175 171 -4 applet_long_options 4 - -4 xargs_main 894 889 -5 wget_main 2540 2535 -5 udhcpc_main 2767 2762 -5 touch_main 436 431 -5 tar_main 1014 1009 -5 start_stop_daemon_main 1033 1028 -5 sed_main 682 677 -5 script_main 1082 1077 -5 run_parts_main 330 325 -5 rtcwake_main 459 454 -5 od_main 2169 2164 -5 nl_main 201 196 -5 modprobe_main 773 768 -5 mkdir_main 160 155 -5 ls_main 568 563 -5 install_main 773 768 -5 hwclock_main 411 406 -5 getopt_main 622 617 -5 fstrim_main 256 251 -5 env_main 198 193 -5 dumpleases_main 635 630 -5 dpkg_main 3991 3986 -5 diff_main 1355 1350 -5 cryptpw_main 233 228 -5 cpio_main 593 588 -5 conspy_main 1135 1130 -5 chpasswd_main 313 308 -5 adduser_main 887 882 -5 addgroup_main 416 411 -5 ftpgetput_main 351 345 -6 get_terminal_width_height 242 234 -8 expand_main 690 680 -10 static.expand_longopts 18 - -18 static.unexpand_longopts 27 - -27 mkdir_longopts 28 - -28 env_longopts 30 - -30 static.ifenslave_longopts 34 - -34 mv_longopts 46 - -46 static.rmdir_longopts 48 - -48 packed_usage 31739 31687 -52 ------------------------------------------------------------------------------ (add/remove: 2/8 grow/shrink: 3/49 up/down: 1352/-1840) Total: -488 bytes text data bss dec hex filename 915681 485 6880 923046 e15a6 busybox_old 915428 485 6876 922789 e14a5 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21config: deindent all help textsDenys Vlasenko
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-18Update menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-05dpkg: fix CONFIG_FEATURE_CLEAN_UP handlingPeter Korsgaard
dpkg moved to away from dynamically allocating the hashtables in commit c87339d584 (dpkg: trivial code shrinkage, and redo G trick correctly) almost ten years ago, but the cleanup code was never adjusted to match. Glibc loudly complains about this: *** Error in `dpkg': free(): invalid pointer: 0x0000007fac3478c0 *** Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17Spelling fixes in comments, documentation, tests and examplesDenys Vlasenko
By klemens <ka7@github.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-23Make DPKG=y and DPKG_DEB=y by defaultDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08join some common strings, -400 bytesDenys Vlasenko
function old new delta print_intel_cstates 499 511 +12 file_insert 355 364 +9 dpkg_main 2944 2940 -4 ifenslave_main 645 640 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 21/-9) Total: 12 bytes text data bss dec hex filename 937564 932 17676 956172 e970c busybox_old 937164 932 17676 955772 e957c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-30dpkg: update supported compression methodsDenys Vlasenko
Based on a patch by Ron Yorston <rmy@tigress.co.uk> function old new delta get_header_tar_xz - 60 +60 filter_accept_list_reassign 128 188 +60 unpack_package 585 621 +36 init_archive_deb_control 52 76 +24 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/0 up/down: 180/0) Total: 180 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14archival/*: move "config:" snippets into .c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14archival/*: move "applet:" snippets into .c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-14archival/*: move "kbuild:" snippets into .c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14whitespace fixes. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-22dpkg: fix creation of .list files (were empty since b768aeb). Closes 5324Denys Vlasenko
While at it, fix filename order and free the list of names. function old new delta llist_rev - 21 +21 get_header_tar 1733 1741 +8 unpack_package 587 585 -2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 29/-2) Total: 27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-22rename archive.h to bb_archive.h. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-20warning removalCristian Ionescu-Idbohrn
Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-27move help text from include/usage.src.h to archival/*.cPere Orga
Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-03rename archival/libunarchive -> archival/libarchive; move bz/ into itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-29whitespace cleanupDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-28*: whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-16*: pass md5/shaN context pointer as 1st arg, not lastDenys Vlasenko
function old new delta md5_hash_block 458 459 +1 filter_rename_config 252 250 -2 md5_crypt 591 587 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-09-06made 3 license strings to follow the usual form ("or later" bit is not changed!)Denys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-03-30dpkg: remove redundant checkDenys Vlasenko
function old new delta dpkg_main 4008 3991 -17 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-30dpkg: better check for validity of optionsDenys Vlasenko
function old new delta dpkg_main 3980 4008 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-29dpkg: support config file overwrite optionsKim B. Heino
function old new delta filter_rename_config - 244 +244 static.dpkg_longopts - 112 +112 dpkg_main 3901 3980 +79 unpack_package 515 587 +72 append_control_file_to_llist - 72 +72 data_extract_all_prefix 88 116 +28 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 3/0 up/down: 607/0) Total: 607 bytes Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-28*: style fixes. no code changes (verified with objdump)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08dpkg: fix handling of names with leading dots. Closes bug 783Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-06libunarchive: clean up dirty hacks. code shrank as a resultDenys Vlasenko
function old new delta cpio_main 526 539 +13 init_handle 57 58 +1 init_archive_deb_ar 34 35 +1 get_header_ar 408 409 +1 dpkg_main 3900 3901 +1 unpack_package 516 515 -1 rpm_main 1673 1672 -1 tar_main 774 767 -7 get_header_cpio 990 972 -18 data_extract_all 750 727 -23 get_header_tar 1631 1576 -55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/6 up/down: 17/-105) Total: -88 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-16libunarchive: move dpkg-specific things into dpkg.c. 0 byte size differencesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13*: use "can't" instead of "cannot"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-17tar: fix --numeric-owner, --no-same-owner, --no-same-permissions bitsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06documentation and typo fixes. By Dan Fandrich (dan AT coneharvesters.com)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-25dpkg: delete postrm script after it's run, not before. closes bug 449Denys Vlasenko
function old new delta purge_package 220 252 +32 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-11-20dpkg: better and shorter code to compare versionsDenis Vlasenko
(taken from "official" dpkg). By Eugene T. Bordenkircher (eugebo AT gmail.com) function old new delta order - 48 +48 test_version 273 276 +3 version_compare_part 396 187 -209 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 51/-209) Total: -158 bytes
2008-09-25- add dpkg -l <packagepattern> (Peter Korsgaard)Bernhard Reutner-Fischer
2008-08-05*: refactor handling of archived files. "tar f file.tar.lzma" now works too.Denis Vlasenko
function old new delta unpack_Z_stream - 1229 +1229 open_zipped - 176 +176 unpack_bz2_stream_prime - 60 +60 tar_main 642 677 +35 find_main 406 418 +12 sv_main 1222 1233 +11 decode_format_string 829 837 +8 cmp_main 641 649 +8 popstring 134 140 +6 filter_accept_list_reassign 120 125 +5 parse_and_put_prompt 800 804 +4 passwd_main 1053 1049 -4 make_new_name_gunzip 119 114 -5 rpm_main 1688 1670 -18 prepare 302 283 -19 xmalloc_open_zipped_read_close 135 61 -74 uncompress 1229 - -1229 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 8/5 up/down: 1554/-1349) Total: 205 bytes
2008-08-04libbb: make xrealloc_vector zero out the realloc'ed tailDenis Vlasenko
function old new delta xrealloc_vector_helper 51 76 +25 man_main 712 705 -7 act 250 234 -16 create_list 91 70 -21 getopt_main 695 664 -31 load_dep_bb 281 248 -33 fileAction 744 709 -35 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/6 up/down: 25/-143) Total: -118 bytes
2008-07-21libbb: [x]fopen_for_{read,write} introduced and used.Denis Vlasenko
(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-12whitespace fixesDenis Vlasenko
2008-07-08libbb: introduce and use xrealloc_vectorDenis Vlasenko
function old new delta xrealloc_vector_helper - 51 +51 create_list 84 99 +15 getopt_main 690 695 +5 passwd_main 1049 1053 +4 get_cached 85 89 +4 msh_main 1377 1380 +3 add_match 42 41 -1 read_lines 720 718 -2 grave 1068 1066 -2 fill_match_lines 143 141 -2 add_to_dirlist 67 65 -2 add_input_file 49 47 -2 act 252 250 -2 fsck_main 2252 2246 -6 man_main 765 757 -8 bb_internal_initgroups 228 220 -8 cut_main 1052 1041 -11 add_edge_to_node 55 43 -12 dpkg_main 3851 3835 -16 ifupdown_main 2202 2178 -24 sort_main 838 812 -26 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 5/15 up/down: 82/-124) Total: -42 bytes
2008-07-05*: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko
2008-06-28libunarchive: stop using static data in archivers - archive_handle_tDenis Vlasenko
can trivially provide space for that. rpm: code shrink tar: simplify autodetection of bz2/.gz function old new delta static.not_first 1 - -1 static.end 1 - -1 bb_makedev 51 49 -2 static.saved_hardlinks_created 4 - -4 static.saved_hardlinks 4 - -4 longname 4 - -4 linkname 4 - -4 hash_file 251 247 -4 get_header_tar 1528 1521 -7 rpm_main 1711 1697 -14 get_header_cpio 965 944 -21 ------------------------------------------------------------------------------ (add/remove: 0/6 grow/shrink: 0/5 up/down: 0/-66) Total: -66 bytes text data bss dec hex filename 804926 611 6868 812405 c6575 busybox_old 804878 611 6852 812341 c6535 busybox_unstripped
2008-06-27*: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
2008-06-21dpkg: trivial code shrinkage, and redo G trick correctly.Denis Vlasenko
function old new delta run_package_script_or_die - 72 +72 fill_package_struct 303 309 +6 search_package_hashtable 122 125 +3 get_status 112 111 -1 status_hashtable 4 - -4 set_status 162 158 -4 package_hashtable 4 - -4 name_hashtable 4 - -4 package_satisfies_dependency 112 106 -6 search_name_hashtable 118 110 -8 configure_package 121 106 -15 remove_package 333 317 -16 search_status_hashtable 133 111 -22 purge_package 247 217 -30 unpack_package 552 521 -31 run_package_script 62 - -62 dpkg_main 3991 3867 -124 ------------------------------------------------------------------------------ (add/remove: 1/4 grow/shrink: 2/10 up/down: 81/-331) Total: -250 bytes text data bss dec hex filename 807972 611 6924 815507 c7193 busybox_old 807603 611 6908 815122 c7012 busybox_unstripped
2008-06-21dpkg: code shrinkDenis Vlasenko
dpkg: add documentation from bug 3644 function old new delta remove_package 318 333 +15 unpack_package 541 552 +11 purge_package 242 247 +5 all_control_list 55 53 -2 all_control_files 44 40 -4 add_split_dependencies 709 703 -6 search_status_hashtable 148 133 -15 search_package_hashtable 137 122 -15 search_name_hashtable 134 118 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/6 up/down: 31/-58) Total: -27 bytes text data bss dec hex filename 808093 611 6924 815628 c720c busybox_old 807972 611 6924 815507 c7193 busybox_unstripped
2008-06-21dpkg: code shrink (by Peter Korsgaard <jacmet@uclibc.org>)Denis Vlasenko
function old new delta create_list 104 86 -18
2008-06-05- The conffiles control file isn't required in Debian packages, so don'tBernhard Reutner-Fischer
error out if it's missing. (Peter Korsgaard)