randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-06-19 18:15:33 +02:00
parent ce824aecf2
commit 015db5800c
11 changed files with 80 additions and 46 deletions

View File

@ -60,13 +60,21 @@ static unsigned long long getOctal(char *str, int len)
} }
#define GET_OCTAL(a) getOctal((a), sizeof(a)) #define GET_OCTAL(a) getOctal((a), sizeof(a))
#define TAR_EXTD (ENABLE_FEATURE_TAR_GNU_EXTENSIONS || ENABLE_FEATURE_TAR_SELINUX)
#if !TAR_EXTD
#define process_pax_hdr(archive_handle, sz, global) \
process_pax_hdr(archive_handle, sz)
#endif
/* "global" is 0 or 1 */ /* "global" is 0 or 1 */
static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global) static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global)
{ {
#if !TAR_EXTD
unsigned blk_sz = (sz + 511) & (~511);
seek_by_read(archive_handle->src_fd, blk_sz);
#else
unsigned blk_sz = (sz + 511) & (~511);
char *buf, *p; char *buf, *p;
unsigned blk_sz;
blk_sz = (sz + 511) & (~511);
p = buf = xmalloc(blk_sz + 1); p = buf = xmalloc(blk_sz + 1);
xread(archive_handle->src_fd, buf, blk_sz); xread(archive_handle->src_fd, buf, blk_sz);
archive_handle->offset += blk_sz; archive_handle->offset += blk_sz;
@ -104,30 +112,31 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g
p[-1] = '\0'; p[-1] = '\0';
value = end + 1; value = end + 1;
#if ENABLE_FEATURE_TAR_GNU_EXTENSIONS # if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
if (!global && is_prefixed_with(value, "path=")) { if (!global && is_prefixed_with(value, "path=")) {
value += sizeof("path=") - 1; value += sizeof("path=") - 1;
free(archive_handle->tar__longname); free(archive_handle->tar__longname);
archive_handle->tar__longname = xstrdup(value); archive_handle->tar__longname = xstrdup(value);
continue; continue;
} }
#endif # endif
#if ENABLE_FEATURE_TAR_SELINUX # if ENABLE_FEATURE_TAR_SELINUX
/* Scan for SELinux contexts, via "RHT.security.selinux" keyword. /* Scan for SELinux contexts, via "RHT.security.selinux" keyword.
* This is what Red Hat's patched version of tar uses. * This is what Red Hat's patched version of tar uses.
*/ */
# define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux" # define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux"
if (is_prefixed_with(value, SELINUX_CONTEXT_KEYWORD"=")) { if (is_prefixed_with(value, SELINUX_CONTEXT_KEYWORD"=")) {
value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1; value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1;
free(archive_handle->tar__sctx[global]); free(archive_handle->tar__sctx[global]);
archive_handle->tar__sctx[global] = xstrdup(value); archive_handle->tar__sctx[global] = xstrdup(value);
continue; continue;
} }
#endif # endif
} }
free(buf); free(buf);
#endif
} }
char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)

View File

@ -1199,9 +1199,10 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
// /* We need to know whether child (gzip/bzip/etc) exits abnormally */ // /* We need to know whether child (gzip/bzip/etc) exits abnormally */
// signal(SIGCHLD, check_errors_in_children); // signal(SIGCHLD, check_errors_in_children);
#if ENABLE_FEATURE_TAR_CREATE
/* Create an archive */ /* Create an archive */
if (opt & OPT_CREATE) { if (opt & OPT_CREATE) {
#if SEAMLESS_COMPRESSION # if SEAMLESS_COMPRESSION
const char *zipMode = NULL; const char *zipMode = NULL;
if (opt & OPT_COMPRESS) if (opt & OPT_COMPRESS)
zipMode = "compress"; zipMode = "compress";
@ -1213,7 +1214,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
zipMode = "lzma"; zipMode = "lzma";
if (opt & OPT_XZ) if (opt & OPT_XZ)
zipMode = "xz"; zipMode = "xz";
#endif # endif
/* NB: writeTarFile() closes tar_handle->src_fd */ /* NB: writeTarFile() closes tar_handle->src_fd */
return writeTarFile(tar_handle->src_fd, verboseFlag, return writeTarFile(tar_handle->src_fd, verboseFlag,
(opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0) (opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0)
@ -1221,6 +1222,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
tar_handle->accept, tar_handle->accept,
tar_handle->reject, zipMode); tar_handle->reject, zipMode);
} }
#endif
if (opt & OPT_ANY_COMPRESS) { if (opt & OPT_ANY_COMPRESS) {
USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate);) USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate);)

