From 20cd31a2d7cc1b633b725280eb7546ca14eef7eb Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 12 Dec 2014 08:29:41 +0000 Subject: lineedit: don't block when looking for escape sequence in vi-mode In vi-mode lineedit tries to detect some escape sequences. After the ESC it reads the next character to check for certain values. This read should have a timeout or a user-entered ESC to switch to command mode doesn't properly handle the next character. Signed-off-by: Ron Yorston Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 3961b1de3..720a4951e 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2611,7 +2611,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman * standard readline bindings (IOW: bash) do. * Often, Alt- generates ESC-. */ - ic = lineedit_read_key(read_key_buffer, timeout); + ic = lineedit_read_key(read_key_buffer, 50); switch (ic) { //case KEYCODE_LEFT: - bash doesn't do this case 'b': -- cgit v1.2.3-55-g6feb From e835afadfe84a820b698f715a01e777f8b7bf833 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Wed, 17 Dec 2014 17:02:37 +0100 Subject: nandwrite: fix build when long options are disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Required_argument macro is only defined when long options are enabled. Fixes the following build error: miscutils/nandwrite.c: In function 'nandwrite_main': miscutils/nandwrite.c:120:10: error: expected ',' or ';' before 'Required_argument' Reported-by: Christian Kästner Signed-off-by: Baruch Siach Signed-off-by: Denys Vlasenko --- miscutils/nandwrite.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c index 29ff351a3..c825fc315 100644 --- a/miscutils/nandwrite.c +++ b/miscutils/nandwrite.c @@ -116,12 +116,13 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv) struct mtd_oob_buf oob; unsigned char *filebuf; const char *opt_s = "0", *opt_f = "-", *opt_l, *opt_bb; - static const char nanddump_longopts[] ALIGN1 = - "bb\0" Required_argument "\xff"; /* no short equivalent */ if (IS_NANDDUMP) { opt_complementary = "=1"; - applet_long_options = nanddump_longopts; +#if ENABLE_LONG_OPTS + applet_long_options = + "bb\0" Required_argument "\xff"; /* no short equivalent */ +#endif opts = getopt32(argv, "os:f:l:", &opt_s, &opt_f, &opt_l, &opt_bb); } else { /* nandwrite */ opt_complementary = "-1:?2"; -- cgit v1.2.3-55-g6feb From ad0d009e0c1968a14f17189264d3aa8008ea2e3b Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Thu, 18 Dec 2014 00:27:26 +0200 Subject: nanddump: don't show --bb in usage when disabled The --bb options now depends on LONG_OPTS. Omit mentions of --bb from usage text when LONG_OPTS is disabled. Signed-off-by: Baruch Siach Signed-off-by: Denys Vlasenko --- miscutils/nandwrite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c index c825fc315..247fc72f4 100644 --- a/miscutils/nandwrite.c +++ b/miscutils/nandwrite.c @@ -36,16 +36,18 @@ //usage: "\n -s ADDR Start address" //usage:#define nanddump_trivial_usage -//usage: "[-o] [--bb=padbad|skipbad] [-s ADDR] [-l LEN] [-f FILE] MTD_DEVICE" +//usage: "[-o]" IF_LONG_OPTS(" [--bb=padbad|skipbad]") " [-s ADDR] [-l LEN] [-f FILE] MTD_DEVICE" //usage:#define nanddump_full_usage "\n\n" //usage: "Dump MTD_DEVICE\n" //usage: "\n -o Dump oob data" //usage: "\n -s ADDR Start address" //usage: "\n -l LEN Length" //usage: "\n -f FILE Dump to file ('-' for stdout)" +//usage: IF_LONG_OPTS( //usage: "\n --bb=METHOD:" //usage: "\n skipbad: skip bad blocks" //usage: "\n padbad: substitute bad blocks by 0xff (default)" +//usage: ) #include "libbb.h" #include -- cgit v1.2.3-55-g6feb From 28634924f0950f1938ea74a7808d412dc1063fd0 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 21 Dec 2014 16:10:22 +0100 Subject: udhcpc: account for script run time Based on the following user report: I ran into an issue where I was seeing a long delay in the scripts called in udhcp_run_script. I was using an old version of OpenWrt (kamikaze) and a satellite modem. An NTP script was being called and the modem would sometimes take a long time to respond to the DNS lookup when it was offline. This delay started affecting my lease time. The lease that I would get from my satellite modem before it was online would be short: only 60 seconds. The delay with NTP and the modem would typically be about 18 seconds. This would cause the first DHCP renew request from dhcpc to be a little late. Under certain circumstances, I could even see the first DHCP renew to occur after the lease had expired! function old new delta udhcpc_main 2816 2837 +21 Signed-off-by: Denys Vlasenko --- networking/udhcp/dhcpc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 35e7c2070..a34829c3a 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -1697,6 +1697,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) case RENEW_REQUESTED: case REBINDING: if (*message == DHCPACK) { + unsigned start; uint32_t lease_seconds; struct in_addr temp_addr; uint8_t *temp; @@ -1756,7 +1757,10 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) bb_info_msg("Lease of %s obtained, lease time %u", inet_ntoa(temp_addr), (unsigned)lease_seconds); requested_ip = packet.yiaddr; + + start = monotonic_sec(); udhcp_run_script(&packet, state == REQUESTING ? "bound" : "renew"); + already_waited_sec = (unsigned)monotonic_sec() - start; state = BOUND; change_listen_mode(LISTEN_NONE); @@ -1774,7 +1778,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) #endif /* make future renew packets use different xid */ /* xid = random_xid(); ...but why bother? */ - already_waited_sec = 0; + continue; /* back to main loop */ } if (*message == DHCPNAK) { -- cgit v1.2.3-55-g6feb From a6588fa10230e7b87990482773a445701abbaae8 Mon Sep 17 00:00:00 2001 From: Peter Kümmel Date: Mon, 22 Dec 2014 01:55:54 +0100 Subject: Make it possible to override LOGIN_FAIL_DELAY in CONFIG_EXTRA_CFLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Kümmel Signed-off-by: Denys Vlasenko --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 8e8b9ca0e..68a7cf002 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1271,7 +1271,9 @@ char *bb_simplify_path(const char *path) FAST_FUNC; /* Returns ptr to NUL */ char *bb_simplify_abs_path_inplace(char *path) FAST_FUNC; +#ifndef LOGIN_FAIL_DELAY #define LOGIN_FAIL_DELAY 3 +#endif extern void bb_do_delay(int seconds) FAST_FUNC; extern void change_identity(const struct passwd *pw) FAST_FUNC; extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) NORETURN FAST_FUNC; -- cgit v1.2.3-55-g6feb From 11775edbfc27d2ad1cd0dff3f7af385f67719866 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 22 Dec 2014 19:37:05 +0100 Subject: randomconfig fixes Signed-off-by: Denys Vlasenko --- archival/tar.c | 8 +++----- libbb/Kbuild.src | 1 + testsuite/find.tests | 3 ++- testsuite/mdev.tests | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/archival/tar.c b/archival/tar.c index e116bd287..aa03ba990 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -745,11 +745,9 @@ static NOINLINE int writeTarFile(int tar_fd, int verboseFlag, #endif return errorFlag; } -#else -int writeTarFile(int tar_fd, int verboseFlag, - int recurseFlags, const llist_t *include, - const llist_t *exclude, const char *gzip); -#endif /* FEATURE_TAR_CREATE */ +#else /* !FEATURE_TAR_CREATE */ +# define writeTarFile(...) 0 +#endif #if ENABLE_FEATURE_TAR_FROM static llist_t *append_file_list_to_list(llist_t *list) diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index f204816c5..7fb687227 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src @@ -142,6 +142,7 @@ lib-$(CONFIG_ADDUSER) += update_passwd.o lib-$(CONFIG_DELGROUP) += update_passwd.o lib-$(CONFIG_DELUSER) += update_passwd.o +lib-$(CONFIG_FTPD) += correct_password.o lib-$(CONFIG_PASSWD) += pw_encrypt.o update_passwd.o obscure.o lib-$(CONFIG_CHPASSWD) += pw_encrypt.o update_passwd.o lib-$(CONFIG_CRYPTPW) += pw_encrypt.o diff --git a/testsuite/find.tests b/testsuite/find.tests index f041106c3..78dfa1230 100755 --- a/testsuite/find.tests +++ b/testsuite/find.tests @@ -10,11 +10,12 @@ mkdir -p find.tempdir touch find.tempdir/testfile +optional FEATURE_FIND_TYPE testing "find -type f" \ "cd find.tempdir && find -type f 2>&1" \ "./testfile\n" \ "" "" - +SKIP= optional FEATURE_FIND_EXEC testing "find -exec exitcode 1" \ "cd find.tempdir && find testfile -exec true {} \; 2>&1; echo \$?" \ diff --git a/testsuite/mdev.tests b/testsuite/mdev.tests index 48d3dcc2c..59873011a 100755 --- a/testsuite/mdev.tests +++ b/testsuite/mdev.tests @@ -168,7 +168,7 @@ SKIP= # continuing to use directory structure from prev test rm -rf mdev.testdir/dev/* echo "sda 0:0 644 @echo @echo TEST" >mdev.testdir/etc/mdev.conf -optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME FEATURE_SH_IS_ASH +optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME FEATURE_SH_IS_ASH ASH_BUILTIN_ECHO testing "mdev command" \ "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; ls -lnR mdev.testdir/dev | $FILTER_LS" \ -- cgit v1.2.3-55-g6feb From ca9c4653a95907e32674c2eb5dc3921dc8e6f1a0 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 24 Dec 2014 01:46:29 +0100 Subject: libbb: add sanity check in bb_arg_max() Signed-off-by: Denys Vlasenko --- libbb/sysconf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libbb/sysconf.c b/libbb/sysconf.c index cfad9cdc0..8c1caef5c 100644 --- a/libbb/sysconf.c +++ b/libbb/sysconf.c @@ -11,7 +11,15 @@ #if !defined(bb_arg_max) unsigned FAST_FUNC bb_arg_max(void) { - return sysconf(_SC_ARG_MAX); + long r = sysconf(_SC_ARG_MAX); + + /* I've seen a version of uclibc which returned -1. + * Guard about it, and also avoid insanely large values + */ + if ((unsigned long)r > 64*1024*1024) + r = 64*1024*1024; + + return r; } #endif -- cgit v1.2.3-55-g6feb From 6968e081230fb6434a2a6f0eed39d538ea982f3f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 24 Dec 2014 01:23:34 +0100 Subject: Bump version to 1.23.0 Signed-off-by: Denys Vlasenko --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 778a02ff8..b487f0457 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 1 PATCHLEVEL = 23 SUBLEVEL = 0 -EXTRAVERSION = .git +EXTRAVERSION = NAME = Unnamed # *DOCUMENTATION* -- cgit v1.2.3-55-g6feb