diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-25 02:13:27 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-25 02:13:27 +0400 |
commit | 503a07cab24a1e58099a04970babd2b761469449 (patch) | |
tree | f96b01fd405adcbcbeed0086389da27bd1a07ccc | |
parent | b2d95147c989448f23cc59c63b83e2d89f0bd9cd (diff) |
Apply post-1.17.0 fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | Config.in | 3 | ||||
-rwxr-xr-x | applets/usage_compressed | 6 | ||||
-rw-r--r-- | archival/Config.src | 2 | ||||
-rw-r--r-- | archival/tar.c | 2 | ||||
-rw-r--r-- | archival/unzip_doc.txt.bz2 | bin | 11359 -> 0 bytes | |||
-rw-r--r-- | coreutils/dos2unix.c | 2 | ||||
-rw-r--r-- | coreutils/realpath.c | 2 | ||||
-rw-r--r-- | debianutils/mktemp.c | 3 | ||||
-rw-r--r-- | e2fsprogs/Config.src | 2 | ||||
-rw-r--r-- | editors/diff.c | 27 | ||||
-rw-r--r-- | editors/vi.c | 20 | ||||
-rw-r--r-- | init/bootchartd.c | 4 | ||||
-rw-r--r-- | libbb/Config.src | 2 | ||||
-rw-r--r-- | libbb/lineedit.c | 2 | ||||
-rw-r--r-- | miscutils/Config.src | 14 | ||||
-rw-r--r-- | modutils/depmod.c | 76 | ||||
-rw-r--r-- | modutils/modprobe.c | 10 | ||||
-rw-r--r-- | networking/ip.c | 62 | ||||
-rw-r--r-- | networking/nc.c | 2 | ||||
-rw-r--r-- | networking/wget.c | 2 | ||||
-rw-r--r-- | procps/top.c | 8 | ||||
-rw-r--r-- | scripts/Makefile.build | 7 | ||||
-rwxr-xr-x | scripts/gen_build_files.sh | 7 | ||||
-rwxr-xr-x | scripts/test_make_O | 11 | ||||
-rwxr-xr-x | testsuite/diff.tests | 31 | ||||
-rw-r--r-- | util-linux/Config.src | 435 | ||||
-rw-r--r-- | util-linux/acpid.c | 18 | ||||
-rw-r--r-- | util-linux/fdisk.c | 2 | ||||
-rw-r--r-- | util-linux/more.c | 4 |
29 files changed, 430 insertions, 336 deletions
@@ -15,7 +15,7 @@ menu "General Configuration" config DESKTOP bool "Enable options for full-blown desktop systems" - default n + default y help Enable options and features which are not essential. Select this only if you plan to use busybox on full-blown @@ -138,6 +138,7 @@ config UNICODE_USING_LOCALE help With this option on, Unicode support is implemented using libc routines. Otherwise, internal implementation is used. + Internal implementation is smaller. config FEATURE_CHECK_UNICODE_IN_ENV bool "Check $LANG environment variable" diff --git a/applets/usage_compressed b/applets/usage_compressed index 9ddf16d38..e1fd0d94d 100755 --- a/applets/usage_compressed +++ b/applets/usage_compressed @@ -40,8 +40,4 @@ echo '#define PACKED_USAGE \' -e 's/$/ \\/' echo '' -if cmp -s "$target.$$" "$target" 2>/dev/null; then - rm -- "$target.$$" -else - mv -- "$target.$$" "$target" -fi +mv -- "$target.$$" "$target" diff --git a/archival/Config.src b/archival/Config.src index f64b3347b..9a84fd6c6 100644 --- a/archival/Config.src +++ b/archival/Config.src @@ -39,7 +39,7 @@ config FEATURE_SEAMLESS_Z config AR bool "ar" - default y + default n # needs to be improved to be able to replace binutils ar help ar is an archival utility program used to create, modify, and extract contents from archives. An archive is a single file holding diff --git a/archival/tar.c b/archival/tar.c index 9dd74536e..5ddff7fa5 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -237,7 +237,7 @@ static int writeTarHeader(struct TarBallInfo *tbInfo, struct tar_header_t header; memset(&header, 0, sizeof(header)); - + strncpy(header.name, header_name, sizeof(header.name)); /* POSIX says to mask mode with 07777. */ diff --git a/archival/unzip_doc.txt.bz2 b/archival/unzip_doc.txt.bz2 Binary files differdeleted file mode 100644 index ab77d10da..000000000 --- a/archival/unzip_doc.txt.bz2 +++ /dev/null diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index 1911f5319..e06ecc4e0 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -92,7 +92,7 @@ int dos2unix_main(int argc UNUSED_PARAM, char **argv) do { /* might be convert(NULL) if there is no filename given */ convert(*argv, conv_type); - } while (*++argv); + } while (*argv && *++argv); return 0; } diff --git a/coreutils/realpath.c b/coreutils/realpath.c index 90a71ed7d..3bc40ee04 100644 --- a/coreutils/realpath.c +++ b/coreutils/realpath.c @@ -23,7 +23,7 @@ int realpath_main(int argc UNUSED_PARAM, char **argv) do { char *resolved_path = xmalloc_realpath(*argv); - if (resolved_path != NULL) { + if (resolved_path != NULL) { puts(resolved_path); free(resolved_path); } else { diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c index c40211476..2c4e19670 100644 --- a/debianutils/mktemp.c +++ b/debianutils/mktemp.c @@ -50,7 +50,8 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv) opts = getopt32(argv, "dqtp:", &path); chp = argv[optind] ? argv[optind] : xstrdup("tmp.XXXXXX"); - chp = concat_path_file(path, chp); + if (chp[0] != '/' || (opts & 8)) + chp = concat_path_file(path, chp); if (opts & 1) { /* -d */ if (mkdtemp(chp) == NULL) diff --git a/e2fsprogs/Config.src b/e2fsprogs/Config.src index f362c6b0a..62bc810f8 100644 --- a/e2fsprogs/Config.src +++ b/e2fsprogs/Config.src @@ -45,7 +45,7 @@ config LSATTR config TUNE2FS bool "tune2fs" - default y + default n # off: it is too limited compared to upstream version help tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2/ext3 filesystems. diff --git a/editors/diff.c b/editors/diff.c index 07594e8d8..a3ca2b660 100644 --- a/editors/diff.c +++ b/editors/diff.c @@ -121,6 +121,7 @@ typedef struct FILE_and_pos_t { struct globals { smallint exit_status; int opt_U_context; + const char *other_dir; char *label[2]; struct stat stb[2]; }; @@ -760,9 +761,11 @@ static int FAST_FUNC add_to_dirlist(const char *filename, void *userdata, int depth UNUSED_PARAM) { struct dlist *const l = userdata; + const char *file = filename + l->len; + while (*file == '/') + file++; l->dl = xrealloc_vector(l->dl, 6, l->e); - /* + 1 skips "/" after dirname */ - l->dl[l->e] = xstrdup(filename + l->len + 1); + l->dl[l->e] = xstrdup(file); l->e++; return TRUE; } @@ -778,6 +781,25 @@ static int FAST_FUNC skip_dir(const char *filename, add_to_dirlist(filename, sb, userdata, depth); return SKIP; } + if (!(option_mask32 & FLAG(N))) { + /* -r without -N: no need to recurse into dirs + * which do not exist on the "other side". + * Testcase: diff -r /tmp / + * (it would recurse deep into /proc without this code) */ + struct dlist *const l = userdata; + filename += l->len; + if (filename[0]) { + struct stat osb; + char *othername = concat_path_file(G.other_dir, filename); + int r = stat(othername, &osb); + free(othername); + if (r != 0 || !S_ISDIR(osb.st_mode)) { + /* other dir doesn't have similarly named + * directory, don't recurse */ + return SKIP; + } + } + } return TRUE; } @@ -791,6 +813,7 @@ static void diffdir(char *p[2], const char *s_start) /*list[i].s = list[i].e = 0; - memset did it */ /*list[i].dl = NULL; */ + G.other_dir = p[1 - i]; /* We need to trim root directory prefix. * Using list.len to specify its length, * add_to_dirlist will remove it. */ diff --git a/editors/vi.c b/editors/vi.c index 0f412c362..73e095cf8 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -504,20 +504,17 @@ static int init_text_buffer(char *fn) } #if ENABLE_FEATURE_VI_WIN_RESIZE -static void query_screen_dimensions(void) +static int query_screen_dimensions(void) { -# if ENABLE_FEATURE_VI_ASK_TERMINAL - if (!G.get_rowcol_error) - G.get_rowcol_error = -# endif - get_terminal_width_height(STDIN_FILENO, &columns, &rows); + int err = get_terminal_width_height(STDIN_FILENO, &columns, &rows); if (rows > MAX_SCR_ROWS) rows = MAX_SCR_ROWS; if (columns > MAX_SCR_COLS) columns = MAX_SCR_COLS; + return err; } #else -# define query_screen_dimensions() ((void)0) +# define query_screen_dimensions() (0) #endif static void edit_file(char *fn) @@ -536,7 +533,7 @@ static void edit_file(char *fn) rows = 24; columns = 80; size = 0; - query_screen_dimensions(); + IF_FEATURE_VI_ASK_TERMINAL(G.get_rowcol_error =) query_screen_dimensions(); #if ENABLE_FEATURE_VI_ASK_TERMINAL if (G.get_rowcol_error /* TODO? && no input on stdin */) { uint64_t k; @@ -546,9 +543,12 @@ static void edit_file(char *fn) if ((int32_t)k == KEYCODE_CURSOR_POS) { uint32_t rc = (k >> 32); columns = (rc & 0x7fff); + if (columns > MAX_SCR_COLS) + columns = MAX_SCR_COLS; rows = ((rc >> 16) & 0x7fff); + if (rows > MAX_SCR_ROWS) + rows = MAX_SCR_ROWS; } - query_screen_dimensions(); } #endif new_screen(rows, columns); // get memory for virtual screen @@ -2797,7 +2797,7 @@ static void refresh(int full_screen) int li, changed; char *tp, *sp; // pointer into text[] and screen[] - if (ENABLE_FEATURE_VI_WIN_RESIZE) { + if (ENABLE_FEATURE_VI_WIN_RESIZE IF_FEATURE_VI_ASK_TERMINAL(&& !G.get_rowcol_error) ) { unsigned c = columns, r = rows; query_screen_dimensions(); full_screen |= (c - columns) | (r - rows); diff --git a/init/bootchartd.c b/init/bootchartd.c index b3e08af92..dae2fe6e9 100644 --- a/init/bootchartd.c +++ b/init/bootchartd.c @@ -18,7 +18,7 @@ //config: and stopped using bootchartd stop. //config: //config:config FEATURE_BOOTCHARTD_BLOATED_HEADER -//config: bool "bootchartd" +//config: bool "Compatible, bloated header" //config: default y //config: depends on BOOTCHARTD //config: help @@ -35,7 +35,7 @@ //config: makes bootchartd applet to dump a subset of it. //config: //config:config FEATURE_BOOTCHARTD_CONFIG_FILE -//config: bool "bootchartd" +//config: bool "Support bootchartd.conf" //config: default y //config: depends on BOOTCHARTD //config: help diff --git a/libbb/Config.src b/libbb/Config.src index 80b1e0d21..09bf89246 100644 --- a/libbb/Config.src +++ b/libbb/Config.src @@ -98,7 +98,7 @@ config FEATURE_USERNAME_COMPLETION config FEATURE_EDITING_FANCY_PROMPT bool "Fancy shell prompts" - default n + default y depends on FEATURE_EDITING help Setting this option allows for prompts to use things like \w and diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 8a2ea7974..a9b790cf7 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -1765,11 +1765,13 @@ static void cmdedit_setwidth(unsigned w, int redraw_flg) static void win_changed(int nsig) { + int sv_errno = errno; unsigned width; get_terminal_width_height(0, &width, NULL); cmdedit_setwidth(width, nsig /* - just a yes/no flag */); if (nsig == SIGWINCH) signal(SIGWINCH, win_changed); /* rearm ourself */ + errno = sv_errno; } static int lineedit_read_key(char *read_key_buffer) diff --git a/miscutils/Config.src b/miscutils/Config.src index 012132e7b..2f7c50271 100644 --- a/miscutils/Config.src +++ b/miscutils/Config.src @@ -276,28 +276,28 @@ config FBSPLASH config FLASHCP bool "flashcp" - default y + default n # doesn't build on Ubuntu 8.04 help The flashcp binary, inspired by mtd-utils as of git head 5eceb74f7. This utility is used to copy images into a MTD device. config FLASH_LOCK bool "flash_lock" - default y + default n # doesn't build on Ubuntu 8.04 help The flash_lock binary from mtd-utils as of git head 5ec0c10d0. This utility locks part or all of the flash device. config FLASH_UNLOCK bool "flash_unlock" - default y + default n # doesn't build on Ubuntu 8.04 help The flash_unlock binary from mtd-utils as of git head 5ec0c10d0. This utility unlocks part or all of the flash device. config FLASH_ERASEALL bool "flash_eraseall" - default y + default n # doesn't build on Ubuntu 8.04 help The flash_eraseall binary from mtd-utils as of git head c4c6a59eb. This utility is used to erase the whole MTD device. @@ -311,7 +311,7 @@ config IONICE config INOTIFYD bool "inotifyd" - default y + default n # doesn't build on Knoppix 5 help Simple inotify daemon. Reports filesystem changes. Requires kernel >= 2.6.13 @@ -549,7 +549,7 @@ config READAHEAD config RFKILL bool "rfkill" - default n + default n # doesn't build on Ubuntu 9.04 help Enable/disable wireless devices. @@ -588,7 +588,7 @@ config STRINGS config TASKSET bool "taskset" - default y + default n # doesn't build on some non-x86 targets (m68k) help Retrieve or set a processes's CPU affinity. This requires sched_{g,s}etaffinity support in your libc. diff --git a/modutils/depmod.c b/modutils/depmod.c index c734f142b..694f9ea5a 100644 --- a/modutils/depmod.c +++ b/modutils/depmod.c @@ -28,16 +28,6 @@ typedef struct module_info { struct module_info *dnext, *dprev; } module_info; -enum { - ARG_a = (1<<0), /* All modules, ignore mods in argv */ - ARG_A = (1<<1), /* Only emit .ko that are newer than modules.dep file */ - ARG_b = (1<<2), /* base directory when modules are in staging area */ - ARG_e = (1<<3), /* with -F, print unresolved symbols */ - ARG_F = (1<<4), /* System.map that contains the symbols */ - ARG_n = (1<<5), /* dry-run, print to stdout only */ - ARG_r = (1<<6) /* Compat dummy. Linux Makefile uses it */ -}; - static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARAM, void *data, int depth UNUSED_PARAM) { @@ -58,7 +48,7 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA *first = info; info->dnext = info->dprev = info; - info->name = xasprintf("/%s", fname); + info->name = xstrdup(fname + 2); /* skip "./" */ info->modname = xstrdup(filename2modname(fname, modname)); for (ptr = image; ptr < image + len - 10; ptr++) { if (strncmp(ptr, "depends=", 8) == 0) { @@ -134,10 +124,44 @@ static void xfreopen_write(const char *file, FILE *f) bb_perror_msg_and_die("can't open '%s'", file); } +/* Usage: + * [-aAenv] [-C FILE or DIR] [-b BASE] [-F System.map] [VERSION] [MODFILES]... + * -a --all + * Probe all modules. Default if no MODFILES. + * -A --quick + * Check modules.dep's mtime against module files' mtimes. + * -b --basedir BASE + * Use $BASE/lib/modules/VERSION + * -C --config FILE or DIR + * Path to /etc/depmod.conf or /etc/depmod.d/ + * -e --errsyms + * When combined with the -F option, this reports any symbols which + * which are not supplied by other modules or kernel. + * -F --filesyms System.map + * -n --dry-run + * Print modules.dep etc to standard output + * -v --verbose + * Print to stdout all the symbols each module depends on + * and the module's file name which provides that symbol. + * -r No-op + * + * So far we only support: [-rn] [-b BASE] [VERSION] [MODFILES]... + * -aAeF are accepted but ignored. -vC are not accepted. + */ +enum { + //OPT_a = (1 << 0), /* All modules, ignore mods in argv */ + //OPT_A = (1 << 1), /* Only emit .ko that are newer than modules.dep file */ + OPT_b = (1 << 2), /* base directory when modules are in staging area */ + //OPT_e = (1 << 3), /* with -F, print unresolved symbols */ + //OPT_F = (1 << 4), /* System.map that contains the symbols */ + OPT_n = (1 << 5), /* dry-run, print to stdout only */ + OPT_r = (1 << 6) /* Compat dummy. Linux Makefile uses it */ +}; + int depmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int depmod_main(int argc UNUSED_PARAM, char **argv) { - module_info *modules = NULL, *m, *dep; + module_info *modules, *m, *dep; const char *moddir_base = "/"; char *moddir, *version; struct utsname uts; @@ -152,36 +176,30 @@ int depmod_main(int argc UNUSED_PARAM, char **argv) /* If a version is provided, then that kernel version's module directory * is used, rather than the current kernel version (as returned by * "uname -r"). */ - if (*argv && sscanf(*argv, "%d.%d.%d", &tmp, &tmp, &tmp) == 3) { + if (*argv && sscanf(*argv, "%u.%u.%u", &tmp, &tmp, &tmp) == 3) { version = *argv++; } else { uname(&uts); version = uts.release; } moddir = concat_path_file(&CONFIG_DEFAULT_MODULES_DIR[1], version); + xchdir(moddir); + if (ENABLE_FEATURE_CLEAN_UP) + free(moddir); /* Scan modules */ + modules = NULL; if (*argv) { - char *modfile; - struct stat sb; do { - modfile = concat_path_file(moddir, *argv); - xstat(modfile, &sb); - parse_module(modfile, &sb, &modules, 0); - free(modfile); - } while (*(++argv)); + parse_module(*argv, /*sb (unused):*/ NULL, &modules, 0); + } while (*++argv); } else { - recursive_action(moddir, ACTION_RECURSE, + recursive_action(".", ACTION_RECURSE, parse_module, NULL, &modules, 0); } - /* Prepare for writing out the dep files */ - xchdir(moddir); - if (ENABLE_FEATURE_CLEAN_UP) - free(moddir); - /* Generate dependency and alias files */ - if (!(option_mask32 & ARG_n)) + if (!(option_mask32 & OPT_n)) xfreopen_write(CONFIG_DEFAULT_DEPMOD_FILE, stdout); for (m = modules; m != NULL; m = m->next) { printf("%s:", m->name); @@ -200,7 +218,7 @@ int depmod_main(int argc UNUSED_PARAM, char **argv) } #if ENABLE_FEATURE_MODUTILS_ALIAS - if (!(option_mask32 & ARG_n)) + if (!(option_mask32 & OPT_n)) xfreopen_write("modules.alias", stdout); for (m = modules; m != NULL; m = m->next) { const char *fname = bb_basename(m->name); @@ -218,7 +236,7 @@ int depmod_main(int argc UNUSED_PARAM, char **argv) } #endif #if ENABLE_FEATURE_MODUTILS_SYMBOLS - if (!(option_mask32 & ARG_n)) + if (!(option_mask32 & OPT_n)) xfreopen_write("modules.symbols", stdout); for (m = modules; m != NULL; m = m->next) { const char *fname = bb_basename(m->name); diff --git a/modutils/modprobe.c b/modutils/modprobe.c index b4de65b1f..0a9424293 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -483,6 +483,11 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) opt = getopt32(argv, INSMOD_OPTS MODPROBE_OPTS INSMOD_ARGS); argv += optind; + /* Goto modules location */ + xchdir(CONFIG_DEFAULT_MODULES_DIR); + uname(&uts); + xchdir(uts.release); + if (opt & MODPROBE_OPT_LIST_ONLY) { char name[MODULE_NAME_LEN]; char *colon, *tokens[2]; @@ -524,11 +529,6 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) return EXIT_SUCCESS; } - /* Goto modules location */ - xchdir(CONFIG_DEFAULT_MODULES_DIR); - uname(&uts); - xchdir(uts.release); - /* Retrieve module names of already loaded modules */ { char *s; diff --git a/networking/ip.c b/networking/ip.c index 7a0f308f0..3a99fa320 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -1,14 +1,12 @@ /* vi: set sw=4 ts=4: */ /* - * ip.c "ip" utility frontend. + * "ip" utility frontend. * * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. * - * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> - * + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> * * Changes: - * * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses * Bernhard Reutner-Fischer rewrote to use index_in_substr_array */ @@ -24,12 +22,14 @@ || ENABLE_FEATURE_IP_TUNNEL \ || ENABLE_FEATURE_IP_RULE -static int NORETURN ip_print_help(char **argv UNUSED_PARAM) +static int ip_print_help(char **argv UNUSED_PARAM) { bb_show_usage(); } -static int ip_do(int (*ip_func)(char **argv), char **argv) +typedef int (*ip_func_ptr_t)(char**); + +static int ip_do(ip_func_ptr_t ip_func, char **argv) { argv = ip_parse_common_args(argv + 1); return ip_func(argv); @@ -78,45 +78,29 @@ int ip_main(int argc UNUSED_PARAM, char **argv) static const char keywords[] ALIGN1 = IF_FEATURE_IP_ADDRESS("address\0") IF_FEATURE_IP_ROUTE("route\0") + IF_FEATURE_IP_ROUTE("r\0") IF_FEATURE_IP_LINK("link\0") - IF_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0") + IF_FEATURE_IP_TUNNEL("tunnel\0") + IF_FEATURE_IP_TUNNEL("tunl\0") IF_FEATURE_IP_RULE("rule\0") ; - enum { - IF_FEATURE_IP_ADDRESS(IP_addr,) - IF_FEATURE_IP_ROUTE(IP_route,) - IF_FEATURE_IP_LINK(IP_link,) - IF_FEATURE_IP_TUNNEL(IP_tunnel, IP_tunl,) - IF_FEATURE_IP_RULE(IP_rule,) - IP_none + static const ip_func_ptr_t ip_func_ptrs[] = { + ip_print_help, + IF_FEATURE_IP_ADDRESS(do_ipaddr,) + IF_FEATURE_IP_ROUTE(do_iproute,) + IF_FEATURE_IP_ROUTE(do_iproute,) + IF_FEATURE_IP_LINK(do_iplink,) + IF_FEATURE_IP_TUNNEL(do_iptunnel,) + IF_FEATURE_IP_TUNNEL(do_iptunnel,) + IF_FEATURE_IP_RULE(do_iprule,) }; - int (*ip_func)(char**) = ip_print_help; + ip_func_ptr_t ip_func; + int key; argv = ip_parse_common_args(argv + 1); - if (*argv) { - int key = index_in_substrings(keywords, *argv); - argv++; -#if ENABLE_FEATURE_IP_ADDRESS - if (key == IP_addr) - ip_func = do_ipaddr; -#endif -#if ENABLE_FEATURE_IP_ROUTE - if (key == IP_route) - ip_func = do_iproute; -#endif -#if ENABLE_FEATURE_IP_LINK - if (key == IP_link) - ip_func = do_iplink; -#endif -#if ENABLE_FEATURE_IP_TUNNEL - if (key == IP_tunnel || key == IP_tunl) - ip_func = do_iptunnel; -#endif -#if ENABLE_FEATURE_IP_RULE - if (key == IP_rule) - ip_func = do_iprule; -#endif - } + key = *argv ? index_in_substrings(keywords, *argv++) : -1; + ip_func = ip_func_ptrs[key + 1]; + return ip_func(argv); } diff --git a/networking/nc.c b/networking/nc.c index 0dacaf117..c77137480 100644 --- a/networking/nc.c +++ b/networking/nc.c @@ -34,7 +34,7 @@ //config: //config:config NC_110_COMPAT //config: bool "Netcat 1.10 compatibility (+2.5k)" -//config: default y +//config: default n # off specially for Rob //config: depends on NC //config: help //config: This option makes nc closely follow original nc-1.10. diff --git a/networking/wget.c b/networking/wget.c index f55b68a38..1f35f8b03 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -50,7 +50,7 @@ static void progress_meter(int flag) } bb_progress_update(&G.pmt, G.curfile, G.beg_range, G.transferred, - G.chunked ? 0 : G.content_len + G.beg_range); + G.chunked ? 0 : G.beg_range + G.transferred + G.content_len); if (flag == 0) { /* last call to progress_meter */ diff --git a/procps/top.c b/procps/top.c index 04dd82633..ec8437442 100644 --- a/procps/top.c +++ b/procps/top.c @@ -686,10 +686,10 @@ static int topmem_sort(char *a, char *b) n = offsetof(topmem_status_t, vsz) + (sort_field * sizeof(mem_t)); l = *(mem_t*)(a + n); r = *(mem_t*)(b + n); -// if (l == r) { -// l = a->mapped_rw; -// r = b->mapped_rw; -// } + if (l == r) { + l = ((topmem_status_t*)a)->dirty; + r = ((topmem_status_t*)b)->dirty; + } /* We want to avoid unsigned->signed and truncation errors */ /* l>r: -1, l=r: 0, l<r: 1 */ n = (l > r) ? -1 : (l != r); diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f343818b1..5685b5bcc 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -13,8 +13,13 @@ __build: include scripts/Kbuild.include # The filename Kbuild has precedence over Makefile +# bbox: we also try to include Kbuild file in obj tree first kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) -include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) +include $(if $(wildcard $(src)/Kbuild), $(src)/Kbuild, \ + $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, \ + $(kbuild-dir)/Makefile \ + ) \ + ) include scripts/Makefile.lib diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index a98f509ce..18c172d5a 100755 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh @@ -4,6 +4,8 @@ test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; } # cd to objtree cd -- "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; } +# In separate objtree build, include/ might not exist yet +mkdir include 2>/dev/null srctree="$1" @@ -46,11 +48,13 @@ if test x"$new" != x"$old"; then fi # (Re)generate */Kbuild and */Config.in -find -type d | while read -r d; do +{ cd -- "$srctree" && find -type d; } | while read -r d; do d="${d#./}" + src="$srctree/$d/Kbuild.src" dst="$d/Kbuild" if test -f "$src"; then + mkdir -p -- "$d" 2>/dev/null #echo " CHK $dst" s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c` @@ -70,6 +74,7 @@ find -type d | while read -r d; do src="$srctree/$d/Config.src" dst="$d/Config.in" if test -f "$src"; then + mkdir -p -- "$d" 2>/dev/null #echo " CHK $dst" s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c` diff --git a/scripts/test_make_O b/scripts/test_make_O new file mode 100755 index 000000000..a0ee6a868 --- /dev/null +++ b/scripts/test_make_O @@ -0,0 +1,11 @@ +#!/bin/sh + +b=`basename $PWD` +test "${b#busybox}" != "$b" || { echo "Must be run in busybox tree"; exit 1; } + +rm -rf ../testdir_make_O.$$ +mkdir ../testdir_make_O.$$ +odir=`cd ../testdir_make_O.$$ && pwd` +test -d "$odir" || exit 1 + +make O="$odir" $MAKEOPTS "$@" defconfig busybox 2>&1 | tee test_make_O.log diff --git a/testsuite/diff.tests b/testsuite/diff.tests index 06d5a4fd7..27a4b33a7 100755 --- a/testsuite/diff.tests +++ b/testsuite/diff.tests @@ -4,7 +4,7 @@ . ./testing.sh -# testing "test name" "options" "expected result" "file input" "stdin" +# testing "test name" "commands" "expected result" "file input" "stdin" # diff outputs date/time in the header, which should not be analysed # NB: sed has tab character in s command! @@ -100,9 +100,11 @@ testing "diff always takes context from old file" \ "abc\na c\ndef\n" \ "a c\n" -# testing "test name" "options" "expected result" "file input" "stdin" +# testing "test name" "commands" "expected result" "file input" "stdin" +# clean up rm -rf diff1 diff2 + mkdir diff1 diff2 diff2/subdir echo qwe >diff1/- echo asd >diff2/subdir/- @@ -187,4 +189,29 @@ SKIP= # clean up rm -rf diff1 diff2 +# NOT using directory structure from prev test... +mkdir diff1 diff2 +echo qwe >diff1/- +echo rty >diff2/- +optional FEATURE_DIFF_DIR +testing "diff diff1 diff2/" \ + "diff -ur diff1 diff2/ | $TRIM_TAB; diff -ur .///diff1 diff2//// | $TRIM_TAB" \ +"\ +--- diff1/- ++++ diff2/- +@@ -1 +1 @@ +-qwe ++rty +--- .///diff1/- ++++ diff2////- +@@ -1 +1 @@ +-qwe ++rty +" \ + "" "" +SKIP= + +# clean up +rm -rf diff1 diff2 + exit $FAILCOUNT diff --git a/util-linux/Config.src b/util-linux/Config.src index 3c3e05ec4..91d1fc2ce 100644 --- a/util-linux/Config.src +++ b/util-linux/Config.src @@ -470,221 +470,6 @@ config FEATURE_USE_TERMIOS will be unable to determine the current screen size, and will be unable to move the cursor. -config VOLUMEID - bool #No description makes it a hidden option - default n - -config FEATURE_VOLUMEID_EXT - bool "Ext filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_BTRFS - bool "btrfs filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_REISERFS - bool "Reiser filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_FAT - bool "fat filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_HFS - bool "hfs filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_JFS - bool "jfs filesystem" - default y - depends on VOLUMEID - help - TODO - -### config FEATURE_VOLUMEID_UFS -### bool "ufs filesystem" -### default y -### depends on VOLUMEID -### help -### TODO - -config FEATURE_VOLUMEID_XFS - bool "xfs filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_NTFS - bool "ntfs filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_ISO9660 - bool "iso9660 filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_UDF - bool "udf filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_LUKS - bool "luks filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_LINUXSWAP - bool "linux swap filesystem" - default y - depends on VOLUMEID - help - TODO - -### config FEATURE_VOLUMEID_LVM -### bool "lvm" -### default y -### depends on VOLUMEID -### help -### TODO - -config FEATURE_VOLUMEID_CRAMFS - bool "cramfs filesystem" - default y - depends on VOLUMEID - help - TODO - -### config FEATURE_VOLUMEID_HPFS -### bool "hpfs filesystem" -### default y -### depends on VOLUMEID -### help -### TODO - -config FEATURE_VOLUMEID_ROMFS - bool "romfs filesystem" - default y - depends on VOLUMEID - help - TODO - -config FEATURE_VOLUMEID_SYSV - bool "sysv filesystem" - default y - depends on VOLUMEID - help - TODO - -### config FEATURE_VOLUMEID_MINIX -### bool "minix filesystem" -### default y -### depends on VOLUMEID -### help -### TODO - -### These only detect partition tables - not used (yet?) -### config FEATURE_VOLUMEID_MAC -### bool "mac filesystem" -### default y -### depends on VOLUMEID -### help -### TODO -### -### config FEATURE_VOLUMEID_MSDOS -### bool "msdos filesystem" -### default y -### depends on VOLUMEID -### help -### TODO - -config FEATURE_VOLUMEID_OCFS2 - bool "ocfs2 filesystem" - default y - depends on VOLUMEID - help - TODO - -### config FEATURE_VOLUMEID_HIGHPOINTRAID -### bool "highpoint raid" -### default y -### depends on VOLUMEID -### help -### TODO - -### config FEATURE_VOLUMEID_ISWRAID -### bool "intel raid" -### default y -### depends on VOLUMEID -### help -### TODO - -### config FEATURE_VOLUMEID_LSIRAID -### bool "lsi raid" -### default y -### depends on VOLUMEID -### help -### TODO - -### config FEATURE_VOLUMEID_VIARAID -### bool "via raid" -### default y -### depends on VOLUMEID -### help -### TODO - -### config FEATURE_VOLUMEID_SILICONRAID -### bool "silicon raid" -### default y -### depends on VOLUMEID -### help -### TODO - -### config FEATURE_VOLUMEID_NVIDIARAID -### bool "nvidia raid" -### default y -### depends on VOLUMEID -### help -### TODO - -### config FEATURE_VOLUMEID_PROMISERAID -### bool "promise raid" -### default y -### depends on VOLUMEID -### help -### TODO - -config FEATURE_VOLUMEID_LINUXRAID - bool "linuxraid" - default y - depends on VOLUMEID - help - TODO - config MOUNT bool "mount" default y @@ -937,4 +722,224 @@ config FEATURE_MTAB_SUPPORT About the only reason to use this is if you've removed /proc from your kernel. +config VOLUMEID + bool #No description makes it a hidden option + default n + +menu "Filesystem/Volume identification" + depends on VOLUMEID + +config FEATURE_VOLUMEID_EXT + bool "Ext filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_BTRFS + bool "btrfs filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_REISERFS + bool "Reiser filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_FAT + bool "fat filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_HFS + bool "hfs filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_JFS + bool "jfs filesystem" + default y + depends on VOLUMEID + help + TODO + +### config FEATURE_VOLUMEID_UFS +### bool "ufs filesystem" +### default y +### depends on VOLUMEID +### help +### TODO + +config FEATURE_VOLUMEID_XFS + bool "xfs filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_NTFS + bool "ntfs filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_ISO9660 + bool "iso9660 filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_UDF + bool "udf filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_LUKS + bool "luks filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_LINUXSWAP + bool "linux swap filesystem" + default y + depends on VOLUMEID + help + TODO + +### config FEATURE_VOLUMEID_LVM +### bool "lvm" +### default y +### depends on VOLUMEID +### help +### TODO + +config FEATURE_VOLUMEID_CRAMFS + bool "cramfs filesystem" + default y + depends on VOLUMEID + help + TODO + +### config FEATURE_VOLUMEID_HPFS +### bool "hpfs filesystem" +### default y +### depends on VOLUMEID +### help +### TODO + +config FEATURE_VOLUMEID_ROMFS + bool "romfs filesystem" + default y + depends on VOLUMEID + help + TODO + +config FEATURE_VOLUMEID_SYSV + bool "sysv filesystem" + default y + depends on VOLUMEID + help + TODO + +### config FEATURE_VOLUMEID_MINIX +### bool "minix filesystem" +### default y +### depends on VOLUMEID +### help +### TODO + +### These only detect partition tables - not used (yet?) +### config FEATURE_VOLUMEID_MAC +### bool "mac filesystem" +### default y +### depends on VOLUMEID +### help +### TODO +### +### config FEATURE_VOLUMEID_MSDOS +### bool "msdos filesystem" +### default y +### depends on VOLUMEID +### help +### TODO + +config FEATURE_VOLUMEID_OCFS2 + bool "ocfs2 filesystem" + default y + depends on VOLUMEID + help + TODO + +### config FEATURE_VOLUMEID_HIGHPOINTRAID +### bool "highpoint raid" +### default y +### depends on VOLUMEID +### help +### TODO + +### config FEATURE_VOLUMEID_ISWRAID +### bool "intel raid" +### default y +### depends on VOLUMEID +### help +### TODO + +### config FEATURE_VOLUMEID_LSIRAID +### bool "lsi raid" +### default y +### depends on VOLUMEID +### help +### TODO + +### config FEATURE_VOLUMEID_VIARAID +### bool "via raid" +### default y +### depends on VOLUMEID +### help +### TODO + +### config FEATURE_VOLUMEID_SILICONRAID +### bool "silicon raid" +### default y +### depends on VOLUMEID +### help +### TODO + +### config FEATURE_VOLUMEID_NVIDIARAID +### bool "nvidia raid" +### default y +### depends on VOLUMEID +### help +### TODO + +### config FEATURE_VOLUMEID_PROMISERAID +### bool "promise raid" +### default y +### depends on VOLUMEID +### help +### TODO + +config FEATURE_VOLUMEID_LINUXRAID + bool "linuxraid" + default y + depends on VOLUMEID + help + TODO + +endmenu + endmenu diff --git a/util-linux/acpid.c b/util-linux/acpid.c index 342930964..11a9f624a 100644 --- a/util-linux/acpid.c +++ b/util-linux/acpid.c @@ -9,9 +9,25 @@ #include "libbb.h" #include <linux/input.h> +#ifndef EV_SW +# define EV_SW 0x05 +#endif +#ifndef EV_KEY +# define EV_KEY 0x01 +#endif +#ifndef SW_LID +# define SW_LID 0x00 +#endif #ifndef SW_RFKILL_ALL -# define SW_RFKILL_ALL 3 +# define SW_RFKILL_ALL 0x03 #endif +#ifndef KEY_POWER +# define KEY_POWER 116 /* SC System Power Down */ +#endif +#ifndef KEY_SLEEP +# define KEY_SLEEP 142 /* SC System Sleep */ +#endif + /* * acpid listens to ACPI events coming either in textual form diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 7227a829e..aa718c787 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -2805,7 +2805,7 @@ list_devs_in_proc_partititons(void) &ma, &mi, &sz, ptname) != 4) continue; for (s = ptname; *s; s++) - continue; + continue; /* note: excluding '0': e.g. mmcblk0 is not a partition name! */ if (s[-1] >= '1' && s[-1] <= '9') continue; diff --git a/util-linux/more.c b/util-linux/more.c index 55694e434..9216b6137 100644 --- a/util-linux/more.c +++ b/util-linux/more.c @@ -31,7 +31,7 @@ struct globals { #define setTermSettings(fd, argp) do { \ if (ENABLE_FEATURE_USE_TERMIOS) tcsetattr(fd, TCSANOW, argp); \ - } while(0) + } while (0) #define getTermSettings(fd, argp) tcgetattr(fd, argp) static void gotsig(int sig UNUSED_PARAM) @@ -46,7 +46,7 @@ static void gotsig(int sig UNUSED_PARAM) int more_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int more_main(int argc UNUSED_PARAM, char **argv) { - int c = c; /* for gcc */ + int c = c; /* for compiler */ int lines; int input = 0; int spaces = 0; |