# Helper script to build busybox-power
# Please run me from within Scratchbox
-BBVERSION="1.19.4"
+BBVERSION="1.20.0"
MAKETHREADS="8"
SCRIPTDIR=`dirname $(readlink -f $0)`
BUILDDIR="$SCRIPTDIR/../busybox-power-build"
#
# Automatically generated make config: don't edit
-# Busybox version: 1.19.0
-# Sat Aug 20 15:11:20 2011
+# Busybox version: 1.20.0
+# Sun Apr 22 18:33:52 2012
#
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_FEATURE_SHARED_BUSYBOX is not set
CONFIG_LFS=y
CONFIG_CROSS_COMPILER_PREFIX=""
+CONFIG_SYSROOT=""
CONFIG_EXTRA_CFLAGS=""
+CONFIG_EXTRA_LDFLAGS=""
+CONFIG_EXTRA_LDLIBS=""
#
# Debugging Options
# CONFIG_FEATURE_SYSTEMD is not set
CONFIG_FEATURE_RTMINMAX=y
CONFIG_PASSWORD_MINLEN=6
-CONFIG_MD5_SIZE_VS_SPEED=0
+CONFIG_MD5_SMALL=1
CONFIG_FEATURE_FAST_TOP=y
# CONFIG_FEATURE_ETC_NETWORKS is not set
CONFIG_FEATURE_USE_TERMIOS=y
CONFIG_GUNZIP=y
CONFIG_GZIP=y
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_GZIP_FAST=2
CONFIG_LZOP=y
# CONFIG_LZOP_COMPR_HIGH is not set
CONFIG_RPM2CPIO=y
CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
CONFIG_FEATURE_TAR_LONG_OPTIONS=y
-CONFIG_FEATURE_TAR_TOUCH=y
CONFIG_FEATURE_TAR_TO_COMMAND=y
CONFIG_FEATURE_TAR_UNAME_GNAME=y
CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
CONFIG_FEATURE_DATE_ISOFMT=y
# CONFIG_FEATURE_DATE_NANO is not set
CONFIG_FEATURE_DATE_COMPAT=y
+CONFIG_HOSTID=y
CONFIG_ID=y
CONFIG_GROUPS=y
CONFIG_TEST=y
CONFIG_FEATURE_TEST_64=y
CONFIG_TOUCH=y
+CONFIG_FEATURE_TOUCH_SUSV3=y
CONFIG_TR=y
CONFIG_FEATURE_TR_CLASSES=y
CONFIG_FEATURE_TR_EQUIV=y
CONFIG_FSYNC=y
CONFIG_HEAD=y
CONFIG_FEATURE_FANCY_HEAD=y
-CONFIG_HOSTID=y
CONFIG_INSTALL=y
CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
CONFIG_LN=y
CONFIG_FEATURE_DEL_USER_FROM_GROUP=y
CONFIG_GETTY=y
CONFIG_LOGIN=y
+# CONFIG_LOGIN_SESSION_AS_CHILD is not set
# CONFIG_PAM is not set
CONFIG_LOGIN_SCRIPTS=y
CONFIG_FEATURE_NOLOGIN=y
CONFIG_FEATURE_PASSWD_WEAK_CHECK=y
CONFIG_CRYPTPW=y
CONFIG_CHPASSWD=y
+CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="des"
CONFIG_SU=y
CONFIG_FEATURE_SU_SYSLOG=y
CONFIG_FEATURE_SU_CHECKS_SHELLS=y
# Linux System Utilities
#
CONFIG_BLOCKDEV=y
+CONFIG_MDEV=y
+CONFIG_FEATURE_MDEV_CONF=y
+CONFIG_FEATURE_MDEV_RENAME=y
+CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
+CONFIG_FEATURE_MDEV_EXEC=y
+CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
CONFIG_REV=y
CONFIG_ACPID=y
CONFIG_FEATURE_ACPID_COMPAT=y
CONFIG_LOSETUP=y
CONFIG_LSPCI=y
CONFIG_LSUSB=y
-CONFIG_MDEV=y
-CONFIG_FEATURE_MDEV_CONF=y
-CONFIG_FEATURE_MDEV_RENAME=y
-CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
-CONFIG_FEATURE_MDEV_EXEC=y
-CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
CONFIG_MKSWAP=y
CONFIG_FEATURE_MKSWAP_UUID=y
CONFIG_MORE=y
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
CONFIG_TUNCTL=y
CONFIG_FEATURE_TUNCTL_UG=y
+# CONFIG_UDHCPC6 is not set
CONFIG_UDHCPD=y
CONFIG_DHCPRELAY=y
CONFIG_DUMPLEASES=y
# Process Utilities
#
CONFIG_IOSTAT=y
+# CONFIG_LSOF is not set
CONFIG_MPSTAT=y
CONFIG_NMETER=y
CONFIG_PMAP=y
CONFIG_FEATURE_PS_WIDE=y
CONFIG_FEATURE_PS_TIME=y
CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
+CONFIG_FEATURE_PS_LONG=y
# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
CONFIG_RENICE=y
CONFIG_BB_SYSCTL=y
+++ /dev/null
-From 0221708f0f7147c84c8f7288e9c510241d296a4c Mon Sep 17 00:00:00 2001
-From: Dennis Groenen <tj.groenen@gmail.com>
-Date: Sun, 22 Jan 2012 20:15:21 +0100
-Subject: [PATCH] vi: implement :p (go to previous file)
-
----
- editors/vi.c | 8 ++++++++
- 1 files changed, 8 insertions(+), 0 deletions(-)
-
-diff --git a/editors/vi.c b/editors/vi.c
-index 4a2d5d4..ddca9d6 100644
---- a/editors/vi.c
-+++ b/editors/vi.c
-@@ -1111,6 +1111,7 @@ static void colon(char *buf)
- Hit_Return();
- } else if (strncmp(cmd, "quit", i) == 0 // quit
- || strncmp(cmd, "next", i) == 0 // edit next file
-+ || strncmp(cmd, "prev", i) == 0 // edit previous file
- ) {
- int n;
- if (useforce) {
-@@ -1137,6 +1138,13 @@ static void colon(char *buf)
- status_line_bold("No more files to edit");
- goto ret;
- }
-+ // are there previous files to edit
-+ if (*cmd == 'p' && optind <= 1) {
-+ status_line_bold("No previous files to edit");
-+ goto ret;
-+ } else if (*cmd == 'p' && optind > 1) {
-+ optind = optind - 2;
-+ }
- editing = 0;
- } else if (strncmp(cmd, "read", i) == 0) { // read file into text[]
- fn = args;
---
-1.7.8.4
-
+++ /dev/null
-Allows compatibility with tar -m / --touch command line option
-By Yauheni Kaliuta <yauheni.kaliuta@nokia.com>
-
-Ported to BusyBox 1.19 by Dennis Groenen <tj.groenen@gmail.com> - 2011-08-19
----
-
---- a/archival/Config.src
-+++ b/archival/Config.src
-@@ -280,6 +280,13 @@ config FEATURE_TAR_LONG_OPTIONS
- help
- Enable use of long options, increases size by about 400 Bytes
-
-+config FEATURE_TAR_TOUCH
-+ bool "Enable ignoring touch option"
-+ default n
-+ depends on TAR
-+ help
-+ Allows compatibility with -m / --touch command line option.
-+
- config FEATURE_TAR_TO_COMMAND
- bool "Support for writing to an external program"
- default y
---- a/archival/tar.c
-+++ b/archival/tar.c
-@@ -819,6 +819,7 @@ enum {
- IF_FEATURE_TAR_TO_COMMAND(OPTBIT_2COMMAND ,)
- OPTBIT_NUMERIC_OWNER,
- OPTBIT_NOPRESERVE_PERM,
-+ IF_FEATURE_TAR_TOUCH( OPTBIT_TOUCH ,)
- OPTBIT_OVERWRITE,
- #endif
- OPT_TEST = 1 << 0, // t
-@@ -842,6 +843,7 @@ enum {
- OPT_2COMMAND = IF_FEATURE_TAR_TO_COMMAND( (1 << OPTBIT_2COMMAND )) + 0, // to-command
- OPT_NUMERIC_OWNER = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NUMERIC_OWNER )) + 0, // numeric-owner
- OPT_NOPRESERVE_PERM = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NOPRESERVE_PERM)) + 0, // no-same-permissions
-+ OPT_TOUCH = IF_FEATURE_TAR_TOUCH( (1 << OPTBIT_TOUCH )) + 0, // m
- OPT_OVERWRITE = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_OVERWRITE )) + 0, // overwrite
- };
- #if ENABLE_FEATURE_TAR_LONG_OPTIONS
-@@ -895,6 +897,9 @@ static const char tar_longopts[] ALIGN1
- # if ENABLE_FEATURE_TAR_FROM
- "exclude\0" Required_argument "\xff"
- # endif
-+# if ENABLE_FEATURE_TAR_TOUCH
-+ "touch\0" No_argument "m"
-+# endif
- ;
- #endif
-
-@@ -970,6 +975,7 @@ int tar_main(int argc UNUSED_PARAM, char
- IF_FEATURE_SEAMLESS_GZ( "z" )
- IF_FEATURE_SEAMLESS_Z( "Z" )
- IF_FEATURE_TAR_NOPRESERVE_TIME("m")
-+ IF_FEATURE_TAR_TOUCH( "m" )
- , &base_dir // -C dir
- , &tar_filename // -f filename
- IF_FEATURE_TAR_FROM(, &(tar_handle->accept)) // T
repeat:
#ifdef SYSV
do {
-@@ -7465,24 +7450,21 @@ shellexec(char **argv, const char *path,
+@@ -7471,30 +7456,21 @@ shellexec(char **argv, const char *path,
int e;
char **envp;
int exerrno;
--#if ENABLE_FEATURE_SH_STANDALONE
-- int applet_no = -1;
--#endif
+- int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */
clearredir(/*drop:*/ 1);
envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
-#endif
- ) {
- tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp);
+- if (applet_no >= 0) {
+- /* We tried execing ourself, but it didn't work.
+- * Maybe /proc/self/exe doesn't exist?
+- * Try $PATH search.
+- */
+- goto try_PATH;
+- }
+ if (strchr(argv[0], '/') != NULL) {
+ tryexec(argv[0], argv, envp);
e = errno;
} else {
+- try_PATH:
+#if ENABLE_FEATURE_SH_STANDALONE
+ bb_execv_applet(argv[0], argv, envp);
+#endif
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here. Check libbb.h before changing! */
--- a/include/libbb.h
-+++ b/include/libbb.h
-@@ -896,13 +896,11 @@ int exists_execable(const char *filename
++++ b/include/libbb.h 2012-04-22 19:29:26.095992610 +0200
+@@ -903,13 +903,11 @@ int exists_execable(const char *filename
* but it may exec busybox and call applet instead of searching PATH.
*/
#if ENABLE_FEATURE_PREFER_APPLETS
#else
#define BB_EXECVP(prog,cmd) execvp(prog,cmd)
#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
-@@ -1683,6 +1681,7 @@ extern const char bb_path_wtmp_file[];
+@@ -1725,6 +1723,7 @@ extern const char bb_path_wtmp_file[];
#define bb_dev_null "/dev/null"
extern const char bb_busybox_exec_path[];
extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
--- a/Config.in
+++ b/Config.in
-@@ -431,13 +431,10 @@ config FEATURE_PREFER_APPLETS
+@@ -432,13 +432,10 @@ config FEATURE_PREFER_APPLETS
config BUSYBOX_EXEC_PATH
string "Path to BusyBox executable"
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
-@@ -41,5 +41,7 @@ int chroot_main(int argc UNUSED_PARAM, c
+@@ -40,5 +40,7 @@ int chroot_main(int argc UNUSED_PARAM, c
/*argv[2] = NULL; - already is */
}
+++ /dev/null
-From cd09e81520b7917adebcffd7c361671f913325eb Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Thu, 23 Feb 2012 14:20:22 +0000
-Subject: [PATCH] grep: support for -x, match whole line
-
-Specified in POSIX.
-http://pubs.opengroup.org/onlinepubs/009604499/utilities/grep.html
-
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- findutils/grep.c | 12 +++++++++---
- 1 file changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/findutils/grep.c b/findutils/grep.c
-index 5f42242..f14d6e6 100644
---- a/findutils/grep.c
-+++ b/findutils/grep.c
-@@ -85,6 +85,7 @@
- //usage: "\n -r Recurse"
- //usage: "\n -i Ignore case"
- //usage: "\n -w Match whole words only"
-+//usage: "\n -x Match whole lines only"
- //usage: "\n -F PATTERN is a literal (not regexp)"
- //usage: IF_FEATURE_GREP_EGREP_ALIAS(
- //usage: "\n -E PATTERN is an extended regexp"
-@@ -113,7 +114,7 @@
- //usage:#define fgrep_full_usage ""
-
- #define OPTSTR_GREP \
-- "lnqvscFiHhe:f:Lorm:w" \
-+ "lnqvscFiHhe:f:Lorm:wx" \
- IF_FEATURE_GREP_CONTEXT("A:B:C:") \
- IF_FEATURE_GREP_EGREP_ALIAS("E") \
- IF_EXTRA_COMPAT("z") \
-@@ -138,6 +139,7 @@ enum {
- OPTBIT_r, /* recurse dirs */
- OPTBIT_m, /* -m MAX_MATCHES */
- OPTBIT_w, /* -w whole word match */
-+ OPTBIT_x, /* -x whole line match */
- IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */
- IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */
- IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */
-@@ -160,6 +162,7 @@ enum {
- OPT_r = 1 << OPTBIT_r,
- OPT_m = 1 << OPTBIT_m,
- OPT_w = 1 << OPTBIT_w,
-+ OPT_x = 1 << OPTBIT_x,
- OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0,
- OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0,
- OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0,
-@@ -370,9 +373,12 @@ static int grep_file(FILE *file)
- &gl->matched_range) >= 0
- #endif
- ) {
-- if (!(option_mask32 & OPT_w))
-+ if (option_mask32 & OPT_x) {
-+ found = (gl->matched_range.rm_so == 0
-+ && line[gl->matched_range.rm_eo] == '\0');
-+ } else if (!(option_mask32 & OPT_w)) {
- found = 1;
-- else {
-+ } else {
- char c = ' ';
- if (gl->matched_range.rm_so)
- c = line[gl->matched_range.rm_so - 1];
---
-1.7.9.3
-
+++ /dev/null
-The following commit has been modified to fit BusyBox 1.19.2 instead of BusyBox git
---Dennis Groenen <tj.groenen@gmail.com> - 2011-09-10
-
-From 4840ae8a06298e987374fa3cc6d7e4969fd19344 Mon Sep 17 00:00:00 2001
-From: Denys Vlasenko <vda.linux@googlemail.com>
-Date: Sun, 4 Sep 2011 15:28:03 +0200
-Subject: [PATCH 1/3] lineedit: fix atomic replace of history file; hush: fix
- $HISTFILE handling
-
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
-
---- a/libbb/lineedit.c
-+++ b/libbb/lineedit.c
-@@ -1475,7 +1475,7 @@ static void remember_in_history(char *st
- /* i <= state->max_history */
- state->cur_history = i;
- state->cnt_history = i;
--# if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
-+# if ENABLE_FEATURE_EDITING_SAVEHISTORY
- if ((state->flags & SAVE_HISTORY) && state->hist_file)
- save_history(str);
- # endif
---- a/shell/ash.c
-+++ b/shell/ash.c
-@@ -13194,7 +13194,7 @@ int ash_main(int argc UNUSED_PARAM, char
- }
-
- if (sflag || minusc == NULL) {
--#if defined MAX_HISTORY && MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
-+#if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
- if (iflag) {
- const char *hp = lookupvar("HISTFILE");
- if (hp)
---- a/shell/hush.c
-+++ b/shell/hush.c
-@@ -7816,27 +7816,7 @@ int hush_main(int argc, char **argv)
- */
-
- #if ENABLE_FEATURE_EDITING
-- G.line_input_state = new_line_input_t(FOR_SHELL);
--# if MAX_HISTORY > 0 && ENABLE_HUSH_SAVEHISTORY
-- {
-- const char *hp = get_local_var_value("HISTFILE");
-- if (!hp) {
-- hp = get_local_var_value("HOME");
-- if (hp)
-- hp = concat_path_file(hp, ".hush_history");
-- } else {
-- hp = xstrdup(hp);
-- }
-- if (hp) {
-- G.line_input_state->hist_file = hp;
-- //set_local_var(xasprintf("HISTFILE=%s", ...));
-- }
--# if ENABLE_FEATURE_SH_HISTFILESIZE
-- hp = get_local_var_value("HISTFILESIZE");
-- G.line_input_state->max_history = size_from_HISTFILESIZE(hp);
--# endif
-- }
--# endif
-+ G.line_input_state = new_line_input_t(FOR_SHELL & ~SAVE_HISTORY);
- #endif
-
- /* Initialize some more globals to non-zero values */
-@@ -8108,6 +8088,28 @@ int hush_main(int argc, char **argv)
- /* -1 is special - makes xfuncs longjmp, not exit
- * (we reset die_sleep = 0 whereever we [v]fork) */
- enable_restore_tty_pgrp_on_exit(); /* sets die_sleep = -1 */
-+
-+# if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0
-+ {
-+ const char *hp = get_local_var_value("HISTFILE");
-+ if (!hp) {
-+ hp = get_local_var_value("HOME");
-+ if (hp)
-+ hp = concat_path_file(hp, ".hush_history");
-+ } else {
-+ hp = xstrdup(hp);
-+ }
-+ if (hp) {
-+ G.line_input_state->hist_file = hp;
-+ G.line_input_state->flags |= SAVE_HISTORY;
-+ //set_local_var(xasprintf("HISTFILE=%s", ...));
-+ }
-+# if ENABLE_FEATURE_SH_HISTFILESIZE
-+ hp = get_local_var_value("HISTFILESIZE");
-+ G.line_input_state->max_history = size_from_HISTFILESIZE(hp);
-+# endif
-+ }
-+# endif
- } else {
- install_special_sighandlers();
- }
+++ /dev/null
-From bede215cf105377a1127532d2d710924cb58cc39 Mon Sep 17 00:00:00 2001
-From: Denys Vlasenko <vda.linux@googlemail.com>
-Date: Sun, 4 Sep 2011 16:12:33 +0200
-Subject: [PATCH 2/3] lineedit: add support for history saving on exit
-
-Based on the patch by Dennis Groenen <tj.groenen@gmail.com>
-
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- include/libbb.h | 9 +++++++
- libbb/Config.src | 7 +++++
- libbb/lineedit.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++----
- shell/ash.c | 4 +++
- shell/hush.c | 4 +++
- 5 files changed, 86 insertions(+), 6 deletions(-)
-
-diff --git a/include/libbb.h b/include/libbb.h
-index 63d0419..91343a9 100644
---- a/include/libbb.h
-+++ b/include/libbb.h
-@@ -1421,6 +1421,12 @@ typedef struct line_input_t {
- int cur_history;
- int max_history; /* must never be <= 0 */
- # if ENABLE_FEATURE_EDITING_SAVEHISTORY
-+ /* meaning of this field depends on FEATURE_EDITING_SAVE_ON_EXIT:
-+ * if !FEATURE_EDITING_SAVE_ON_EXIT: "how many lines are
-+ * in on-disk history"
-+ * if FEATURE_EDITING_SAVE_ON_EXIT: "how many in-memory lines are
-+ * also in on-disk history (and thus need to be skipped on save)"
-+ */
- unsigned cnt_history_in_file;
- const char *hist_file;
- # endif
-@@ -1446,6 +1452,9 @@ line_input_t *new_line_input_t(int flags) FAST_FUNC;
- * >0 length of input string, including terminating '\n'
- */
- int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout) FAST_FUNC;
-+# if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT
-+void save_history(line_input_t *st);
-+# endif
- #else
- #define MAX_HISTORY 0
- int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC;
-diff --git a/libbb/Config.src b/libbb/Config.src
-index aa44236..f6f88b9 100644
---- a/libbb/Config.src
-+++ b/libbb/Config.src
-@@ -94,6 +94,13 @@ config FEATURE_EDITING_SAVEHISTORY
- help
- Enable history saving in shells.
-
-+config FEATURE_EDITING_SAVE_ON_EXIT
-+ bool "Save history on shell exit, not after every command"
-+ default n
-+ depends on FEATURE_EDITING_SAVEHISTORY
-+ help
-+ Save history on shell exit, not after every command.
-+
- config FEATURE_REVERSE_SEARCH
- bool "Reverse history search"
- default y
-diff --git a/libbb/lineedit.c b/libbb/lineedit.c
-index 5d13904..0786f9a 100644
---- a/libbb/lineedit.c
-+++ b/libbb/lineedit.c
-@@ -1351,7 +1351,9 @@ static void load_history(line_input_t *st_parm)
-
- /* fill temp_h[], retaining only last MAX_HISTORY lines */
- memset(temp_h, 0, sizeof(temp_h));
-- st_parm->cnt_history_in_file = idx = 0;
-+ idx = 0;
-+ if (!ENABLE_FEATURE_EDITING_SAVE_ON_EXIT)
-+ st_parm->cnt_history_in_file = 0;
- while ((line = xmalloc_fgetline(fp)) != NULL) {
- if (line[0] == '\0') {
- free(line);
-@@ -1359,7 +1361,8 @@ static void load_history(line_input_t *st_parm)
- }
- free(temp_h[idx]);
- temp_h[idx] = line;
-- st_parm->cnt_history_in_file++;
-+ if (!ENABLE_FEATURE_EDITING_SAVE_ON_EXIT)
-+ st_parm->cnt_history_in_file++;
- idx++;
- if (idx == st_parm->max_history)
- idx = 0;
-@@ -1389,15 +1392,66 @@ static void load_history(line_input_t *st_parm)
- st_parm->history[i++] = line;
- }
- st_parm->cnt_history = i;
-+ if (ENABLE_FEATURE_EDITING_SAVE_ON_EXIT)
-+ st_parm->cnt_history_in_file = i;
- }
- }
-
--/* state->flags is already checked to be nonzero */
-+# if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT
-+void save_history(line_input_t *st)
-+{
-+ FILE *fp;
-+
-+ if (!(st->flags & SAVE_HISTORY))
-+ return;
-+ if (!st->hist_file)
-+ return;
-+ if (st->cnt_history <= st->cnt_history_in_file)
-+ return;
-+
-+ fp = fopen(st->hist_file, "a");
-+ if (fp) {
-+ int i, fd;
-+ char *new_name;
-+ line_input_t *st_temp;
-+
-+ for (i = st->cnt_history_in_file; i < st->cnt_history; i++)
-+ fprintf(fp, "%s\n", st->history[i]);
-+ fclose(fp);
-+
-+ /* we may have concurrently written entries from others.
-+ * load them */
-+ st_temp = new_line_input_t(st->flags);
-+ st_temp->hist_file = st->hist_file;
-+ st_temp->max_history = st->max_history;
-+ load_history(st_temp);
-+
-+ /* write out temp file and replace hist_file atomically */
-+ new_name = xasprintf("%s.%u.new", st->hist_file, (int) getpid());
-+ fd = open(new_name, O_WRONLY | O_CREAT | O_TRUNC, 0600);
-+ if (fd >= 0) {
-+ fp = xfdopen_for_write(fd);
-+ for (i = 0; i < st_temp->cnt_history; i++)
-+ fprintf(fp, "%s\n", st_temp->history[i]);
-+ fclose(fp);
-+ if (rename(new_name, st->hist_file) == 0)
-+ st->cnt_history_in_file = st_temp->cnt_history;
-+ }
-+ free(new_name);
-+ free_line_input_t(st_temp);
-+ }
-+}
-+# else
- static void save_history(char *str)
- {
- int fd;
- int len, len2;
-
-+ if (!(state->flags & SAVE_HISTORY))
-+ return;
-+ if (!state->hist_file)
-+ return;
-+
- fd = open(state->hist_file, O_WRONLY | O_CREAT | O_APPEND, 0600);
- if (fd < 0)
- return;
-@@ -1441,6 +1495,7 @@ static void save_history(char *str)
- free_line_input_t(st_temp);
- }
- }
-+# endif
- # else
- # define load_history(a) ((void)0)
- # define save_history(a) ((void)0)
-@@ -1469,15 +1524,16 @@ static void remember_in_history(char *str)
- for (i = 0; i < state->max_history-1; i++)
- state->history[i] = state->history[i+1];
- /* i == state->max_history-1 */
-+ if (ENABLE_FEATURE_EDITING_SAVE_ON_EXIT && state->cnt_history_in_file)
-+ state->cnt_history_in_file--;
- }
- /* i <= state->max_history-1 */
- state->history[i++] = xstrdup(str);
- /* i <= state->max_history */
- state->cur_history = i;
- state->cnt_history = i;
--# if ENABLE_FEATURE_EDITING_SAVEHISTORY
-- if ((state->flags & SAVE_HISTORY) && state->hist_file)
-- save_history(str);
-+# if ENABLE_FEATURE_EDITING_SAVEHISTORY && !ENABLE_FEATURE_EDITING_SAVE_ON_EXIT
-+ save_history(str);
- # endif
- IF_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines++;)
- }
-diff --git a/shell/ash.c b/shell/ash.c
-index bf376bd..14472cb 100644
---- a/shell/ash.c
-+++ b/shell/ash.c
-@@ -12888,6 +12888,10 @@ exitshell(void)
- char *p;
- int status;
-
-+#if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT
-+ save_history(line_input_state);
-+#endif
-+
- status = exitstatus;
- TRACE(("pid %d, exitshell(%d)\n", getpid(), status));
- if (setjmp(loc.loc)) {
-diff --git a/shell/hush.c b/shell/hush.c
-index 42143fd..a9e2dd3 100644
---- a/shell/hush.c
-+++ b/shell/hush.c
-@@ -1541,6 +1541,10 @@ static sighandler_t pick_sighandler(unsigned sig)
- static void hush_exit(int exitcode) NORETURN;
- static void hush_exit(int exitcode)
- {
-+#if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT
-+ save_history(G.line_input_state);
-+#endif
-+
- fflush_all();
- if (G.exiting <= 0 && G.traps && G.traps[0] && G.traps[0][0]) {
- char *argv[3];
---
-1.7.6.1
-
+++ /dev/null
-From e45af7ad17c3f0ecaec1d761aa89cb4fd83afbc2 Mon Sep 17 00:00:00 2001
-From: Denys Vlasenko <vda.linux@googlemail.com>
-Date: Sun, 4 Sep 2011 16:15:24 +0200
-Subject: [PATCH 3/3] lineedit: remove SAVE_HISTORY bit, ->hist_file can be
- used as indicator
-
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- include/libbb.h | 13 ++++++-------
- libbb/lineedit.c | 6 +-----
- shell/hush.c | 3 +--
- 3 files changed, 8 insertions(+), 14 deletions(-)
-
-diff --git a/include/libbb.h b/include/libbb.h
-index 91343a9..1ca4489 100644
---- a/include/libbb.h
-+++ b/include/libbb.h
-@@ -1434,13 +1434,12 @@ typedef struct line_input_t {
- # endif
- } line_input_t;
- enum {
-- DO_HISTORY = 1 * (MAX_HISTORY > 0),
-- SAVE_HISTORY = 2 * (MAX_HISTORY > 0) * ENABLE_FEATURE_EDITING_SAVEHISTORY,
-- TAB_COMPLETION = 4 * ENABLE_FEATURE_TAB_COMPLETION,
-- USERNAME_COMPLETION = 8 * ENABLE_FEATURE_USERNAME_COMPLETION,
-- VI_MODE = 0x10 * ENABLE_FEATURE_EDITING_VI,
-- WITH_PATH_LOOKUP = 0x20,
-- FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
-+ DO_HISTORY = 1 * (MAX_HISTORY > 0),
-+ TAB_COMPLETION = 2 * ENABLE_FEATURE_TAB_COMPLETION,
-+ USERNAME_COMPLETION = 4 * ENABLE_FEATURE_USERNAME_COMPLETION,
-+ VI_MODE = 8 * ENABLE_FEATURE_EDITING_VI,
-+ WITH_PATH_LOOKUP = 0x10,
-+ FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
- };
- line_input_t *new_line_input_t(int flags) FAST_FUNC;
- /* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */
-diff --git a/libbb/lineedit.c b/libbb/lineedit.c
-index 0786f9a..603bbfc 100644
---- a/libbb/lineedit.c
-+++ b/libbb/lineedit.c
-@@ -1402,8 +1402,6 @@ void save_history(line_input_t *st)
- {
- FILE *fp;
-
-- if (!(st->flags & SAVE_HISTORY))
-- return;
- if (!st->hist_file)
- return;
- if (st->cnt_history <= st->cnt_history_in_file)
-@@ -1447,8 +1445,6 @@ static void save_history(char *str)
- int fd;
- int len, len2;
-
-- if (!(state->flags & SAVE_HISTORY))
-- return;
- if (!state->hist_file)
- return;
-
-@@ -2188,7 +2184,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
- state = st ? st : (line_input_t*) &const_int_0;
- #if MAX_HISTORY > 0
- # if ENABLE_FEATURE_EDITING_SAVEHISTORY
-- if ((state->flags & SAVE_HISTORY) && state->hist_file)
-+ if (state->hist_file)
- if (state->cnt_history == 0)
- load_history(state);
- # endif
-diff --git a/shell/hush.c b/shell/hush.c
-index a9e2dd3..7a34f59 100644
---- a/shell/hush.c
-+++ b/shell/hush.c
-@@ -7820,7 +7820,7 @@ int hush_main(int argc, char **argv)
- */
-
- #if ENABLE_FEATURE_EDITING
-- G.line_input_state = new_line_input_t(FOR_SHELL & ~SAVE_HISTORY);
-+ G.line_input_state = new_line_input_t(FOR_SHELL);
- #endif
-
- /* Initialize some more globals to non-zero values */
-@@ -8105,7 +8105,6 @@ int hush_main(int argc, char **argv)
- }
- if (hp) {
- G.line_input_state->hist_file = hp;
-- G.line_input_state->flags |= SAVE_HISTORY;
- //set_local_var(xasprintf("HISTFILE=%s", ...));
- }
- # if ENABLE_FEATURE_SH_HISTFILESIZE
---
-1.7.6.1
-
--- a/init/init.c
+++ b/init/init.c
-@@ -563,6 +563,8 @@ static void run_actions(int action_type)
+@@ -576,6 +576,8 @@ static void run_actions(int action_type)
for (a = init_action_list; a; a = a->next) {
if (!(a->action_type & action_type))
continue;
--- a/procps/ps.c
+++ b/procps/ps.c
-@@ -633,7 +633,7 @@ int ps_main(int argc UNUSED_PARAM, char
- /* -w is a bit complicated */
+@@ -645,7 +645,7 @@ int ps_main(int argc UNUSED_PARAM, char
int w_count = 0;
opt_complementary = "-:ww";
-- opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")"w", &w_count);
-+ opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")"w""ANdeagrxCGUgpstuUojOlFfsvuXVmMLScnfyH", &w_count, NULL);
+ opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")IF_FEATURE_PS_LONG("l")
+- "w", &w_count);
++ "w""ANdeagrxCGUgpstuUojOFfsvuXVmMLScnfyH", &w_count, NULL);
/* if w is given once, GNU ps sets the width to 132,
* if w is given more than once, it is "unlimited"
*/
-@@ -648,7 +648,7 @@ int ps_main(int argc UNUSED_PARAM, char
+@@ -660,7 +660,8 @@ int ps_main(int argc UNUSED_PARAM, char
# else
/* -w is not supported, only -Z and/or -T */
opt_complementary = "-";
-- opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T"));
-+ opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")"ANdeagrxCGUgpstuUojOlFfsvuXVmMLScnfyHw", NULL);
+- opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")IF_FEATURE_PS_LONG("l"));
++ opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")IF_FEATURE_PS_LONG("l")
++ "ANdeagrxCGUgpstuUojOFfsvuXVmMLScnfyHw", NULL);
# endif
- #endif
+ # if ENABLE_SELINUX
#Updated patches from Debian Sid; these are also in Nokia's busybox sources
#Source: http://ftp.de.debian.org/debian/pool/main/b/busybox/busybox_1.19.3-5.debian.tar.gz
+# ported to BusyBox 1.20.0
shell-ash-export-HOME.patch
applets-fallback.patch
init-console.patch
version.patch
#Patches ported from Nokia's busybox sources
-03tar.patch
05thumb.patch
06ls.patch
busybox-zero-ifr.ifr_hwaddr.sa_data.patch
#New patches as per reported issues by users
showkey-default-option.patch
-0001-vi-implement-p-go-to-previous-file.patch
#Hotfixes
#Patched pulled from busybox git
-git-backports/0001-lineedit-fix-atomic-replace-of-history-file-hush-fix.patch
-git-backports/0002-lineedit-add-support-for-history-saving-on-exit.patch
-git-backports/0003-lineedit-remove-SAVE_HISTORY-bit-hist_file-can-be-us.patch
-git-backports/0001-grep-support-for-x-match-whole-line.patch
#Miscellaneous
0001-lineedit-fix-history-saving-when-history-MAX_HISTORY.patch
--- a/shell/ash.c
+++ b/shell/ash.c
-@@ -1897,7 +1897,7 @@ static const struct {
+@@ -1904,7 +1904,7 @@ static const struct {
{ VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL" , changemail },
{ VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH" , changemail },
#endif