View File

@ -25,8 +25,13 @@ lib-$(CONFIG_FLASH_UNLOCK) += flash_lock_unlock.o
lib-$(CONFIG_IONICE) += ionice.o lib-$(CONFIG_IONICE) += ionice.o
lib-$(CONFIG_HDPARM) += hdparm.o lib-$(CONFIG_HDPARM) += hdparm.o
lib-$(CONFIG_INOTIFYD) += inotifyd.o lib-$(CONFIG_INOTIFYD) += inotifyd.o
lib-$(CONFIG_FEATURE_LAST_SMALL)+= last.o
lib-$(CONFIG_FEATURE_LAST_FANCY)+= last_fancy.o ifeq ($(CONFIG_FEATURE_LAST_FANCY),y)
lib-$(CONFIG_FEATURE_LAST_FANCY) += last_fancy.o
else
lib-$(CONFIG_LAST) += last.o
endif
lib-$(CONFIG_LESS) += less.o lib-$(CONFIG_LESS) += less.o
lib-$(CONFIG_MAKEDEVS) += makedevs.o lib-$(CONFIG_MAKEDEVS) += makedevs.o
lib-$(CONFIG_MAN) += man.o lib-$(CONFIG_MAN) += man.o

View File

@ -21,7 +21,6 @@
extern int init_module(void *module, unsigned long len, const char *options); extern int init_module(void *module, unsigned long len, const char *options);
extern int delete_module(const char *module, unsigned flags); extern int delete_module(const char *module, unsigned flags);
extern int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
/* linux/include/linux/module.h has limit of 64 chars on module names */ /* linux/include/linux/module.h has limit of 64 chars on module names */
#undef MODULE_NAME_LEN #undef MODULE_NAME_LEN
#define MODULE_NAME_LEN 64 #define MODULE_NAME_LEN 64

View File

