aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-06-19 18:15:33 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-06-19 18:15:33 +0200
commit015db5800ca7c6dd2d201eacb2951e72e6782b30 (patch)
tree0fe9b90c782f2ac831f30793e384b07bd690b3b3
parentce824aecf216536beed00d7817a614ffb8572239 (diff)
downloadbusybox-w32-015db5800ca7c6dd2d201eacb2951e72e6782b30.tar.gz
busybox-w32-015db5800ca7c6dd2d201eacb2951e72e6782b30.tar.bz2
busybox-w32-015db5800ca7c6dd2d201eacb2951e72e6782b30.zip
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/libarchive/get_header_tar.c23
-rw-r--r--archival/tar.c6
-rw-r--r--miscutils/Kbuild.src9
-rw-r--r--modutils/modprobe-small.c1
-rw-r--r--scripts/kconfig/zconf.hash.c_shipped14
-rwxr-xr-xscripts/randomtest20
-rwxr-xr-xtestsuite/busybox.tests16
-rw-r--r--testsuite/du/du-m-works2
-rw-r--r--util-linux/fbset.c5
-rw-r--r--util-linux/fdisk_osf.c3
-rw-r--r--util-linux/fdisk_sgi.c27
11 files changed, 80 insertions, 46 deletions
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c
index ac2be726f..ea91a883e 100644
--- a/archival/libarchive/get_header_tar.c
+++ b/archival/libarchive/get_header_tar.c
@@ -60,13 +60,21 @@ static unsigned long long getOctal(char *str, int len)
60} 60}
61#define GET_OCTAL(a) getOctal((a), sizeof(a)) 61#define GET_OCTAL(a) getOctal((a), sizeof(a))
62 62
63#define TAR_EXTD (ENABLE_FEATURE_TAR_GNU_EXTENSIONS || ENABLE_FEATURE_TAR_SELINUX)
64#if !TAR_EXTD
65#define process_pax_hdr(archive_handle, sz, global) \
66 process_pax_hdr(archive_handle, sz)
67#endif
63/* "global" is 0 or 1 */ 68/* "global" is 0 or 1 */
64static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global) 69static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global)
65{ 70{
71#if !TAR_EXTD
72 unsigned blk_sz = (sz + 511) & (~511);
73 seek_by_read(archive_handle->src_fd, blk_sz);
74#else
75 unsigned blk_sz = (sz + 511) & (~511);
66 char *buf, *p; 76 char *buf, *p;
67 unsigned blk_sz;
68 77
69 blk_sz = (sz + 511) & (~511);
70 p = buf = xmalloc(blk_sz + 1); 78 p = buf = xmalloc(blk_sz + 1);
71 xread(archive_handle->src_fd, buf, blk_sz); 79 xread(archive_handle->src_fd, buf, blk_sz);
72 archive_handle->offset += blk_sz; 80 archive_handle->offset += blk_sz;
@@ -104,30 +112,31 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g
104 p[-1] = '\0'; 112 p[-1] = '\0';
105 value = end + 1; 113 value = end + 1;
106 114
107#if ENABLE_FEATURE_TAR_GNU_EXTENSIONS 115# if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
108 if (!global && is_prefixed_with(value, "path=")) { 116 if (!global && is_prefixed_with(value, "path=")) {
109 value += sizeof("path=") - 1; 117 value += sizeof("path=") - 1;
110 free(archive_handle->tar__longname); 118 free(archive_handle->tar__longname);
111 archive_handle->tar__longname = xstrdup(value); 119 archive_handle->tar__longname = xstrdup(value);
112 continue; 120 continue;
113 } 121 }
114#endif 122# endif
115 123
116#if ENABLE_FEATURE_TAR_SELINUX 124# if ENABLE_FEATURE_TAR_SELINUX
117 /* Scan for SELinux contexts, via "RHT.security.selinux" keyword. 125 /* Scan for SELinux contexts, via "RHT.security.selinux" keyword.
118 * This is what Red Hat's patched version of tar uses. 126 * This is what Red Hat's patched version of tar uses.
119 */ 127 */
120# define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux" 128# define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux"
121 if (is_prefixed_with(value, SELINUX_CONTEXT_KEYWORD"=")) { 129 if (is_prefixed_with(value, SELINUX_CONTEXT_KEYWORD"=")) {
122 value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1; 130 value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1;
123 free(archive_handle->tar__sctx[global]); 131 free(archive_handle->tar__sctx[global]);
124 archive_handle->tar__sctx[global] = xstrdup(value); 132 archive_handle->tar__sctx[global] = xstrdup(value);
125 continue; 133 continue;
126 } 134 }
127#endif 135# endif
128 } 136 }
129 137
130 free(buf); 138 free(buf);
139#endif
131} 140}
132 141
133char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) 142char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
diff --git a/archival/tar.c b/archival/tar.c
index 346a9404e..7434e22e4 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -1199,9 +1199,10 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1199 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */ 1199 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */
1200 // signal(SIGCHLD, check_errors_in_children); 1200 // signal(SIGCHLD, check_errors_in_children);
1201 1201
1202#if ENABLE_FEATURE_TAR_CREATE
1202 /* Create an archive */ 1203 /* Create an archive */
1203 if (opt & OPT_CREATE) { 1204 if (opt & OPT_CREATE) {
1204#if SEAMLESS_COMPRESSION 1205# if SEAMLESS_COMPRESSION
1205 const char *zipMode = NULL; 1206 const char *zipMode = NULL;
1206 if (opt & OPT_COMPRESS) 1207 if (opt & OPT_COMPRESS)
1207 zipMode = "compress"; 1208 zipMode = "compress";
@@ -1213,7 +1214,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1213 zipMode = "lzma"; 1214 zipMode = "lzma";
1214 if (opt & OPT_XZ) 1215 if (opt & OPT_XZ)
1215 zipMode = "xz"; 1216 zipMode = "xz";
1216#endif 1217# endif
1217 /* NB: writeTarFile() closes tar_handle->src_fd */ 1218 /* NB: writeTarFile() closes tar_handle->src_fd */
1218 return writeTarFile(tar_handle->src_fd, verboseFlag, 1219 return writeTarFile(tar_handle->src_fd, verboseFlag,
1219 (opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0) 1220 (opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0)
@@ -1221,6 +1222,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1221 tar_handle->accept, 1222 tar_handle->accept,
1222 tar_handle->reject, zipMode); 1223 tar_handle->reject, zipMode);
1223 } 1224 }
1225#endif
1224 1226
1225 if (opt & OPT_ANY_COMPRESS) { 1227 if (opt & OPT_ANY_COMPRESS) {
1226 USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate);) 1228 USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate);)
diff --git a/miscutils/Kbuild.src b/miscutils/Kbuild.src
index 7b449e6e8..503f54904 100644
--- a/miscutils/Kbuild.src
+++ b/miscutils/Kbuild.src
@@ -25,8 +25,13 @@ lib-$(CONFIG_FLASH_UNLOCK) += flash_lock_unlock.o
25lib-$(CONFIG_IONICE) += ionice.o 25lib-$(CONFIG_IONICE) += ionice.o
26lib-$(CONFIG_HDPARM) += hdparm.o 26lib-$(CONFIG_HDPARM) += hdparm.o
27lib-$(CONFIG_INOTIFYD) += inotifyd.o 27lib-$(CONFIG_INOTIFYD) += inotifyd.o
28lib-$(CONFIG_FEATURE_LAST_SMALL)+= last.o 28
29lib-$(CONFIG_FEATURE_LAST_FANCY)+= last_fancy.o 29ifeq ($(CONFIG_FEATURE_LAST_FANCY),y)
30lib-$(CONFIG_FEATURE_LAST_FANCY) += last_fancy.o
31else
32lib-$(CONFIG_LAST) += last.o
33endif
34
30lib-$(CONFIG_LESS) += less.o 35lib-$(CONFIG_LESS) += less.o
31lib-$(CONFIG_MAKEDEVS) += makedevs.o 36lib-$(CONFIG_MAKEDEVS) += makedevs.o
32lib-$(CONFIG_MAN) += man.o 37lib-$(CONFIG_MAN) += man.o
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 9c941064b..ffb46e6be 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -21,7 +21,6 @@
21 21
22extern int init_module(void *module, unsigned long len, const char *options); 22extern int init_module(void *module, unsigned long len, const char *options);
23extern int delete_module(const char *module, unsigned flags); 23extern int delete_module(const char *module, unsigned flags);
24extern int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
25/* linux/include/linux/module.h has limit of 64 chars on module names */ 24/* linux/include/linux/module.h has limit of 64 chars on module names */
26#undef MODULE_NAME_LEN 25#undef MODULE_NAME_LEN
27#define MODULE_NAME_LEN 64 26#define MODULE_NAME_LEN 64
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped
index d39cf189a..29d9cf6cc 100644
--- a/scripts/kconfig/zconf.hash.c_shipped
+++ b/scripts/kconfig/zconf.hash.c_shipped
@@ -32,14 +32,7 @@
32struct kconf_id; 32struct kconf_id;
33/* maximum key range = 45, duplicates = 0 */ 33/* maximum key range = 45, duplicates = 0 */
34 34
35#ifdef __GNUC__ 35unsigned int
36__inline
37#else
38#ifdef __cplusplus
39inline
40#endif
41#endif
42static unsigned int
43kconf_id_hash (register const char *str, register unsigned int len) 36kconf_id_hash (register const char *str, register unsigned int len)
44{ 37{
45 static unsigned char asso_values[] = 38 static unsigned char asso_values[] =
@@ -119,7 +112,7 @@ struct kconf_id_strings_t
119 char kconf_id_strings_str41[sizeof("choice")]; 112 char kconf_id_strings_str41[sizeof("choice")];
120 char kconf_id_strings_str46[sizeof("prompt")]; 113 char kconf_id_strings_str46[sizeof("prompt")];
121 }; 114 };
122static struct kconf_id_strings_t kconf_id_strings_contents = 115struct kconf_id_strings_t kconf_id_strings_contents =
123 { 116 {
124 "if", 117 "if",
125 "int", 118 "int",
@@ -153,9 +146,6 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
153 "prompt" 146 "prompt"
154 }; 147 };
155#define kconf_id_strings ((const char *) &kconf_id_strings_contents) 148#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
156#ifdef __GNUC__
157__inline
158#endif
159struct kconf_id * 149struct kconf_id *
160kconf_id_lookup (register const char *str, register unsigned int len) 150kconf_id_lookup (register const char *str, register unsigned int len)
161{ 151{
diff --git a/scripts/randomtest b/scripts/randomtest
index e2513d058..41f252ad7 100755
--- a/scripts/randomtest
+++ b/scripts/randomtest
@@ -52,9 +52,18 @@ echo '# CONFIG_RFKILL is not set' >>.config
52if test x"$LIBC" = x"glibc"; then 52if test x"$LIBC" = x"glibc"; then
53 cat .config \ 53 cat .config \
54 | grep -v CONFIG_STATIC \ 54 | grep -v CONFIG_STATIC \
55 \
56 | grep -v CONFIG_FEATURE_2_4_MODULES \
57 | grep -v CONFIG_FEATURE_USE_BSS_TAIL \
58 | grep -v CONFIG_DEBUG_SANITIZE \
55 >.config.new 59 >.config.new
56 mv .config.new .config 60 mv .config.new .config
57 echo '# CONFIG_STATIC is not set' >>.config 61 echo '# CONFIG_STATIC is not set' >>.config
62 # newer glibc (at least 2.23) no longer supply query_module() ABI.
63 # People who target 2.4 kernels would likely use older glibc (and older bbox).
64 echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
65 echo '# CONFIG_FEATURE_USE_BSS_TAIL is not set' >>.config
66 echo '# CONFIG_DEBUG_SANITIZE is not set' >>.config
58fi 67fi
59 68
60# If uclibc, build static, and remove some things 69# If uclibc, build static, and remove some things
@@ -68,6 +77,11 @@ if test x"$LIBC" = x"uclibc"; then
68 | grep -v CONFIG_FEATURE_2_4_MODULES \ 77 | grep -v CONFIG_FEATURE_2_4_MODULES \
69 | grep -v CONFIG_FEATURE_SYNC_FANCY \ 78 | grep -v CONFIG_FEATURE_SYNC_FANCY \
70 | grep -v CONFIG_FEATURE_TOUCH_NODEREF \ 79 | grep -v CONFIG_FEATURE_TOUCH_NODEREF \
80 | grep -v CONFIG_NANDWRITE \
81 | grep -v CONFIG_NANDDUMP \
82 | grep -v CONFIG_BLKDISCARD \
83 | grep -v CONFIG_NSENTER \
84 | grep -v CONFIG_UNSHARE \
71 >.config.new 85 >.config.new
72 mv .config.new .config 86 mv .config.new .config
73 echo 'CONFIG_STATIC=y' >>.config 87 echo 'CONFIG_STATIC=y' >>.config
@@ -76,6 +90,12 @@ if test x"$LIBC" = x"uclibc"; then
76 echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config 90 echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
77 echo '# CONFIG_FEATURE_SYNC_FANCY is not set' >>.config 91 echo '# CONFIG_FEATURE_SYNC_FANCY is not set' >>.config
78 echo '# CONFIG_FEATURE_TOUCH_NODEREF is not set' >>.config 92 echo '# CONFIG_FEATURE_TOUCH_NODEREF is not set' >>.config
93 # My uclibc installation does not support some needed APIs...
94 echo '# CONFIG_NANDWRITE is not set' >>.config
95 echo '# CONFIG_NANDDUMP is not set' >>.config
96 echo '# CONFIG_BLKDISCARD is not set' >>.config
97 echo '# CONFIG_NSENTER is not set' >>.config
98 echo '# CONFIG_UNSHARE is not set' >>.config
79fi 99fi
80 100
81# If STATIC, remove some things. 101# If STATIC, remove some things.
diff --git a/testsuite/busybox.tests b/testsuite/busybox.tests
index 04fea3ea2..545cad5c0 100755
--- a/testsuite/busybox.tests
+++ b/testsuite/busybox.tests
@@ -6,6 +6,16 @@
6 6
7. ./testing.sh 7. ./testing.sh
8 8
9ln -s `which busybox` unknown
10
11testing "busybox as unknown name" "./unknown 2>&1" \
12 "unknown: applet not found\n" "" ""
13rm unknown
14
15# We need busybox --help to be enabled for the rest of tests
16test x"$CONFIG_BUSYBOX" = x"y" \
17|| { echo "SKIPPED: busybox --help"; exit 0; }
18
9HELPDUMP=`true | busybox 2>&1 | cat` 19HELPDUMP=`true | busybox 2>&1 | cat`
10 20
11# We need to test under calling the binary under other names. 21# We need to test under calling the binary under other names.
@@ -38,10 +48,4 @@ do
38done 48done
39rm busybox-suffix 49rm busybox-suffix
40 50
41ln -s `which busybox` unknown
42
43testing "busybox as unknown name" "./unknown 2>&1" \
44 "unknown: applet not found\n" "" ""
45rm unknown
46
47exit $FAILCOUNT 51exit $FAILCOUNT
diff --git a/testsuite/du/du-m-works b/testsuite/du/du-m-works
index 9fa7437ac..c96c3b359 100644
--- a/testsuite/du/du-m-works
+++ b/testsuite/du/du-m-works
@@ -1,4 +1,4 @@
1# FEATURE: CONFIG_FEATURE_HUMAN_READABLE 1# FEATURE: CONFIG_FEATURE_HUMAN_READABLE
2 2
3dd if=/dev/zero of=file bs=1M count=1 2>/dev/null 3dd if=/dev/zero of=file bs=1M count=1 2>/dev/null
4test x"`busybox du -m .`" = x"1 ." 4test x"`busybox du -m file`" = x"1 ."
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 09e96b763..b75ec1921 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -164,6 +164,7 @@ static const struct cmdoptions_t {
164 const unsigned char code; 164 const unsigned char code;
165} g_cmdoptions[] = { 165} g_cmdoptions[] = {
166 /*"12345678" + NUL */ 166 /*"12345678" + NUL */
167//TODO: convert to index_in_strings()
167 { "fb" , 1, CMD_FB }, 168 { "fb" , 1, CMD_FB },
168 { "db" , 1, CMD_DB }, 169 { "db" , 1, CMD_DB },
169 { "a" , 0, CMD_ALL }, 170 { "a" , 0, CMD_ALL },
@@ -416,7 +417,7 @@ int fbset_main(int argc, char **argv)
416 unsigned options = 0; 417 unsigned options = 0;
417 418
418 const char *fbdev = DEFAULTFBDEV; 419 const char *fbdev = DEFAULTFBDEV;
419 const char *modefile = DEFAULTFBMODE; 420 IF_FEATURE_FBSET_READMODE(const char *modefile = DEFAULTFBMODE;)
420 char *thisarg; 421 char *thisarg;
421 char *mode = mode; /* for compiler */ 422 char *mode = mode; /* for compiler */
422 423
@@ -444,7 +445,7 @@ int fbset_main(int argc, char **argv)
444 fbdev = argv[1]; 445 fbdev = argv[1];
445 break; 446 break;
446 case CMD_DB: 447 case CMD_DB:
447 modefile = argv[1]; 448 IF_FEATURE_FBSET_READMODE(modefile = argv[1];)
448 break; 449 break;
449 case CMD_ALL: 450 case CMD_ALL:
450 options |= OPT_ALL; 451 options |= OPT_ALL;
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c
index af04cfcc8..89f1f323c 100644
--- a/util-linux/fdisk_osf.c
+++ b/util-linux/fdisk_osf.c
@@ -366,10 +366,11 @@ bsd_select(void)
366 } 366 }
367 printf("Reading disklabel of %s at sector %u\n", 367 printf("Reading disklabel of %s at sector %u\n",
368 partname(disk_device, t+1, 0), ss + BSD_LABELSECTOR); 368 partname(disk_device, t+1, 0), ss + BSD_LABELSECTOR);
369 if (xbsd_readlabel(xbsd_part) == 0) 369 if (xbsd_readlabel(xbsd_part) == 0) {
370 if (xbsd_create_disklabel() == 0) 370 if (xbsd_create_disklabel() == 0)
371 return; 371 return;
372 break; 372 break;
373 }
373 } 374 }
374 } 375 }
375 376
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c
index 23ebc56ef..30def09c6 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -504,17 +504,19 @@ verify_sgi(int verbose)
504 if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) { 504 if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) {
505 if ((Index[0] != 10) && verbose) 505 if ((Index[0] != 10) && verbose)
506 printf("IRIX likes when Partition 11 covers the entire disk\n"); 506 printf("IRIX likes when Partition 11 covers the entire disk\n");
507 if ((sgi_get_start_sector(Index[0]) != 0) && verbose) 507 if ((sgi_get_start_sector(Index[0]) != 0) && verbose) {
508 printf("The entire disk partition should start " 508 printf("The entire disk partition should start "
509 "at block 0,\n" 509 "at block 0,\n"
510 "not at diskblock %u\n", 510 "not at diskblock %u\n",
511 sgi_get_start_sector(Index[0])); 511 sgi_get_start_sector(Index[0]));
512 if (SGI_DEBUG) /* I do not understand how some disks fulfil it */ 512 }
513 if (SGI_DEBUG) { /* I do not understand how some disks fulfil it */
513 if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose) 514 if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose)
514 printf("The entire disk partition is only %u diskblock large,\n" 515 printf("The entire disk partition is only %u diskblock large,\n"
515 "but the disk is %u diskblocks long\n", 516 "but the disk is %u diskblocks long\n",
516 sgi_get_num_sectors(Index[0]), lastblock); 517 sgi_get_num_sectors(Index[0]), lastblock);
517 lastblock = sgi_get_num_sectors(Index[0]); 518 lastblock = sgi_get_num_sectors(Index[0]);
519 }
518 } else { 520 } else {
519 if (verbose) 521 if (verbose)
520 printf("One Partition (#11) should cover the entire disk\n"); 522 printf("One Partition (#11) should cover the entire disk\n");
@@ -669,16 +671,17 @@ sgi_set_volhdr(void)
669 int n; 671 int n;
670 672
671 for (n = 8; n < g_partitions; n++) { 673 for (n = 8; n < g_partitions; n++) {
672 if (!sgi_get_num_sectors(n)) { 674 if (!sgi_get_num_sectors(n)) {
673 /* 675 /*
674 * 5 cylinders is an arbitrary value I like 676 * 5 cylinders is an arbitrary value I like
675 * IRIX 5.3 stored files in the volume header 677 * IRIX 5.3 stored files in the volume header
676 * (like sash, symmon, fx, ide) with ca. 3200 678 * (like sash, symmon, fx, ide) with ca. 3200
677 * sectors. 679 * sectors.
678 */ 680 */
679 if (g_heads * g_sectors * 5 < sgi_get_lastblock()) 681 if (g_heads * g_sectors * 5 < sgi_get_lastblock()) {
680 sgi_set_partition(n, 0, g_heads * g_sectors * 5, SGI_VOLHDR); 682 sgi_set_partition(n, 0, g_heads * g_sectors * 5, SGI_VOLHDR);
681 break; 683 break;
684 }
682 } 685 }
683 } 686 }
684} 687}