busybox: update upstream patches

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2010-07-20 00:22:30 +02:00
parent bc015eb344
commit 99757b0b31
7 changed files with 377 additions and 10 deletions

View File

@ -0,0 +1,50 @@
diff -urpN busybox-1.17.0/libbb/lineedit.c busybox-1.17.0-ask_terminal/libbb/lineedit.c
--- busybox-1.17.0/libbb/lineedit.c 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-ask_terminal/libbb/lineedit.c 2010-07-18 22:38:47.000000000 +0200
@@ -151,6 +151,7 @@ struct lineedit_statics {
CHAR_T delbuf[DELBUFSIZ]; /* a place to store deleted characters */
#endif
#if ENABLE_FEATURE_EDITING_ASK_TERMINAL
+ smallint unknown_width;
smallint sent_ESC_br6n;
#endif
@@ -1612,14 +1613,16 @@ static void ask_terminal(void)
* poll([{fd=0, events=POLLIN}], 1, 4294967295) = 1 ([{fd=0, revents=POLLIN}])
* read(0, "\n", 1) = 1 <-- oh crap, user's input got in first
*/
- struct pollfd pfd;
+ if (S.unknown_width) { /* only if window size is not known */
+ struct pollfd pfd;
- pfd.fd = STDIN_FILENO;
- pfd.events = POLLIN;
- if (safe_poll(&pfd, 1, 0) == 0) {
- S.sent_ESC_br6n = 1;
- fputs("\033" "[6n", stdout);
- fflush_all(); /* make terminal see it ASAP! */
+ pfd.fd = STDIN_FILENO;
+ pfd.events = POLLIN;
+ if (safe_poll(&pfd, 1, 0) == 0) {
+ S.sent_ESC_br6n = 1;
+ fputs("\033" "[6n", stdout);
+ fflush_all(); /* make terminal see it ASAP! */
+ }
}
}
#else
@@ -1765,11 +1768,13 @@ static void cmdedit_setwidth(unsigned w,
static void win_changed(int nsig)
{
+ int sv_errno = errno;
unsigned width;
- get_terminal_width_height(0, &width, NULL);
+ IF_FEATURE_EDITING_ASK_TERMINAL(S.unknown_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)

View File

@ -11,6 +11,18 @@ diff -urpN busybox-1.17.0/applets/usage_compressed busybox-1.17.0-build_system/a
- mv -- "$target.$$" "$target"
-fi
+mv -- "$target.$$" "$target"
diff -urpN busybox-1.17.0/archival/Config.src busybox-1.17.0-build_system/archival/Config.src
--- busybox-1.17.0/archival/Config.src 2010-06-25 01:32:35.000000000 +0200
+++ busybox-1.17.0-build_system/archival/Config.src 2010-07-15 09:10:03.000000000 +0200
@@ -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 -urpN busybox-1.17.0/Config.in busybox-1.17.0-build_system/Config.in
--- busybox-1.17.0/Config.in 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-build_system/Config.in 2010-07-14 08:14:26.000000000 +0200
@ -22,6 +34,18 @@ diff -urpN busybox-1.17.0/Config.in busybox-1.17.0-build_system/Config.in
config FEATURE_CHECK_UNICODE_IN_ENV
bool "Check $LANG environment variable"
diff -urpN busybox-1.17.0/e2fsprogs/Config.src busybox-1.17.0-build_system/e2fsprogs/Config.src
--- busybox-1.17.0/e2fsprogs/Config.src 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-build_system/e2fsprogs/Config.src 2010-07-18 22:55:56.000000000 +0200
@@ -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 -urpN busybox-1.17.0/init/bootchartd.c busybox-1.17.0-build_system/init/bootchartd.c
--- busybox-1.17.0/init/bootchartd.c 2010-07-04 15:32:24.000000000 +0200
+++ busybox-1.17.0-build_system/init/bootchartd.c 2010-07-10 01:31:14.000000000 +0200
@ -43,6 +67,18 @@ diff -urpN busybox-1.17.0/init/bootchartd.c busybox-1.17.0-build_system/init/boo
//config: default y
//config: depends on BOOTCHARTD
//config: help
diff -urpN busybox-1.17.0/libbb/Config.src busybox-1.17.0-build_system/libbb/Config.src
--- busybox-1.17.0/libbb/Config.src 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-build_system/libbb/Config.src 2010-07-18 22:22:54.000000000 +0200
@@ -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 -urpN busybox-1.17.0/miscutils/Config.src busybox-1.17.0-build_system/miscutils/Config.src
--- busybox-1.17.0/miscutils/Config.src 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-build_system/miscutils/Config.src 2010-07-14 08:04:35.000000000 +0200
@ -106,9 +142,21 @@ diff -urpN busybox-1.17.0/miscutils/Config.src busybox-1.17.0-build_system/miscu
help
Retrieve or set a processes's CPU affinity.
This requires sched_{g,s}etaffinity support in your libc.
diff -urpN busybox-1.17.0/networking/nc.c busybox-1.17.0-build_system/networking/nc.c
--- busybox-1.17.0/networking/nc.c 2010-07-04 15:32:24.000000000 +0200
+++ busybox-1.17.0-build_system/networking/nc.c 2010-07-18 22:55:00.000000000 +0200
@@ -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 -urpN busybox-1.17.0/scripts/gen_build_files.sh busybox-1.17.0-build_system/scripts/gen_build_files.sh
--- busybox-1.17.0/scripts/gen_build_files.sh 2010-06-26 00:42:29.000000000 +0200
+++ busybox-1.17.0-build_system/scripts/gen_build_files.sh 2010-07-10 01:31:38.000000000 +0200
+++ busybox-1.17.0-build_system/scripts/gen_build_files.sh 2010-07-18 23:58:11.000000000 +0200
@@ -4,6 +4,8 @@ test $# -ge 2 || { echo "Syntax: $0 SRCT
# cd to objtree
@ -118,7 +166,7 @@ diff -urpN busybox-1.17.0/scripts/gen_build_files.sh busybox-1.17.0-build_system
srctree="$1"
@@ -46,10 +48,12 @@ if test x"$new" != x"$old"; then
@@ -46,11 +48,13 @@ if test x"$new" != x"$old"; then
fi
# (Re)generate */Kbuild and */Config.in
@ -128,18 +176,19 @@ diff -urpN busybox-1.17.0/scripts/gen_build_files.sh busybox-1.17.0-build_system
+
src="$srctree/$d/Kbuild.src"
dst="$d/Kbuild"
+ mkdir -p -- "$d" 2>/dev/null
if test -f "$src"; then
+ mkdir -p -- "$d" 2>/dev/null
#echo " CHK $dst"
@@ -69,6 +73,7 @@ find -type d | while read -r d; do
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"
+ mkdir -p -- "$d" 2>/dev/null
if test -f "$src"; then
+ mkdir -p -- "$d" 2>/dev/null
#echo " CHK $dst"
s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
diff -urpN busybox-1.17.0/scripts/Makefile.build busybox-1.17.0-build_system/scripts/Makefile.build
--- busybox-1.17.0/scripts/Makefile.build 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-build_system/scripts/Makefile.build 2010-07-10 01:31:38.000000000 +0200

View File

@ -0,0 +1,57 @@
diff -urpN busybox-1.17.0/archival/tar.c busybox-1.17.0-cosmetics/archival/tar.c
--- busybox-1.17.0/archival/tar.c 2010-07-04 15:32:24.000000000 +0200
+++ busybox-1.17.0-cosmetics/archival/tar.c 2010-07-19 00:26:04.000000000 +0200
@@ -237,7 +237,7 @@ static int writeTarHeader(struct TarBall
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 -urpN busybox-1.17.0/coreutils/realpath.c busybox-1.17.0-cosmetics/coreutils/realpath.c
--- busybox-1.17.0/coreutils/realpath.c 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-cosmetics/coreutils/realpath.c 2010-07-19 00:26:04.000000000 +0200
@@ -23,7 +23,7 @@ int realpath_main(int argc UNUSED_PARAM,
do {
char *resolved_path = xmalloc_realpath(*argv);
- if (resolved_path != NULL) {
+ if (resolved_path != NULL) {
puts(resolved_path);
free(resolved_path);
} else {
diff -urpN busybox-1.17.0/util-linux/fdisk.c busybox-1.17.0-cosmetics/util-linux/fdisk.c
--- busybox-1.17.0/util-linux/fdisk.c 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-cosmetics/util-linux/fdisk.c 2010-07-19 00:26:04.000000000 +0200
@@ -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 -urpN busybox-1.17.0/util-linux/more.c busybox-1.17.0-cosmetics/util-linux/more.c
--- busybox-1.17.0/util-linux/more.c 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-cosmetics/util-linux/more.c 2010-07-19 00:26:04.000000000 +0200
@@ -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;

View File

@ -0,0 +1,139 @@
diff -urpN busybox-1.17.0/modutils/depmod.c busybox-1.17.0-depmod/modutils/depmod.c
--- busybox-1.17.0/modutils/depmod.c 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-depmod/modutils/depmod.c 2010-07-19 00:28:22.000000000 +0200
@@ -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
*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 *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, c
/* 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, c
}
#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, c
}
#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);

View File

@ -1,20 +1,62 @@
diff -urpN busybox-1.17.0/editors/diff.c busybox-1.17.0-diff/editors/diff.c
--- busybox-1.17.0/editors/diff.c 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-diff/editors/diff.c 2010-07-10 03:52:33.000000000 +0200
@@ -760,9 +760,11 @@ static int FAST_FUNC add_to_dirlist(cons
+++ busybox-1.17.0-diff/editors/diff.c 2010-07-19 00:27:45.000000000 +0200
@@ -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(cons
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);
+ while (*file == '/')
+ file++;
+ l->dl[l->e] = xstrdup(file);
l->e++;
return TRUE;
}
@@ -778,6 +781,25 @@ static int FAST_FUNC skip_dir(const char
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 ch
/*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 -urpN busybox-1.17.0/testsuite/diff.tests busybox-1.17.0-diff/testsuite/diff.tests
--- busybox-1.17.0/testsuite/diff.tests 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-diff/testsuite/diff.tests 2010-07-10 01:31:51.000000000 +0200

View File

@ -0,0 +1,12 @@
diff -urpN busybox-1.17.0/coreutils/dos2unix.c busybox-1.17.0-dos2unix/coreutils/dos2unix.c
--- busybox-1.17.0/coreutils/dos2unix.c 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-dos2unix/coreutils/dos2unix.c 2010-07-18 22:11:40.000000000 +0200
@@ -92,7 +92,7 @@ int dos2unix_main(int argc UNUSED_PARAM,
do {
/* might be convert(NULL) if there is no filename given */
convert(*argv, conv_type);
- } while (*++argv);
+ } while (*argv && *++argv);
return 0;
}

View File

@ -0,0 +1,18 @@
diff -urpN busybox-1.17.0/procps/top.c busybox-1.17.0-top/procps/top.c
--- busybox-1.17.0/procps/top.c 2010-06-24 04:40:43.000000000 +0200
+++ busybox-1.17.0-top/procps/top.c 2010-07-19 00:27:04.000000000 +0200
@@ -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);