@ -32,14 +32,7 @@
struct kconf_id; struct kconf_id;
/* maximum key range = 45, duplicates = 0 */ /* maximum key range = 45, duplicates = 0 */
#ifdef __GNUC__ unsigned int
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
kconf_id_hash (register const char *str, register unsigned int len) kconf_id_hash (register const char *str, register unsigned int len)
{ {
static unsigned char asso_values[] = static unsigned char asso_values[] =
@ -119,7 +112,7 @@ struct kconf_id_strings_t
char kconf_id_strings_str41[sizeof("choice")]; char kconf_id_strings_str41[sizeof("choice")];
char kconf_id_strings_str46[sizeof("prompt")]; char kconf_id_strings_str46[sizeof("prompt")];
}; };
static struct kconf_id_strings_t kconf_id_strings_contents = struct kconf_id_strings_t kconf_id_strings_contents =
{ {
"if", "if",
"int", "int",
@ -153,9 +146,6 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
"prompt" "prompt"
}; };
#define kconf_id_strings ((const char *) &kconf_id_strings_contents) #define kconf_id_strings ((const char *) &kconf_id_strings_contents)
#ifdef __GNUC__
__inline
#endif
struct kconf_id * struct kconf_id *
kconf_id_lookup (register const char *str, register unsigned int len) kconf_id_lookup (register const char *str, register unsigned int len)
{ {

View File

@ -52,9 +52,18 @@ echo '# CONFIG_RFKILL is not set' >>.config
if test x"$LIBC" = x"glibc"; then if test x"$LIBC" = x"glibc"; then
cat .config \ cat .config \
| grep -v CONFIG_STATIC \ | grep -v CONFIG_STATIC \
\
| grep -v CONFIG_FEATURE_2_4_MODULES \
| grep -v CONFIG_FEATURE_USE_BSS_TAIL \
| grep -v CONFIG_DEBUG_SANITIZE \
>.config.new >.config.new
mv .config.new .config mv .config.new .config
echo '# CONFIG_STATIC is not set' >>.config echo '# CONFIG_STATIC is not set' >>.config
# newer glibc (at least 2.23) no longer supply query_module() ABI.
# People who target 2.4 kernels would likely use older glibc (and older bbox).
echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
echo '# CONFIG_FEATURE_USE_BSS_TAIL is not set' >>.config
echo '# CONFIG_DEBUG_SANITIZE is not set' >>.config
fi fi
# If uclibc, build static, and remove some things # If uclibc, build static, and remove some things
@ -68,6 +77,11 @@ if test x"$LIBC" = x"uclibc"; then
| grep -v CONFIG_FEATURE_2_4_MODULES \ | grep -v CONFIG_FEATURE_2_4_MODULES \
| grep -v CONFIG_FEATURE_SYNC_FANCY \ | grep -v CONFIG_FEATURE_SYNC_FANCY \
| grep -v CONFIG_FEATURE_TOUCH_NODEREF \ | grep -v CONFIG_FEATURE_TOUCH_NODEREF \
| grep -v CONFIG_NANDWRITE \
| grep -v CONFIG_NANDDUMP \
| grep -v CONFIG_BLKDISCARD \
| grep -v CONFIG_NSENTER \
| grep -v CONFIG_UNSHARE \
>.config.new >.config.new
mv .config.new .config mv .config.new .config
echo 'CONFIG_STATIC=y' >>.config echo 'CONFIG_STATIC=y' >>.config
@ -76,6 +90,12 @@ if test x"$LIBC" = x"uclibc"; then
echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
echo '# CONFIG_FEATURE_SYNC_FANCY is not set' >>.config echo '# CONFIG_FEATURE_SYNC_FANCY is not set' >>.config
echo '# CONFIG_FEATURE_TOUCH_NODEREF is not set' >>.config echo '# CONFIG_FEATURE_TOUCH_NODEREF is not set' >>.config
# My uclibc installation does not support some needed APIs...
echo '# CONFIG_NANDWRITE is not set' >>.config
echo '# CONFIG_NANDDUMP is not set' >>.config
echo '# CONFIG_BLKDISCARD is not set' >>.config
echo '# CONFIG_NSENTER is not set' >>.config
echo '# CONFIG_UNSHARE is not set' >>.config
fi fi
# If STATIC, remove some things. # If STATIC, remove some things.

View File

@ -6,6 +6,16 @@
. ./testing.sh . ./testing.sh
ln -s `which busybox` unknown
testing "busybox as unknown name" "./unknown 2>&1" \
"unknown: applet not found\n" "" ""
rm unknown
# We need busybox --help to be enabled for the rest of tests
test x"$CONFIG_BUSYBOX" = x"y" \
|| { echo "SKIPPED: busybox --help"; exit 0; }
HELPDUMP=`true | busybox 2>&1 | cat` HELPDUMP=`true | busybox 2>&1 | cat`
# We need to test under calling the binary under other names. # We need to test under calling the binary under other names.
@ -38,10 +48,4 @@ do
done done
rm busybox-suffix rm busybox-suffix
ln -s `which busybox` unknown
testing "busybox as unknown name" "./unknown 2>&1" \
"unknown: applet not found\n" "" ""
rm unknown
exit $FAILCOUNT exit $FAILCOUNT

View File

@ -1,4 +1,4 @@
# FEATURE: CONFIG_FEATURE_HUMAN_READABLE # FEATURE: CONFIG_FEATURE_HUMAN_READABLE
dd if=/dev/zero of=file bs=1M count=1 2>/dev/null dd if=/dev/zero of=file bs=1M count=1 2>/dev/null
test x"`busybox du -m .`" = x"1 ." test x"`busybox du -m file`" = x"1 ."

View File

@ -164,6 +164,7 @@ static const struct cmdoptions_t {
const unsigned char code; const unsigned char code;
} g_cmdoptions[] = { } g_cmdoptions[] = {
/*"12345678" + NUL */ /*"12345678" + NUL */
//TODO: convert to index_in_strings()
{ "fb" , 1, CMD_FB }, { "fb" , 1, CMD_FB },
{ "db" , 1, CMD_DB }, { "db" , 1, CMD_DB },
{ "a" , 0, CMD_ALL }, { "a" , 0, CMD_ALL },
@ -416,7 +417,7 @@ int fbset_main(int argc, char **argv)
unsigned options = 0; unsigned options = 0;
const char *fbdev = DEFAULTFBDEV; const char *fbdev = DEFAULTFBDEV;
const char *modefile = DEFAULTFBMODE; IF_FEATURE_FBSET_READMODE(const char *modefile = DEFAULTFBMODE;)
char *thisarg; char *thisarg;
char *mode = mode; /* for compiler */ char *mode = mode; /* for compiler */
@ -444,7 +445,7 @@ int fbset_main(int argc, char **argv)
fbdev = argv[1]; fbdev = argv[1];
break; break;
case CMD_DB: case CMD_DB:
modefile = argv[1]; IF_FEATURE_FBSET_READMODE(modefile = argv[1];)
break; break;
case CMD_ALL: case CMD_ALL:
options |= OPT_ALL; options |= OPT_ALL;

View File

@ -366,10 +366,11 @@ bsd_select(void)
} }
printf("Reading disklabel of %s at sector %u\n", printf("Reading disklabel of %s at sector %u\n",
partname(disk_device, t+1, 0), ss + BSD_LABELSECTOR); partname(disk_device, t+1, 0), ss + BSD_LABELSECTOR);
if (xbsd_readlabel(xbsd_part) == 0) if (xbsd_readlabel(xbsd_part) == 0) {
if (xbsd_create_disklabel() == 0) if (xbsd_create_disklabel() == 0)
return; return;
break; break;
}
} }
} }

