diff --git a/.gitignore b/.gitignore index cfe64496f..7840855c0 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ core # /busybox.links /runtest-tempdir-links +/testsuite/echo-ne diff --git a/include/busybox.h b/include/busybox.h index c7ad28069..6f61aead3 100644 --- a/include/busybox.h +++ b/include/busybox.h @@ -5,7 +5,7 @@ #ifndef BUSYBOX_H #define BUSYBOX_H 1 -#define BB_VER "1.22.1" +#define BB_VER "1.23.0 (GNO hush 0.2)" #include "libbb.h" /* BB_DIR_foo and BB_SUID_bar constants: */ diff --git a/include/libbb.h b/include/libbb.h index 8af70be68..db60be766 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -682,11 +682,14 @@ extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST /* Never returns NULL */ extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; -#if defined ARG_MAX +#if defined(ARG_MAX) && (ARG_MAX >= 60*1024 || !defined(_SC_ARG_MAX)) +/* Use _constant_ maximum if: defined && (big enough || no variable one exists) */ # define bb_arg_max() ((unsigned)ARG_MAX) -#elif defined _SC_ARG_MAX +#elif defined(_SC_ARG_MAX) +/* Else use variable one (a bit more expensive) */ unsigned bb_arg_max(void) FAST_FUNC; #else +/* If all else fails */ # define bb_arg_max() ((unsigned)(32 * 1024)) #endif unsigned bb_clk_tck(void) FAST_FUNC; @@ -1145,7 +1148,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; diff --git a/libbb/lineedit.c b/libbb/lineedit.c index b5fef2d03..a343a726e 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2438,15 +2438,19 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman #ifndef __GNO__ if (tcgetattr(STDIN_FILENO, &initial_settings) < 0 - || !(initial_settings.c_lflag & ECHO) + || (initial_settings.c_lflag & (ECHO|ICANON)) == ICANON #else if (ioctl(STDIN_FILENO, TIOCGETP, &initial_settings) < 0 || ioctl(STDIN_FILENO, TIOCGETC, &initial_tchars) < 0 || ioctl(STDIN_FILENO, TIOCGETK, &initial_ttyk) < 0 - || !(initial_settings.sg_flags & ECHO) + || (initial_settings.sg_flags & (ECHO|CBREAK|RAW)) == 0 #endif ) { - /* Happens when e.g. stty -echo was run before */ + /* Happens when e.g. stty -echo was run before. + * But if ICANON is not set, we don't come here. + * (example: interactive python ^Z-backgrounded, + * tty is still in "raw mode"). + */ parse_and_put_prompt(prompt); /* fflush_all(); - done by parse_and_put_prompt */ if (fgets(command, maxsize, stdin) == NULL) @@ -2815,7 +2819,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':