aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-04-23 10:57:02 +0100
committerRon Yorston <rmy@pobox.com>2012-04-23 10:57:02 +0100
commit2903c15333636ae51db14cab009533bac68c8a30 (patch)
tree11a49598f98c505c021202564348c5639e2fb0b1
parent5fc2c035953f71992197f6025918a8fe79ade1d3 (diff)
parentf5234398ef3010b68468cafe3e2ea89b2bb08a17 (diff)
downloadbusybox-w32-2903c15333636ae51db14cab009533bac68c8a30.tar.gz
busybox-w32-2903c15333636ae51db14cab009533bac68c8a30.tar.bz2
busybox-w32-2903c15333636ae51db14cab009533bac68c8a30.zip
Merge commit '1_20_0' into merge
-rw-r--r--INSTALL5
-rw-r--r--Makefile2
-rw-r--r--Makefile.flags5
-rw-r--r--archival/libarchive/Kbuild.src2
-rw-r--r--coreutils/who.c1
-rw-r--r--debianutils/mktemp.c23
-rw-r--r--e2fsprogs/e2fs_lib.h2
-rw-r--r--e2fsprogs/old_e2fsprogs/e2fsck.c6
-rw-r--r--e2fsprogs/old_e2fsprogs/e2p/feature.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/ext2fs/ext2_fs.h2
-rw-r--r--e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h2
-rw-r--r--e2fsprogs/old_e2fsprogs/ext2fs/initialize.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/mke2fs.c8
-rw-r--r--e2fsprogs/tune2fs.c2
-rw-r--r--include/bb_e2fs_defs.h (renamed from e2fsprogs/e2fs_defs.h)2
-rw-r--r--libbb/Kbuild.src1
-rw-r--r--libbb/lineedit.c2
-rw-r--r--miscutils/less.c13
-rw-r--r--networking/hostname.c2
-rw-r--r--networking/httpd.c6
-rw-r--r--networking/ntpd.c23
-rw-r--r--networking/udhcp/arpping.c9
-rw-r--r--networking/udhcp/d6_common.h4
-rw-r--r--networking/udhcp/d6_dhcpc.c2
-rw-r--r--networking/udhcp/dhcpc.c1
-rw-r--r--procps/kill.c6
-rw-r--r--procps/lsof.c76
-rwxr-xr-xscripts/bloat-o-meter23
-rwxr-xr-xscripts/randomtest.loop12
-rw-r--r--shell/hush.c6
-rw-r--r--util-linux/hwclock.c2
-rw-r--r--util-linux/mdev.c8
-rw-r--r--util-linux/mkfs_ext2.c2
-rw-r--r--util-linux/mount.c6
-rw-r--r--util-linux/umount.c24
35 files changed, 209 insertions, 85 deletions
diff --git a/INSTALL b/INSTALL
index f93e5fb25..750cfc45b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -47,8 +47,11 @@ the only commands busybox can find are the built-in ones.
47 47
48Note that the standalone shell requires CONFIG_BUSYBOX_EXEC_PATH 48Note that the standalone shell requires CONFIG_BUSYBOX_EXEC_PATH
49to be set appropriately, depending on whether or not /proc/self/exe is 49to be set appropriately, depending on whether or not /proc/self/exe is
50available or not. If you do not have /proc, then point that config option 50available. If you do not have /proc, then point that config option
51to the location of your busybox binary, usually /bin/busybox. 51to the location of your busybox binary, usually /bin/busybox.
52Another solution is to patch the kernel (see
53examples/linux-*_proc_self_exe.patch) to make exec("/proc/self/exe")
54always work.
52 55
53Configuring Busybox: 56Configuring Busybox:
54==================== 57====================
diff --git a/Makefile b/Makefile
index bc05f3a27..cfe4d5219 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 1 1VERSION = 1
2PATCHLEVEL = 20 2PATCHLEVEL = 20
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = .git 4EXTRAVERSION =
5NAME = Unnamed 5NAME = Unnamed
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/Makefile.flags b/Makefile.flags
index 2a3aa5812..0eb495c60 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -114,7 +114,10 @@ endif
114endif 114endif
115 115
116# Android has no separate crypt library 116# Android has no separate crypt library
117CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' | $(CC) $(CFLAGS) -lcrypt -o /dev/null -xc - >/dev/null 2>&1 && echo "y") 117# gcc-4.2.1 fails if we try to feed C source on stdin:
118# echo 'int main(void){return 0;}' | $(CC) $(CFLAGS) -lcrypt -o /dev/null -xc -
119# fall back to using a temp file:
120CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >crypttest.c; $(CC) $(CFLAGS) -lcrypt -o /dev/null crypttest.c >/dev/null 2>&1 && echo "y"; rm crypttest.c)
118ifeq ($(CRYPT_AVAILABLE),y) 121ifeq ($(CRYPT_AVAILABLE),y)
119LDLIBS += m crypt 122LDLIBS += m crypt
120else 123else
diff --git a/archival/libarchive/Kbuild.src b/archival/libarchive/Kbuild.src
index 39c18f264..959221789 100644
--- a/archival/libarchive/Kbuild.src
+++ b/archival/libarchive/Kbuild.src
@@ -53,6 +53,8 @@ lib-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o
53lib-$(CONFIG_UNZIP) += decompress_gunzip.o 53lib-$(CONFIG_UNZIP) += decompress_gunzip.o
54lib-$(CONFIG_LZOP) += lzo1x_1.o lzo1x_1o.o lzo1x_d.o 54lib-$(CONFIG_LZOP) += lzo1x_1.o lzo1x_1o.o lzo1x_d.o
55lib-$(CONFIG_LZOP_COMPR_HIGH) += lzo1x_9x.o 55lib-$(CONFIG_LZOP_COMPR_HIGH) += lzo1x_9x.o
56lib-$(CONFIG_MODINFO) += open_transformer.o
57lib-$(CONFIG_INSMOD) += open_transformer.o
56lib-$(CONFIG_FEATURE_SEAMLESS_Z) += open_transformer.o decompress_uncompress.o 58lib-$(CONFIG_FEATURE_SEAMLESS_Z) += open_transformer.o decompress_uncompress.o
57lib-$(CONFIG_FEATURE_SEAMLESS_GZ) += open_transformer.o decompress_gunzip.o 59lib-$(CONFIG_FEATURE_SEAMLESS_GZ) += open_transformer.o decompress_gunzip.o
58lib-$(CONFIG_FEATURE_SEAMLESS_BZ2) += open_transformer.o decompress_bunzip2.o 60lib-$(CONFIG_FEATURE_SEAMLESS_BZ2) += open_transformer.o decompress_bunzip2.o
diff --git a/coreutils/who.c b/coreutils/who.c
index c6c925264..f955ce6d3 100644
--- a/coreutils/who.c
+++ b/coreutils/who.c
@@ -48,6 +48,7 @@
48//usage:#define who_full_usage "\n\n" 48//usage:#define who_full_usage "\n\n"
49//usage: "Show who is logged on\n" 49//usage: "Show who is logged on\n"
50//usage: "\n -a Show all" 50//usage: "\n -a Show all"
51//usage: "\n -H Print column headers"
51 52
52#include "libbb.h" 53#include "libbb.h"
53 54
diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c
index 007cb1c5b..dbe430955 100644
--- a/debianutils/mktemp.c
+++ b/debianutils/mktemp.c
@@ -41,6 +41,7 @@
41////usage: "\n -q Fail silently on errors" - we ignore this opt 41////usage: "\n -q Fail silently on errors" - we ignore this opt
42//usage: "\n -t Prepend base directory name to TEMPLATE" 42//usage: "\n -t Prepend base directory name to TEMPLATE"
43//usage: "\n -p DIR Use DIR as a base directory (implies -t)" 43//usage: "\n -p DIR Use DIR as a base directory (implies -t)"
44//usage: "\n -u Do not create anything; print a name"
44//usage: "\n" 45//usage: "\n"
45//usage: "\nBase directory is: -p DIR, else $TMPDIR, else /tmp" 46//usage: "\nBase directory is: -p DIR, else $TMPDIR, else /tmp"
46//usage: 47//usage:
@@ -63,6 +64,7 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
63 OPT_q = 1 << 1, 64 OPT_q = 1 << 1,
64 OPT_t = 1 << 2, 65 OPT_t = 1 << 2,
65 OPT_p = 1 << 3, 66 OPT_p = 1 << 3,
67 OPT_u = 1 << 4,
66 }; 68 };
67 69
68 path = getenv("TMPDIR"); 70 path = getenv("TMPDIR");
@@ -71,7 +73,7 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
71 73
72 /* -q is ignored */ 74 /* -q is ignored */
73 opt_complementary = "?1"; /* 1 argument max */ 75 opt_complementary = "?1"; /* 1 argument max */
74 opts = getopt32(argv, "dqtp:", &path); 76 opts = getopt32(argv, "dqtp:u", &path);
75 77
76 chp = argv[optind]; 78 chp = argv[optind];
77 if (!chp) { 79 if (!chp) {
@@ -81,6 +83,22 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
81 chp = xstrdup("tmp.XXXXXX"); 83 chp = xstrdup("tmp.XXXXXX");
82 opts |= OPT_t; 84 opts |= OPT_t;
83 } 85 }
86
87 if (opts & OPT_u) {
88 /* Remove (up to) 6 X's */
89 unsigned len = strlen(chp);
90 int cnt = len > 6 ? 6 : len;
91 while (--cnt >= 0 && chp[--len] == 'X')
92 chp[len] = '\0';
93
94 chp = tempnam(opts & (OPT_t|OPT_p) ? path : "./", chp);
95 if (!chp)
96 return EXIT_FAILURE;
97 if (!(opts & (OPT_t|OPT_p)))
98 chp += 2;
99 goto ret;
100 }
101
84 if (opts & (OPT_t|OPT_p)) 102 if (opts & (OPT_t|OPT_p))
85 chp = concat_path_file(path, chp); 103 chp = concat_path_file(path, chp);
86 104
@@ -91,8 +109,7 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
91 if (mkstemp(chp) < 0) 109 if (mkstemp(chp) < 0)
92 return EXIT_FAILURE; 110 return EXIT_FAILURE;
93 } 111 }
94 112 ret:
95 puts(chp); 113 puts(chp);
96
97 return EXIT_SUCCESS; 114 return EXIT_SUCCESS;
98} 115}
diff --git a/e2fsprogs/e2fs_lib.h b/e2fsprogs/e2fs_lib.h
index 3905ee71d..f2ae56f43 100644
--- a/e2fsprogs/e2fs_lib.h
+++ b/e2fsprogs/e2fs_lib.h
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9/* Constants and structures */ 9/* Constants and structures */
10#include "e2fs_defs.h" 10#include "bb_e2fs_defs.h"
11 11
12PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 12PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
13 13
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c
index 8fffa7f20..373e8ce91 100644
--- a/e2fsprogs/old_e2fsprogs/e2fsck.c
+++ b/e2fsprogs/old_e2fsprogs/e2fsck.c
@@ -11577,7 +11577,7 @@ static void check_resize_inode(e2fsck_t ctx)
11577 * s_reserved_gdt_blocks must be zero. 11577 * s_reserved_gdt_blocks must be zero.
11578 */ 11578 */
11579 if (!(fs->super->s_feature_compat & 11579 if (!(fs->super->s_feature_compat &
11580 EXT2_FEATURE_COMPAT_RESIZE_INODE)) { 11580 EXT2_FEATURE_COMPAT_RESIZE_INO)) {
11581 if (fs->super->s_reserved_gdt_blocks) { 11581 if (fs->super->s_reserved_gdt_blocks) {
11582 pctx.num = fs->super->s_reserved_gdt_blocks; 11582 pctx.num = fs->super->s_reserved_gdt_blocks;
11583 if (fix_problem(ctx, PR_0_NONZERO_RESERVED_GDT_BLOCKS, 11583 if (fix_problem(ctx, PR_0_NONZERO_RESERVED_GDT_BLOCKS,
@@ -11593,7 +11593,7 @@ static void check_resize_inode(e2fsck_t ctx)
11593 retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode); 11593 retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode);
11594 if (retval) { 11594 if (retval) {
11595 if (fs->super->s_feature_compat & 11595 if (fs->super->s_feature_compat &
11596 EXT2_FEATURE_COMPAT_RESIZE_INODE) 11596 EXT2_FEATURE_COMPAT_RESIZE_INO)
11597 ctx->flags |= E2F_FLAG_RESIZE_INODE; 11597 ctx->flags |= E2F_FLAG_RESIZE_INODE;
11598 return; 11598 return;
11599 } 11599 }
@@ -11603,7 +11603,7 @@ static void check_resize_inode(e2fsck_t ctx)
11603 * the resize inode is cleared; then we're done. 11603 * the resize inode is cleared; then we're done.
11604 */ 11604 */
11605 if (!(fs->super->s_feature_compat & 11605 if (!(fs->super->s_feature_compat &
11606 EXT2_FEATURE_COMPAT_RESIZE_INODE)) { 11606 EXT2_FEATURE_COMPAT_RESIZE_INO)) {
11607 for (i=0; i < EXT2_N_BLOCKS; i++) { 11607 for (i=0; i < EXT2_N_BLOCKS; i++) {
11608 if (inode.i_block[i]) 11608 if (inode.i_block[i])
11609 break; 11609 break;
diff --git a/e2fsprogs/old_e2fsprogs/e2p/feature.c b/e2fsprogs/old_e2fsprogs/e2p/feature.c
index b45754f97..2102ed8e7 100644
--- a/e2fsprogs/old_e2fsprogs/e2p/feature.c
+++ b/e2fsprogs/old_e2fsprogs/e2p/feature.c
@@ -34,7 +34,7 @@ static const struct feature feature_list[] = {
34 "ext_attr" }, 34 "ext_attr" },
35 { E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_DIR_INDEX, 35 { E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_DIR_INDEX,
36 "dir_index" }, 36 "dir_index" },
37 { E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_RESIZE_INODE, 37 { E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_RESIZE_INO,
38 "resize_inode" }, 38 "resize_inode" },
39 { E2P_FEATURE_RO_INCOMPAT, EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER, 39 { E2P_FEATURE_RO_INCOMPAT, EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER,
40 "sparse_super" }, 40 "sparse_super" },
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/ext2_fs.h b/e2fsprogs/old_e2fsprogs/ext2fs/ext2_fs.h
index 6f4f70862..80ea2cbdd 100644
--- a/e2fsprogs/old_e2fsprogs/ext2fs/ext2_fs.h
+++ b/e2fsprogs/old_e2fsprogs/ext2fs/ext2_fs.h
@@ -475,7 +475,7 @@ struct ext2_super_block {
475#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 475#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
476#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 476#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
477#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 477#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
478#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010 478#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
479#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 479#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
480 480
481#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 481#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h
index 9f772016f..39fb11620 100644
--- a/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h
+++ b/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h
@@ -383,7 +383,7 @@ typedef struct ext2_icount *ext2_icount_t;
383#define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\ 383#define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\
384 EXT2_FEATURE_COMPAT_IMAGIC_INODES|\ 384 EXT2_FEATURE_COMPAT_IMAGIC_INODES|\
385 EXT3_FEATURE_COMPAT_HAS_JOURNAL|\ 385 EXT3_FEATURE_COMPAT_HAS_JOURNAL|\
386 EXT2_FEATURE_COMPAT_RESIZE_INODE|\ 386 EXT2_FEATURE_COMPAT_RESIZE_INO|\
387 EXT2_FEATURE_COMPAT_DIR_INDEX|\ 387 EXT2_FEATURE_COMPAT_DIR_INDEX|\
388 EXT2_FEATURE_COMPAT_EXT_ATTR) 388 EXT2_FEATURE_COMPAT_EXT_ATTR)
389 389
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c b/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c
index ef1d34379..da2d15137 100644
--- a/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c
+++ b/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c
@@ -284,7 +284,7 @@ retry:
284 /* 284 /*
285 * check the number of reserved group descriptor table blocks 285 * check the number of reserved group descriptor table blocks
286 */ 286 */
287 if (super->s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE) 287 if (super->s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INO)
288 rsv_gdt = calc_reserved_gdt_blocks(fs); 288 rsv_gdt = calc_reserved_gdt_blocks(fs);
289 else 289 else
290 rsv_gdt = 0; 290 rsv_gdt = 0;
diff --git a/e2fsprogs/old_e2fsprogs/mke2fs.c b/e2fsprogs/old_e2fsprogs/mke2fs.c
index 7555650a2..35d717a55 100644
--- a/e2fsprogs/old_e2fsprogs/mke2fs.c
+++ b/e2fsprogs/old_e2fsprogs/mke2fs.c
@@ -757,7 +757,7 @@ static void parse_extended_opts(struct ext2_super_block *sb_param,
757 757
758 if (rsv_gdb > 0) { 758 if (rsv_gdb > 0) {
759 sb_param->s_feature_compat |= 759 sb_param->s_feature_compat |=
760 EXT2_FEATURE_COMPAT_RESIZE_INODE; 760 EXT2_FEATURE_COMPAT_RESIZE_INO;
761 761
762 sb_param->s_reserved_gdt_blocks = rsv_gdb; 762 sb_param->s_reserved_gdt_blocks = rsv_gdb;
763 } 763 }
@@ -778,7 +778,7 @@ static void parse_extended_opts(struct ext2_super_block *sb_param,
778 778
779static __u32 ok_features[3] = { 779static __u32 ok_features[3] = {
780 EXT3_FEATURE_COMPAT_HAS_JOURNAL | 780 EXT3_FEATURE_COMPAT_HAS_JOURNAL |
781 EXT2_FEATURE_COMPAT_RESIZE_INODE | 781 EXT2_FEATURE_COMPAT_RESIZE_INO |
782 EXT2_FEATURE_COMPAT_DIR_INDEX, /* Compat */ 782 EXT2_FEATURE_COMPAT_DIR_INDEX, /* Compat */
783 EXT2_FEATURE_INCOMPAT_FILETYPE| /* Incompat */ 783 EXT2_FEATURE_INCOMPAT_FILETYPE| /* Incompat */
784 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV| 784 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|
@@ -1123,7 +1123,7 @@ static int PRS(int argc, char **argv)
1123 /* Since sparse_super is the default, we would only have a problem 1123 /* Since sparse_super is the default, we would only have a problem
1124 * here if it was explicitly disabled. 1124 * here if it was explicitly disabled.
1125 */ 1125 */
1126 if ((param.s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE) && 1126 if ((param.s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INO) &&
1127 !(param.s_feature_ro_compat&EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) { 1127 !(param.s_feature_ro_compat&EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
1128 bb_error_msg_and_die("reserved online resize blocks not supported " 1128 bb_error_msg_and_die("reserved online resize blocks not supported "
1129 "on non-sparse filesystem"); 1129 "on non-sparse filesystem");
@@ -1312,7 +1312,7 @@ int mke2fs_main (int argc, char **argv)
1312 reserve_inodes(fs); 1312 reserve_inodes(fs);
1313 create_bad_block_inode(fs, bb_list); 1313 create_bad_block_inode(fs, bb_list);
1314 if (fs->super->s_feature_compat & 1314 if (fs->super->s_feature_compat &
1315 EXT2_FEATURE_COMPAT_RESIZE_INODE) { 1315 EXT2_FEATURE_COMPAT_RESIZE_INO) {
1316 retval = ext2fs_create_resize_inode(fs); 1316 retval = ext2fs_create_resize_inode(fs);
1317 mke2fs_error_msg_and_die(retval, "reserve blocks for online resize"); 1317 mke2fs_error_msg_and_die(retval, "reserve blocks for online resize");
1318 } 1318 }
diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c
index 020bdaa33..46a745ee4 100644
--- a/e2fsprogs/tune2fs.c
+++ b/e2fsprogs/tune2fs.c
@@ -8,7 +8,7 @@
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include <linux/fs.h> 10#include <linux/fs.h>
11#include <linux/ext2_fs.h> 11#include "bb_e2fs_defs.h"
12 12
13// storage helpers 13// storage helpers
14char BUG_wrong_field_size(void); 14char BUG_wrong_field_size(void);
diff --git a/e2fsprogs/e2fs_defs.h b/include/bb_e2fs_defs.h
index 379640eb8..7974497ca 100644
--- a/e2fsprogs/e2fs_defs.h
+++ b/include/bb_e2fs_defs.h
@@ -467,7 +467,7 @@ struct ext2_super_block {
467#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 467#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
468#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 468#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
469#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 469#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
470#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010 470#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
471#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 471#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
472 472
473#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 473#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 4cb063f89..ad81ce46b 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -172,6 +172,7 @@ lib-$(CONFIG_PING) += inet_cksum.o
172lib-$(CONFIG_TRACEROUTE) += inet_cksum.o 172lib-$(CONFIG_TRACEROUTE) += inet_cksum.o
173lib-$(CONFIG_TRACEROUTE6) += inet_cksum.o 173lib-$(CONFIG_TRACEROUTE6) += inet_cksum.o
174lib-$(CONFIG_UDHCPC) += inet_cksum.o 174lib-$(CONFIG_UDHCPC) += inet_cksum.o
175lib-$(CONFIG_UDHCPC6) += inet_cksum.o
175lib-$(CONFIG_UDHCPD) += inet_cksum.o 176lib-$(CONFIG_UDHCPD) += inet_cksum.o
176 177
177# We shouldn't build xregcomp.c if we don't need it - this ensures we don't 178# We shouldn't build xregcomp.c if we don't need it - this ensures we don't
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 78244c395..77dc1c607 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2532,7 +2532,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2532 switch (ic) { 2532 switch (ic) {
2533 //case KEYCODE_LEFT: - bash doesn't do this 2533 //case KEYCODE_LEFT: - bash doesn't do this
2534 case 'b': 2534 case 'b':
2535 ctrl_left(); 2535 ctrl_left();
2536 break; 2536 break;
2537 //case KEYCODE_RIGHT: - bash doesn't do this 2537 //case KEYCODE_RIGHT: - bash doesn't do this
2538 case 'f': 2538 case 'f':
diff --git a/miscutils/less.c b/miscutils/less.c
index 045fd2db3..f0187bf8a 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -42,14 +42,11 @@
42//config: brackets, facilitating programming. 42//config: brackets, facilitating programming.
43//config: 43//config:
44//config:config FEATURE_LESS_FLAGS 44//config:config FEATURE_LESS_FLAGS
45//config: bool "Enable extra flags" 45//config: bool "Enable -m/-M"
46//config: default y 46//config: default y
47//config: depends on LESS 47//config: depends on LESS
48//config: help 48//config: help
49//config: The extra flags provided do the following: 49//config: The -M/-m flag enables a more sophisticated status line.
50//config:
51//config: The -M flag enables a more sophisticated status line.
52//config: The -m flag enables a simpler status line with a percentage.
53//config: 50//config:
54//config:config FEATURE_LESS_MARKS 51//config:config FEATURE_LESS_MARKS
55//config: bool "Enable marks" 52//config: bool "Enable marks"
@@ -101,15 +98,17 @@
101//config: Enables "-N" command. 98//config: Enables "-N" command.
102 99
103//usage:#define less_trivial_usage 100//usage:#define less_trivial_usage
104//usage: "[-EMNmh~I?] [FILE]..." 101//usage: "[-E" IF_FEATURE_LESS_FLAGS("Mm") "Nh~I?] [FILE]..."
105//usage:#define less_full_usage "\n\n" 102//usage:#define less_full_usage "\n\n"
106//usage: "View FILE (or stdin) one screenful at a time\n" 103//usage: "View FILE (or stdin) one screenful at a time\n"
107//usage: "\n -E Quit once the end of a file is reached" 104//usage: "\n -E Quit once the end of a file is reached"
105//usage: IF_FEATURE_LESS_FLAGS(
108//usage: "\n -M,-m Display status line with line numbers" 106//usage: "\n -M,-m Display status line with line numbers"
109//usage: "\n and percentage through the file" 107//usage: "\n and percentage through the file"
108//usage: )
110//usage: "\n -N Prefix line number to each line" 109//usage: "\n -N Prefix line number to each line"
111//usage: "\n -I Ignore case in all searches" 110//usage: "\n -I Ignore case in all searches"
112//usage: "\n -~ Suppress ~s displayed past the end of the file" 111//usage: "\n -~ Suppress ~s displayed past EOF"
113 112
114#include <sched.h> /* sched_yield() */ 113#include <sched.h> /* sched_yield() */
115 114
diff --git a/networking/hostname.c b/networking/hostname.c
index 5f663908c..d2516b5fb 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -153,7 +153,7 @@ int hostname_main(int argc UNUSED_PARAM, char **argv)
153 if (hp->h_length == sizeof(struct in_addr)) { 153 if (hp->h_length == sizeof(struct in_addr)) {
154 struct in_addr **h_addr_list = (struct in_addr **)hp->h_addr_list; 154 struct in_addr **h_addr_list = (struct in_addr **)hp->h_addr_list;
155 while (*h_addr_list) { 155 while (*h_addr_list) {
156 printf("%s ", inet_ntoa(**h_addr_list)); 156 printf(h_addr_list[1] ? "%s " : "%s", inet_ntoa(**h_addr_list));
157 h_addr_list++; 157 h_addr_list++;
158 } 158 }
159 bb_putchar('\n'); 159 bb_putchar('\n');
diff --git a/networking/httpd.c b/networking/httpd.c
index f233cb0ba..12218a0a3 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1594,7 +1594,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
1594 } 1594 }
1595 range_len = MAXINT(off_t); 1595 range_len = MAXINT(off_t);
1596 if (range_start >= 0) { 1596 if (range_start >= 0) {
1597 if (!range_end) { 1597 if (!range_end || range_end > file_size - 1) {
1598 range_end = file_size - 1; 1598 range_end = file_size - 1;
1599 } 1599 }
1600 if (range_end < range_start 1600 if (range_end < range_start
@@ -1676,7 +1676,7 @@ static int checkPermIP(void)
1676 1676
1677#if ENABLE_FEATURE_HTTPD_BASIC_AUTH 1677#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
1678 1678
1679# if ENABLE_FEATURE_HTTPD_AUTH_MD5 && ENABLE_PAM 1679# if ENABLE_PAM
1680struct pam_userinfo { 1680struct pam_userinfo {
1681 const char *name; 1681 const char *name;
1682 const char *pw; 1682 const char *pw;
@@ -1842,7 +1842,9 @@ static int check_user_passwd(const char *path, char *user_and_passwd)
1842 1842
1843 if (passwd[0] == '$' && isdigit(passwd[1])) { 1843 if (passwd[0] == '$' && isdigit(passwd[1])) {
1844 char *encrypted; 1844 char *encrypted;
1845# if !ENABLE_PAM
1845 check_encrypted: 1846 check_encrypted:
1847# endif
1846 /* encrypt pwd from peer and check match with local one */ 1848 /* encrypt pwd from peer and check match with local one */
1847 encrypted = pw_encrypt( 1849 encrypted = pw_encrypt(
1848 /* pwd (from peer): */ colon_after_user + 1, 1850 /* pwd (from peer): */ colon_after_user + 1,
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 4d939458c..603801ec6 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -276,6 +276,9 @@ struct globals {
276 llist_t *ntp_peers; 276 llist_t *ntp_peers;
277#if ENABLE_FEATURE_NTPD_SERVER 277#if ENABLE_FEATURE_NTPD_SERVER
278 int listen_fd; 278 int listen_fd;
279# define G_listen_fd (G.listen_fd)
280#else
281# define G_listen_fd (-1)
279#endif 282#endif
280 unsigned verbose; 283 unsigned verbose;
281 unsigned peer_cnt; 284 unsigned peer_cnt;
@@ -1815,10 +1818,10 @@ recv_and_process_client_pkt(void /*int fd*/)
1815 uint8_t query_status; 1818 uint8_t query_status;
1816 l_fixedpt_t query_xmttime; 1819 l_fixedpt_t query_xmttime;
1817 1820
1818 to = get_sock_lsa(G.listen_fd); 1821 to = get_sock_lsa(G_listen_fd);
1819 from = xzalloc(to->len); 1822 from = xzalloc(to->len);
1820 1823
1821 size = recv_from_to(G.listen_fd, &msg, sizeof(msg), MSG_DONTWAIT, from, &to->u.sa, to->len); 1824 size = recv_from_to(G_listen_fd, &msg, sizeof(msg), MSG_DONTWAIT, from, &to->u.sa, to->len);
1822 if (size != NTP_MSGSIZE_NOAUTH && size != NTP_MSGSIZE) { 1825 if (size != NTP_MSGSIZE_NOAUTH && size != NTP_MSGSIZE) {
1823 char *addr; 1826 char *addr;
1824 if (size < 0) { 1827 if (size < 0) {
@@ -1861,7 +1864,7 @@ recv_and_process_client_pkt(void /*int fd*/)
1861 1864
1862 /* We reply from the local address packet was sent to, 1865 /* We reply from the local address packet was sent to,
1863 * this makes to/from look swapped here: */ 1866 * this makes to/from look swapped here: */
1864 do_sendto(G.listen_fd, 1867 do_sendto(G_listen_fd,
1865 /*from:*/ &to->u.sa, /*to:*/ from, /*addrlen:*/ to->len, 1868 /*from:*/ &to->u.sa, /*to:*/ from, /*addrlen:*/ to->len,
1866 &msg, size); 1869 &msg, size);
1867 1870
@@ -2000,11 +2003,11 @@ static NOINLINE void ntp_init(char **argv)
2000 logmode = LOGMODE_NONE; 2003 logmode = LOGMODE_NONE;
2001 } 2004 }
2002#if ENABLE_FEATURE_NTPD_SERVER 2005#if ENABLE_FEATURE_NTPD_SERVER
2003 G.listen_fd = -1; 2006 G_listen_fd = -1;
2004 if (opts & OPT_l) { 2007 if (opts & OPT_l) {
2005 G.listen_fd = create_and_bind_dgram_or_die(NULL, 123); 2008 G_listen_fd = create_and_bind_dgram_or_die(NULL, 123);
2006 socket_want_pktinfo(G.listen_fd); 2009 socket_want_pktinfo(G_listen_fd);
2007 setsockopt(G.listen_fd, IPPROTO_IP, IP_TOS, &const_IPTOS_LOWDELAY, sizeof(const_IPTOS_LOWDELAY)); 2010 setsockopt(G_listen_fd, IPPROTO_IP, IP_TOS, &const_IPTOS_LOWDELAY, sizeof(const_IPTOS_LOWDELAY));
2008 } 2011 }
2009#endif 2012#endif
2010 /* I hesitate to set -20 prio. -15 should be high enough for timekeeping */ 2013 /* I hesitate to set -20 prio. -15 should be high enough for timekeeping */
@@ -2078,8 +2081,8 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
2078 2081
2079 i = 0; 2082 i = 0;
2080#if ENABLE_FEATURE_NTPD_SERVER 2083#if ENABLE_FEATURE_NTPD_SERVER
2081 if (G.listen_fd != -1) { 2084 if (G_listen_fd != -1) {
2082 pfd[0].fd = G.listen_fd; 2085 pfd[0].fd = G_listen_fd;
2083 pfd[0].events = POLLIN; 2086 pfd[0].events = POLLIN;
2084 i++; 2087 i++;
2085 } 2088 }
@@ -2125,7 +2128,7 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
2125 2128
2126 /* Here we may block */ 2129 /* Here we may block */
2127 VERB2 { 2130 VERB2 {
2128 if (i > (ENABLE_FEATURE_NTPD_SERVER && G.listen_fd != -1)) { 2131 if (i > (ENABLE_FEATURE_NTPD_SERVER && G_listen_fd != -1)) {
2129 /* We wait for at least one reply. 2132 /* We wait for at least one reply.
2130 * Poll for it, without wasting time for message. 2133 * Poll for it, without wasting time for message.
2131 * Since replies often come under 1 second, this also 2134 * Since replies often come under 1 second, this also
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index ff6347847..b43e52e96 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -118,8 +118,13 @@ int FAST_FUNC arpping(uint32_t test_nip,
118 break; 118 break;
119 } 119 }
120 } 120 }
121 timeout_ms -= (unsigned)monotonic_ms() - prevTime; 121 timeout_ms -= (unsigned)monotonic_ms() - prevTime + 1;
122 } while (timeout_ms > 0); 122
123 /* We used to check "timeout_ms > 0", but
124 * this is more under/overflow-resistant
125 * (people did see overflows here when system time jumps):
126 */
127 } while ((unsigned)timeout_ms <= 2000);
123 128
124 ret: 129 ret:
125 close(s); 130 close(s);
diff --git a/networking/udhcp/d6_common.h b/networking/udhcp/d6_common.h
index 4dd7e621e..eb211ea0f 100644
--- a/networking/udhcp/d6_common.h
+++ b/networking/udhcp/d6_common.h
@@ -115,7 +115,11 @@ int FAST_FUNC d6_send_kernel_packet(
115 struct in6_addr *dst_ipv6, int dest_port 115 struct in6_addr *dst_ipv6, int dest_port
116); 116);
117 117
118#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2
118void FAST_FUNC d6_dump_packet(struct d6_packet *packet); 119void FAST_FUNC d6_dump_packet(struct d6_packet *packet);
120#else
121# define d6_dump_packet(packet) ((void)0)
122#endif
119 123
120 124
121POP_SAVED_FUNCTION_VISIBILITY 125POP_SAVED_FUNCTION_VISIBILITY
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 23e6862dc..a792a9dca 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -19,7 +19,7 @@
19 19
20//applet:IF_UDHCPC6(APPLET(udhcpc6, BB_DIR_USR_BIN, BB_SUID_DROP)) 20//applet:IF_UDHCPC6(APPLET(udhcpc6, BB_DIR_USR_BIN, BB_SUID_DROP))
21 21
22//kbuild:lib-$(CONFIG_UDHCPC6) += d6_dhcpc.o d6_packet.o d6_socket.o common.o 22//kbuild:lib-$(CONFIG_UDHCPC6) += d6_dhcpc.o d6_packet.o d6_socket.o common.o socket.o signalpipe.o
23 23
24 24
25#include <syslog.h> 25#include <syslog.h>
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 2f2016cd5..ddb328dd5 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -101,6 +101,7 @@ static const uint8_t len_of_option_as_string[] = {
101 [OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "), 101 [OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "),
102 [OPTION_6RD ] = sizeof("32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "), 102 [OPTION_6RD ] = sizeof("32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "),
103 [OPTION_STRING ] = 1, 103 [OPTION_STRING ] = 1,
104 [OPTION_STRING_HOST ] = 1,
104#if ENABLE_FEATURE_UDHCP_RFC3397 105#if ENABLE_FEATURE_UDHCP_RFC3397
105 [OPTION_DNS_STRING ] = 1, /* unused */ 106 [OPTION_DNS_STRING ] = 1, /* unused */
106 /* Hmmm, this severely overestimates size if SIP_SERVERS option 107 /* Hmmm, this severely overestimates size if SIP_SERVERS option
diff --git a/procps/kill.c b/procps/kill.c
index b267a7aaf..cd189bcd6 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -163,7 +163,8 @@ int kill_main(int argc, char **argv)
163 /* Find out our session id */ 163 /* Find out our session id */
164 sid = getsid(pid); 164 sid = getsid(pid);
165 /* Stop all processes */ 165 /* Stop all processes */
166 kill(-1, SIGSTOP); 166 if (signo != SIGSTOP && signo != SIGCONT)
167 kill(-1, SIGSTOP);
167 /* Signal all processes except those in our session */ 168 /* Signal all processes except those in our session */
168 while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID)) != NULL) { 169 while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID)) != NULL) {
169 int i; 170 int i;
@@ -203,7 +204,8 @@ int kill_main(int argc, char **argv)
203 } 204 }
204 resume: 205 resume:
205 /* And let them continue */ 206 /* And let them continue */
206 kill(-1, SIGCONT); 207 if (signo != SIGSTOP && signo != SIGCONT)
208 kill(-1, SIGCONT);
207 return ret; 209 return ret;
208 } 210 }
209 211
diff --git a/procps/lsof.c b/procps/lsof.c
new file mode 100644
index 000000000..7e0ffa4e5
--- /dev/null
+++ b/procps/lsof.c
@@ -0,0 +1,76 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Mini lsof implementation for busybox
4 *
5 * Copyright (C) 2012 by Sven Oliver 'SvOlli' Moll <svolli@svolli.de>
6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */
9
10//config:config LSOF
11//config: bool "lsof"
12//config: default y
13//config: help
14//config: Show open files in the format of:
15//config: PID <TAB> /path/to/executable <TAB> /path/to/opened/file
16
17//applet:IF_LSOF(APPLET(lsof, BB_DIR_USR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_LSOF) += lsof.o
20
21//usage:#define lsof_trivial_usage
22//usage: ""
23//usage:#define lsof_full_usage "\n\n"
24//usage: "Show all open files"
25
26#include "libbb.h"
27
28/*
29 * Examples of "standard" lsof output:
30 *
31 * COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
32 * init 1 root cwd DIR 8,5 4096 2 /
33 * init 1 root rtd DIR 8,5 4096 2 /
34 * init 1 root txt REG 8,5 872400 63408 /app/busybox-1.19.2/busybox
35 * rpc.portm 1064 root mem REG 8,5 43494 47451 /app/glibc-2.11/lib/libnss_files-2.11.so
36 * rpc.portm 1064 root 3u IPv4 2178 UDP *:111
37 * rpc.portm 1064 root 4u IPv4 1244 TCP *:111 (LISTEN)
38 * runsvdir 1116 root 0r CHR 1,3 1214 /dev/null
39 * runsvdir 1116 root 1w CHR 1,3 1214 /dev/null
40 * runsvdir 1116 root 2w CHR 1,3 1214 /dev/null
41 * runsvdir 1116 root 3r DIR 8,6 1560 58359 /.local/var/service
42 * gpm 1128 root 4u unix 0xffff88007c09ccc0 1302 /dev/gpmctl
43 */
44
45int lsof_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
46int lsof_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
47{
48 procps_status_t *proc = NULL;
49
50 while ((proc = procps_scan(proc, PSSCAN_PID|PSSCAN_EXE)) != NULL) {
51 char name[sizeof("/proc/%u/fd/0123456789") + sizeof(int)*3];
52 unsigned baseofs;
53 DIR *d_fd;
54 char *fdlink;
55 struct dirent *entry;
56
57 if (getpid() == proc->pid)
58 continue;
59
60 baseofs = sprintf(name, "/proc/%u/fd/", proc->pid);
61 d_fd = opendir(name);
62 if (d_fd) {
63 while ((entry = readdir(d_fd)) != NULL) {
64 if (entry->d_type == DT_LNK) {
65 safe_strncpy(name + baseofs, entry->d_name, 10);
66 fdlink = xmalloc_readlink(name);
67 printf("%d\t%s\t%s\n", proc->pid, proc->exe, fdlink);
68 free(fdlink);
69 }
70 }
71 closedir(d_fd);
72 }
73 }
74
75 return EXIT_SUCCESS;
76}
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 0d3ff7f5e..6db2a5e58 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -39,25 +39,16 @@ if f1 is None or f2 is None:
39sym_args = " ".join(sys.argv[3 + flag_timing + dashes:]) 39sym_args = " ".join(sys.argv[3 + flag_timing + dashes:])
40def getsizes(file): 40def getsizes(file):
41 sym, alias, lut = {}, {}, {} 41 sym, alias, lut = {}, {}, {}
42 #dynsym_filter = re.compile("^\d+:\s+[\dA-Fa-f]+\s+\d+\s+\w+\s+\w+\s+\w+\s+\w+\s+\w+$")
43 for l in os.popen("readelf -W -s %s %s" % (sym_args, file)).readlines(): 42 for l in os.popen("readelf -W -s %s %s" % (sym_args, file)).readlines():
44 if True: 43 l = l.strip()
45 l = l.strip() 44 if not (len(l) and l[0].isdigit() and len(l.split()) == 8):
46 if not (len(l) and l[0].isdigit() and len(l.split()) == 8): 45 continue
47 continue 46 num, value, size, typ, bind, vis, ndx, name = l.split()
48 num, value, size, typ, bind, vis, ndx, name = l.split() 47 if ndx == "UND": continue # skip undefined
49 if ndx == "UND": continue # skip undefined 48 if typ in ["SECTION", "FILES"]: continue # skip sections and files
50 if typ in ["SECTION", "FILES"]: continue # skip sections and files
51 #else:
52 # l = l.strip()
53 # match = dynsym_filter.match(l)
54 # if not match: continue
55 # x, value, size, typ, bind, x, ndx, name = l.split()
56 # if ndx == "UND": continue # skip undefined
57 # if typ in ["SECTION", "FILES"]: continue # skip sections and files
58 if "." in name: name = "static." + name.split(".")[0] 49 if "." in name: name = "static." + name.split(".")[0]
59 value = int(value, 16) 50 value = int(value, 16)
60 size = int(size) 51 size = int(size, 16) if size.startswith('0x') else int(size)
61 if vis != "DEFAULT" and bind != "GLOBAL": # see if it is an alias 52 if vis != "DEFAULT" and bind != "GLOBAL": # see if it is an alias
62 alias[(value, size)] = {"name" : name} 53 alias[(value, size)] = {"name" : name}
63 else: 54 else:
diff --git a/scripts/randomtest.loop b/scripts/randomtest.loop
index 2c8a9bd35..758a8e862 100755
--- a/scripts/randomtest.loop
+++ b/scripts/randomtest.loop
@@ -1,5 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3run_testsuite=true
4
3test -d "$1" || { echo "'$1' is not a directory"; exit 1; } 5test -d "$1" || { echo "'$1' is not a directory"; exit 1; }
4test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; } 6test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; }
5 7
@@ -21,7 +23,9 @@ while sleep 1; do
21 echo "Failed build in: failed.$dir" 23 echo "Failed build in: failed.$dir"
22 exit 1 # you may comment this out... 24 exit 1 # you may comment this out...
23 let fail++ 25 let fail++
24 else 26 continue
27 fi
28 if $run_testsuite; then
25 ( 29 (
26 cd -- "$dir/testsuite" || exit 1 30 cd -- "$dir/testsuite" || exit 1
27 echo "Running testsuite in $dir..." 31 echo "Running testsuite in $dir..."
@@ -29,10 +33,12 @@ while sleep 1; do
29 ) 33 )
30 if test $? != 0; then 34 if test $? != 0; then
31 echo "Failed runtest in $dir" 35 echo "Failed runtest in $dir"
32 exit 1 36 exit 1 # you may comment this out...
37 let fail++
38 continue
33 fi 39 fi
34 tail -n10 -- "$dir/testsuite/runtest.log" 40 tail -n10 -- "$dir/testsuite/runtest.log"
35 rm -rf -- "$dir"
36 fi 41 fi
42 rm -rf -- "$dir"
37 let cnt++ 43 let cnt++
38done 44done
diff --git a/shell/hush.c b/shell/hush.c
index 7a34f59ae..51d38d3ae 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -324,6 +324,8 @@ typedef void (*hush_sighandler_t)(int);
324# define ENABLE_FEATURE_EDITING 0 324# define ENABLE_FEATURE_EDITING 0
325# undef ENABLE_FEATURE_EDITING_FANCY_PROMPT 325# undef ENABLE_FEATURE_EDITING_FANCY_PROMPT
326# define ENABLE_FEATURE_EDITING_FANCY_PROMPT 0 326# define ENABLE_FEATURE_EDITING_FANCY_PROMPT 0
327# undef ENABLE_FEATURE_EDITING_SAVE_ON_EXIT
328# define ENABLE_FEATURE_EDITING_SAVE_ON_EXIT 0
327#endif 329#endif
328 330
329/* Do we support ANY keywords? */ 331/* Do we support ANY keywords? */
@@ -524,7 +526,6 @@ typedef enum redir_type {
524struct command { 526struct command {
525 pid_t pid; /* 0 if exited */ 527 pid_t pid; /* 0 if exited */
526 int assignment_cnt; /* how many argv[i] are assignments? */ 528 int assignment_cnt; /* how many argv[i] are assignments? */
527 smallint is_stopped; /* is the command currently running? */
528 smallint cmd_type; /* CMD_xxx */ 529 smallint cmd_type; /* CMD_xxx */
529#define CMD_NORMAL 0 530#define CMD_NORMAL 0
530#define CMD_SUBSHELL 1 531#define CMD_SUBSHELL 1
@@ -6767,7 +6768,6 @@ static int checkjobs(struct pipe *fg_pipe)
6767 } 6768 }
6768 fg_pipe->cmds[i].cmd_exitcode = ex; 6769 fg_pipe->cmds[i].cmd_exitcode = ex;
6769 } else { 6770 } else {
6770 fg_pipe->cmds[i].is_stopped = 1;
6771 fg_pipe->stopped_cmds++; 6771 fg_pipe->stopped_cmds++;
6772 } 6772 }
6773 debug_printf_jobs("fg_pipe: alive_cmds %d stopped_cmds %d\n", 6773 debug_printf_jobs("fg_pipe: alive_cmds %d stopped_cmds %d\n",
@@ -6828,7 +6828,6 @@ static int checkjobs(struct pipe *fg_pipe)
6828 } 6828 }
6829 } else { 6829 } else {
6830 /* child stopped */ 6830 /* child stopped */
6831 pi->cmds[i].is_stopped = 1;
6832 pi->stopped_cmds++; 6831 pi->stopped_cmds++;
6833 } 6832 }
6834#endif 6833#endif
@@ -8596,7 +8595,6 @@ static int FAST_FUNC builtin_fg_bg(char **argv)
8596 debug_printf_jobs("reviving %d procs, pgrp %d\n", pi->num_cmds, pi->pgrp); 8595 debug_printf_jobs("reviving %d procs, pgrp %d\n", pi->num_cmds, pi->pgrp);
8597 for (i = 0; i < pi->num_cmds; i++) { 8596 for (i = 0; i < pi->num_cmds; i++) {
8598 debug_printf_jobs("reviving pid %d\n", pi->cmds[i].pid); 8597 debug_printf_jobs("reviving pid %d\n", pi->cmds[i].pid);
8599 pi->cmds[i].is_stopped = 0;
8600 } 8598 }
8601 pi->stopped_cmds = 0; 8599 pi->stopped_cmds = 0;
8602 8600
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 6b4e29bfa..379eeb253 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -43,7 +43,7 @@ static time_t read_rtc(const char **pp_rtcname, struct timeval *sys_tv, int utc)
43 while (1) { 43 while (1) {
44 rtc_read_tm(&tm_time, fd); 44 rtc_read_tm(&tm_time, fd);
45 gettimeofday(sys_tv, NULL); 45 gettimeofday(sys_tv, NULL);
46 if (before != tm_time.tm_sec) 46 if (before != (int)tm_time.tm_sec)
47 break; 47 break;
48 } 48 }
49 } 49 }
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 67de52d06..0a34122b4 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -164,7 +164,10 @@ struct globals {
164 struct rule cur_rule; 164 struct rule cur_rule;
165} FIX_ALIASING; 165} FIX_ALIASING;
166#define G (*(struct globals*)&bb_common_bufsiz1) 166#define G (*(struct globals*)&bb_common_bufsiz1)
167#define INIT_G() do { } while (0) 167#define INIT_G() do { \
168 IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.maj = -1;) \
169 IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.mode = 0660;) \
170} while (0)
168 171
169 172
170/* Prevent infinite loops in /sys symlinks */ 173/* Prevent infinite loops in /sys symlinks */
@@ -477,9 +480,8 @@ static void make_device(char *path, int delete)
477 } 480 }
478 } 481 }
479 /* else: it's final implicit "match-all" rule */ 482 /* else: it's final implicit "match-all" rule */
480#endif
481
482 rule_matches: 483 rule_matches:
484#endif
483 dbg("rule matched"); 485 dbg("rule matched");
484 486
485 /* Build alias name */ 487 /* Build alias name */
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index 6cbbe0e07..69b25c946 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -48,7 +48,7 @@
48 48
49#include "libbb.h" 49#include "libbb.h"
50#include <linux/fs.h> 50#include <linux/fs.h>
51#include <linux/ext2_fs.h> 51#include "bb_e2fs_defs.h"
52 52
53#define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0 53#define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0
54#define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1 54#define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 807e89747..f1da30fac 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1337,7 +1337,7 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1337 "udp\0" 1337 "udp\0"
1338 "lock\0" 1338 "lock\0"
1339 "rdirplus\0" 1339 "rdirplus\0"
1340 "acl\0"; 1340 "acl\0";
1341 int val = 1; 1341 int val = 1;
1342 if (!strncmp(opt, "no", 2)) { 1342 if (!strncmp(opt, "no", 2)) {
1343 val = 0; 1343 val = 0;
@@ -1388,7 +1388,7 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1388 nordirplus = !val; 1388 nordirplus = !val;
1389 break; 1389 break;
1390 case 12: // acl 1390 case 12: // acl
1391 noacl = !val; 1391 noacl = !val;
1392 break; 1392 break;
1393 default: 1393 default:
1394 bb_error_msg("unknown nfs mount option: %s%s", val ? "" : "no", opt); 1394 bb_error_msg("unknown nfs mount option: %s%s", val ? "" : "no", opt);
@@ -1404,7 +1404,7 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1404 | (nocto ? NFS_MOUNT_NOCTO : 0) 1404 | (nocto ? NFS_MOUNT_NOCTO : 0)
1405 | (noac ? NFS_MOUNT_NOAC : 0) 1405 | (noac ? NFS_MOUNT_NOAC : 0)
1406 | (nordirplus ? NFS_MOUNT_NORDIRPLUS : 0) 1406 | (nordirplus ? NFS_MOUNT_NORDIRPLUS : 0)
1407 | (noacl ? NFS_MOUNT_NOACL : 0); 1407 | (noacl ? NFS_MOUNT_NOACL : 0);
1408 if (nfs_mount_version >= 2) 1408 if (nfs_mount_version >= 2)
1409 data.flags |= (tcp ? NFS_MOUNT_TCP : 0); 1409 data.flags |= (tcp ? NFS_MOUNT_TCP : 0);
1410 if (nfs_mount_version >= 3) 1410 if (nfs_mount_version >= 3)
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 5b716c688..4c2e8821e 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -22,7 +22,7 @@
22//usage: "\n -l Lazy umount (detach filesystem)" 22//usage: "\n -l Lazy umount (detach filesystem)"
23//usage: "\n -f Force umount (i.e., unreachable NFS server)" 23//usage: "\n -f Force umount (i.e., unreachable NFS server)"
24//usage: IF_FEATURE_MOUNT_LOOP( 24//usage: IF_FEATURE_MOUNT_LOOP(
25//usage: "\n -d Free loop device if it has been used" 25//usage: "\n -D Don't free loop device even if it has been used"
26//usage: ) 26//usage: )
27//usage: 27//usage:
28//usage:#define umount_example_usage 28//usage:#define umount_example_usage
@@ -44,14 +44,22 @@ static struct mntent *getmntent_r(FILE* stream, struct mntent* result,
44} 44}
45#endif 45#endif
46 46
47/* ignored: -v -d -t -i */ 47/* Ignored: -v -t -i
48#define OPTION_STRING "fldnra" "vdt:i" 48 * bbox always acts as if -d is present.
49 * -D can be used to suppress it (bbox extension).
50 * Rationale:
51 * (1) util-linux's umount does it if "loop=..." is seen in /etc/mtab:
52 * thus, on many systems, bare umount _does_ drop loop devices.
53 * (2) many users request this feature.
54 */
55#define OPTION_STRING "fldDnra" "vt:i"
49#define OPT_FORCE (1 << 0) // Same as MNT_FORCE 56#define OPT_FORCE (1 << 0) // Same as MNT_FORCE
50#define OPT_LAZY (1 << 1) // Same as MNT_DETACH 57#define OPT_LAZY (1 << 1) // Same as MNT_DETACH
51#define OPT_FREELOOP (1 << 2) 58//#define OPT_FREE_LOOP (1 << 2) // -d is assumed always present
52#define OPT_NO_MTAB (1 << 3) 59#define OPT_DONT_FREE_LOOP (1 << 3)
53#define OPT_REMOUNT (1 << 4) 60#define OPT_NO_MTAB (1 << 4)
54#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 5) : 0) 61#define OPT_REMOUNT (1 << 5)
62#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 6) : 0)
55 63
56int umount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 64int umount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
57int umount_main(int argc UNUSED_PARAM, char **argv) 65int umount_main(int argc UNUSED_PARAM, char **argv)
@@ -165,7 +173,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
165 } else { 173 } else {
166 // De-allocate the loop device. This ioctl should be ignored on 174 // De-allocate the loop device. This ioctl should be ignored on
167 // any non-loop block devices. 175 // any non-loop block devices.
168 if (ENABLE_FEATURE_MOUNT_LOOP && (opt & OPT_FREELOOP) && m) 176 if (ENABLE_FEATURE_MOUNT_LOOP && !(opt & OPT_DONT_FREE_LOOP) && m)
169 del_loop(m->device); 177 del_loop(m->device);
170 if (ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m) 178 if (ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m)
171 erase_mtab(m->dir); 179 erase_mtab(m->dir);