View File

@ -504,17 +504,19 @@ verify_sgi(int verbose)
if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) { if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) {
if ((Index[0] != 10) && verbose) if ((Index[0] != 10) && verbose)
printf("IRIX likes when Partition 11 covers the entire disk\n"); printf("IRIX likes when Partition 11 covers the entire disk\n");
if ((sgi_get_start_sector(Index[0]) != 0) && verbose) if ((sgi_get_start_sector(Index[0]) != 0) && verbose) {
printf("The entire disk partition should start " printf("The entire disk partition should start "
"at block 0,\n" "at block 0,\n"
"not at diskblock %u\n", "not at diskblock %u\n",
sgi_get_start_sector(Index[0])); sgi_get_start_sector(Index[0]));
if (SGI_DEBUG) /* I do not understand how some disks fulfil it */ }
if (SGI_DEBUG) { /* I do not understand how some disks fulfil it */
if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose) if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose)
printf("The entire disk partition is only %u diskblock large,\n" printf("The entire disk partition is only %u diskblock large,\n"
"but the disk is %u diskblocks long\n", "but the disk is %u diskblocks long\n",
sgi_get_num_sectors(Index[0]), lastblock); sgi_get_num_sectors(Index[0]), lastblock);
lastblock = sgi_get_num_sectors(Index[0]); lastblock = sgi_get_num_sectors(Index[0]);
}
} else { } else {
if (verbose) if (verbose)
printf("One Partition (#11) should cover the entire disk\n"); printf("One Partition (#11) should cover the entire disk\n");
@ -669,16 +671,17 @@ sgi_set_volhdr(void)
int n; int n;
for (n = 8; n < g_partitions; n++) { for (n = 8; n < g_partitions; n++) {
if (!sgi_get_num_sectors(n)) { if (!sgi_get_num_sectors(n)) {
/* /*
* 5 cylinders is an arbitrary value I like * 5 cylinders is an arbitrary value I like
* IRIX 5.3 stored files in the volume header * IRIX 5.3 stored files in the volume header
* (like sash, symmon, fx, ide) with ca. 3200 * (like sash, symmon, fx, ide) with ca. 3200
* sectors. * sectors.
*/ */
if (g_heads * g_sectors * 5 < sgi_get_lastblock()) if (g_heads * g_sectors * 5 < sgi_get_lastblock()) {
sgi_set_partition(n, 0, g_heads * g_sectors * 5, SGI_VOLHDR); sgi_set_partition(n, 0, g_heads * g_sectors * 5, SGI_VOLHDR);
break; break;
}
} }
} }
} }