[0e9e889] | 1 | Submitted By: Jim Gifford (jim at cross-lfs dot org)
|
---|
[7791a76] | 2 | Date: 02-16-2009
|
---|
[0e9e889] | 3 | Initial Package Version: 1.13.2
|
---|
| 4 | Origin: Upstream
|
---|
| 5 | Upstream Status: Applied
|
---|
| 6 | Description: This is a branch update for busybox-1.13.2, and should be
|
---|
| 7 | rechecked periodically.
|
---|
| 8 |
|
---|
| 9 | diff -Naur busybox-1.13.2.orig/archival/tar.c busybox-1.13.2/archival/tar.c
|
---|
| 10 | --- busybox-1.13.2.orig/archival/tar.c 2008-11-09 09:28:02.000000000 -0800
|
---|
[7791a76] | 11 | +++ busybox-1.13.2/archival/tar.c 2009-02-16 11:36:01.760066770 -0800
|
---|
[0e9e889] | 12 | @@ -591,8 +591,6 @@
|
---|
| 13 | struct TarBallInfo tbInfo;
|
---|
| 14 |
|
---|
| 15 | tbInfo.hlInfoHead = NULL;
|
---|
| 16 | -
|
---|
| 17 | - fchmod(tar_fd, 0644);
|
---|
| 18 | tbInfo.tarFd = tar_fd;
|
---|
| 19 | tbInfo.verboseFlag = verboseFlag;
|
---|
| 20 |
|
---|
[7791a76] | 21 | diff -Naur busybox-1.13.2.orig/include/libbb.h busybox-1.13.2/include/libbb.h
|
---|
| 22 | --- busybox-1.13.2.orig/include/libbb.h 2008-12-30 19:06:45.000000000 -0800
|
---|
| 23 | +++ busybox-1.13.2/include/libbb.h 2009-02-16 11:36:00.780793407 -0800
|
---|
| 24 | @@ -1275,7 +1275,13 @@
|
---|
| 25 | PSSCAN_UTIME = 1 << 13,
|
---|
| 26 | PSSCAN_TTY = 1 << 14,
|
---|
| 27 | PSSCAN_SMAPS = (1 << 15) * ENABLE_FEATURE_TOPMEM,
|
---|
| 28 | - PSSCAN_ARGVN = (1 << 16) * (ENABLE_PGREP || ENABLE_PKILL || ENABLE_PIDOF),
|
---|
| 29 | + /* NB: used by find_pid_by_name(). Any applet using it
|
---|
| 30 | + * needs to be mentioned here. */
|
---|
| 31 | + PSSCAN_ARGVN = (1 << 16) * (ENABLE_KILLALL
|
---|
| 32 | + || ENABLE_PGREP || ENABLE_PKILL
|
---|
| 33 | + || ENABLE_PIDOF
|
---|
| 34 | + || ENABLE_SESTATUS
|
---|
| 35 | + ),
|
---|
| 36 | USE_SELINUX(PSSCAN_CONTEXT = 1 << 17,)
|
---|
| 37 | PSSCAN_START_TIME = 1 << 18,
|
---|
| 38 | PSSCAN_CPU = 1 << 19,
|
---|
[b36d112] | 39 | diff -Naur busybox-1.13.2.orig/init/init.c busybox-1.13.2/init/init.c
|
---|
| 40 | --- busybox-1.13.2.orig/init/init.c 2008-12-30 19:06:45.000000000 -0800
|
---|
[7791a76] | 41 | +++ busybox-1.13.2/init/init.c 2009-02-16 11:35:55.638637240 -0800
|
---|
[b36d112] | 42 | @@ -671,15 +671,14 @@
|
---|
| 43 | */
|
---|
| 44 | static void parse_inittab(void)
|
---|
| 45 | {
|
---|
| 46 | +#if ENABLE_FEATURE_USE_INITTAB
|
---|
| 47 | char *token[4];
|
---|
| 48 | - /* order must correspond to SYSINIT..RESTART constants */
|
---|
| 49 | - static const char actions[] ALIGN1 =
|
---|
| 50 | - "sysinit\0""respawn\0""askfirst\0""wait\0""once\0"
|
---|
| 51 | - "ctrlaltdel\0""shutdown\0""restart\0";
|
---|
| 52 | -
|
---|
| 53 | - parser_t *parser = config_open2(INITTAB, fopen_for_read);
|
---|
| 54 | - /* No inittab file -- set up some default behavior */
|
---|
| 55 | - if (parser == NULL) {
|
---|
| 56 | + parser_t *parser = config_open2("/etc/inittab", fopen_for_read);
|
---|
| 57 | +
|
---|
| 58 | + if (parser == NULL)
|
---|
| 59 | +#endif
|
---|
| 60 | + {
|
---|
| 61 | + /* No inittab file -- set up some default behavior */
|
---|
| 62 | /* Reboot on Ctrl-Alt-Del */
|
---|
| 63 | new_init_action(CTRLALTDEL, "reboot", "");
|
---|
| 64 | /* Umount all filesystems on halt/reboot */
|
---|
| 65 | @@ -699,11 +698,17 @@
|
---|
| 66 | new_init_action(SYSINIT, INIT_SCRIPT, "");
|
---|
| 67 | return;
|
---|
| 68 | }
|
---|
| 69 | +
|
---|
| 70 | +#if ENABLE_FEATURE_USE_INITTAB
|
---|
| 71 | /* optional_tty:ignored_runlevel:action:command
|
---|
| 72 | * Delims are not to be collapsed and need exactly 4 tokens
|
---|
| 73 | */
|
---|
| 74 | while (config_read(parser, token, 4, 0, "#:",
|
---|
| 75 | PARSE_NORMAL & ~(PARSE_TRIM | PARSE_COLLAPSE))) {
|
---|
| 76 | + /* order must correspond to SYSINIT..RESTART constants */
|
---|
| 77 | + static const char actions[] ALIGN1 =
|
---|
| 78 | + "sysinit\0""respawn\0""askfirst\0""wait\0""once\0"
|
---|
| 79 | + "ctrlaltdel\0""shutdown\0""restart\0";
|
---|
| 80 | int action;
|
---|
| 81 | char *tty = token[0];
|
---|
| 82 |
|
---|
| 83 | @@ -727,6 +732,7 @@
|
---|
| 84 | parser->lineno);
|
---|
| 85 | }
|
---|
| 86 | config_close(parser);
|
---|
| 87 | +#endif
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | #if ENABLE_FEATURE_USE_INITTAB
|
---|
[0e9e889] | 91 | diff -Naur busybox-1.13.2.orig/modutils/depmod.c busybox-1.13.2/modutils/depmod.c
|
---|
| 92 | --- busybox-1.13.2.orig/modutils/depmod.c 2008-11-09 09:28:03.000000000 -0800
|
---|
[7791a76] | 93 | +++ busybox-1.13.2/modutils/depmod.c 2009-02-16 11:35:55.041711971 -0800
|
---|
[0e9e889] | 94 | @@ -33,7 +33,7 @@
|
---|
| 95 | enum {
|
---|
| 96 | ARG_a = (1<<0), /* All modules, ignore mods in argv */
|
---|
| 97 | ARG_A = (1<<1), /* Only emit .ko that are newer than modules.dep file */
|
---|
| 98 | - ARG_b = (1<<2), /* not /lib/modules/$(uname -r)/ but this base-dir */
|
---|
| 99 | + ARG_b = (1<<2), /* base directory when modules are in staging area */
|
---|
| 100 | ARG_e = (1<<3), /* with -F, print unresolved symbols */
|
---|
| 101 | ARG_F = (1<<4), /* System.map that contains the symbols */
|
---|
| 102 | ARG_n = (1<<5) /* dry-run, print to stdout only */
|
---|
| 103 | @@ -57,7 +57,7 @@
|
---|
| 104 | *first = info;
|
---|
| 105 |
|
---|
| 106 | info->dnext = info->dprev = info;
|
---|
| 107 | - info->name = xstrdup(fname);
|
---|
| 108 | + info->name = xasprintf("/%s", fname);
|
---|
| 109 | info->modname = filename2modname(fname, NULL);
|
---|
| 110 | for (ptr = image; ptr < image + len - 10; ptr++) {
|
---|
| 111 | if (strncmp(ptr, "depends=", 8) == 0) {
|
---|
| 112 | @@ -123,44 +123,61 @@
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | +static void xfreopen_write(const char *file, FILE *f)
|
---|
| 117 | +{
|
---|
| 118 | + if (freopen(file, "w", f) == NULL)
|
---|
| 119 | + bb_perror_msg_and_die("can't open '%s'", file);
|
---|
| 120 | +}
|
---|
| 121 | +
|
---|
| 122 | int depmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
| 123 | int depmod_main(int argc UNUSED_PARAM, char **argv)
|
---|
| 124 | {
|
---|
| 125 | module_info *modules = NULL, *m, *dep;
|
---|
| 126 | - char *moddir_base = (char *)CONFIG_DEFAULT_MODULES_DIR;
|
---|
| 127 | + const char *moddir_base = "/";
|
---|
| 128 | + char *moddir, *version;
|
---|
| 129 | + struct utsname uts;
|
---|
| 130 | int tmp;
|
---|
| 131 |
|
---|
| 132 | getopt32(argv, "aAb:eF:n", &moddir_base, NULL);
|
---|
| 133 | argv += optind;
|
---|
| 134 |
|
---|
| 135 | /* goto modules location */
|
---|
| 136 | + xchdir(moddir_base);
|
---|
| 137 |
|
---|
| 138 | /* If a version is provided, then that kernel version's module directory
|
---|
| 139 | * is used, rather than the current kernel version (as returned by
|
---|
| 140 | * "uname -r"). */
|
---|
| 141 | - xchdir(moddir_base);
|
---|
| 142 | - if (*argv && (sscanf(*argv, "%d.%d.%d", &tmp, &tmp, &tmp) == 3)) {
|
---|
| 143 | - xchdir(*argv++);
|
---|
| 144 | + if (*argv && sscanf(*argv, "%d.%d.%d", &tmp, &tmp, &tmp) == 3) {
|
---|
| 145 | + version = *argv++;
|
---|
| 146 | } else {
|
---|
| 147 | - struct utsname uts;
|
---|
| 148 | uname(&uts);
|
---|
| 149 | - xchdir(uts.release);
|
---|
| 150 | + version = uts.release;
|
---|
| 151 | }
|
---|
| 152 | - /* If no modules are given on the command-line, -a is on per default. */
|
---|
| 153 | - option_mask32 |= *argv == NULL;
|
---|
| 154 | + moddir = concat_path_file(&CONFIG_DEFAULT_MODULES_DIR[1], version);
|
---|
| 155 |
|
---|
| 156 | /* Scan modules */
|
---|
| 157 | - moddir_base = xrealloc_getcwd_or_warn(NULL);
|
---|
| 158 | - do {
|
---|
| 159 | - recursive_action((option_mask32 & ARG_a) ? moddir_base : *argv,
|
---|
| 160 | - ACTION_RECURSE, parse_module, NULL, &modules, 0);
|
---|
| 161 | - } while (!(option_mask32 & ARG_a) && *(++argv));
|
---|
| 162 | + if (*argv) {
|
---|
| 163 | + char *modfile;
|
---|
| 164 | + struct stat sb;
|
---|
| 165 | + do {
|
---|
| 166 | + modfile = concat_path_file(moddir, *argv);
|
---|
| 167 | + xstat(modfile, &sb);
|
---|
| 168 | + parse_module(modfile, &sb, &modules, 0);
|
---|
| 169 | + free(modfile);
|
---|
| 170 | + } while (*(++argv));
|
---|
| 171 | + } else {
|
---|
| 172 | + recursive_action(moddir, ACTION_RECURSE,
|
---|
| 173 | + parse_module, NULL, &modules, 0);
|
---|
| 174 | + }
|
---|
| 175 | +
|
---|
| 176 | + /* Prepare for writing out the dep files */
|
---|
| 177 | + xchdir(moddir);
|
---|
| 178 | if (ENABLE_FEATURE_CLEAN_UP)
|
---|
| 179 | - free(moddir_base);
|
---|
| 180 | + free(moddir);
|
---|
| 181 |
|
---|
| 182 | /* Generate dependency and alias files */
|
---|
| 183 | if (!(option_mask32 & ARG_n))
|
---|
| 184 | - freopen(CONFIG_DEFAULT_DEPMOD_FILE, "w", stdout);
|
---|
| 185 | + xfreopen_write(CONFIG_DEFAULT_DEPMOD_FILE, stdout);
|
---|
| 186 | for (m = modules; m != NULL; m = m->next) {
|
---|
| 187 | printf("%s:", m->name);
|
---|
| 188 |
|
---|
| 189 | @@ -174,12 +191,12 @@
|
---|
| 190 | dep->dprev->dnext = dep->dnext;
|
---|
| 191 | dep->dnext = dep->dprev = dep;
|
---|
| 192 | }
|
---|
| 193 | - puts("");
|
---|
| 194 | + bb_putchar('\n');
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 | #if ENABLE_FEATURE_MODUTILS_ALIAS
|
---|
| 198 | if (!(option_mask32 & ARG_n))
|
---|
| 199 | - freopen("modules.alias", "w", stdout);
|
---|
| 200 | + xfreopen_write("modules.alias", stdout);
|
---|
| 201 | for (m = modules; m != NULL; m = m->next) {
|
---|
| 202 | while (m->aliases) {
|
---|
| 203 | printf("alias %s %s\n",
|
---|
| 204 | @@ -190,7 +207,7 @@
|
---|
| 205 | #endif
|
---|
| 206 | #if ENABLE_FEATURE_MODUTILS_SYMBOLS
|
---|
| 207 | if (!(option_mask32 & ARG_n))
|
---|
| 208 | - freopen("modules.symbols", "w", stdout);
|
---|
| 209 | + xfreopen_write("modules.symbols", stdout);
|
---|
| 210 | for (m = modules; m != NULL; m = m->next) {
|
---|
| 211 | while (m->symbols) {
|
---|
| 212 | printf("alias symbol:%s %s\n",
|
---|
[b36d112] | 213 | diff -Naur busybox-1.13.2.orig/modutils/modutils-24.c busybox-1.13.2/modutils/modutils-24.c
|
---|
| 214 | --- busybox-1.13.2.orig/modutils/modutils-24.c 2008-11-28 22:48:56.000000000 -0800
|
---|
[7791a76] | 215 | +++ busybox-1.13.2/modutils/modutils-24.c 2009-02-16 11:36:01.295790474 -0800
|
---|
[b36d112] | 216 | @@ -2150,7 +2150,7 @@
|
---|
| 217 | sec->name = name;
|
---|
| 218 | sec->idx = newidx;
|
---|
| 219 | if (size)
|
---|
| 220 | - sec->contents = xmalloc(size);
|
---|
| 221 | + sec->contents = xzalloc(size);
|
---|
| 222 |
|
---|
| 223 | obj_insert_section_load_order(f, sec);
|
---|
| 224 |
|
---|
| 225 | @@ -2165,7 +2165,7 @@
|
---|
| 226 | int newidx = f->header.e_shnum++;
|
---|
| 227 | struct obj_section *sec;
|
---|
| 228 |
|
---|
| 229 | - f->sections = xrealloc(f->sections, (newidx + 1) * sizeof(sec));
|
---|
| 230 | + f->sections = xrealloc_vector(f->sections, 2, newidx);
|
---|
| 231 | f->sections[newidx] = sec = arch_new_section();
|
---|
| 232 |
|
---|
| 233 | sec->header.sh_type = SHT_PROGBITS;
|
---|
| 234 | @@ -2175,7 +2175,7 @@
|
---|
| 235 | sec->name = name;
|
---|
| 236 | sec->idx = newidx;
|
---|
| 237 | if (size)
|
---|
| 238 | - sec->contents = xmalloc(size);
|
---|
| 239 | + sec->contents = xzalloc(size);
|
---|
| 240 |
|
---|
| 241 | sec->load_next = f->load_order;
|
---|
| 242 | f->load_order = sec;
|
---|
| 243 | @@ -2571,8 +2571,7 @@
|
---|
| 244 | /* Collect the modules' symbols. */
|
---|
| 245 |
|
---|
| 246 | if (nmod) {
|
---|
| 247 | - ext_modules = modules = xmalloc(nmod * sizeof(*modules));
|
---|
| 248 | - memset(modules, 0, nmod * sizeof(*modules));
|
---|
| 249 | + ext_modules = modules = xzalloc(nmod * sizeof(*modules));
|
---|
| 250 | for (i = 0, mn = module_names, m = modules;
|
---|
| 251 | i < nmod; ++i, ++m, mn += strlen(mn) + 1) {
|
---|
| 252 | struct new_module_info info;
|
---|
| 253 | @@ -2652,13 +2651,14 @@
|
---|
| 254 | }
|
---|
| 255 |
|
---|
| 256 |
|
---|
| 257 | -static void new_create_this_module(struct obj_file *f, const char *m_name)
|
---|
| 258 | +static void new_create_this_module(struct obj_file *f, const char *m_name)
|
---|
| 259 | {
|
---|
| 260 | struct obj_section *sec;
|
---|
| 261 |
|
---|
| 262 | sec = obj_create_alloced_section_first(f, ".this", tgt_sizeof_long,
|
---|
| 263 | sizeof(struct new_module));
|
---|
| 264 | - memset(sec->contents, 0, sizeof(struct new_module));
|
---|
| 265 | + /* done by obj_create_alloced_section_first: */
|
---|
| 266 | + /*memset(sec->contents, 0, sizeof(struct new_module));*/
|
---|
| 267 |
|
---|
| 268 | obj_add_symbol(f, SPFX "__this_module", -1,
|
---|
| 269 | ELF_ST_INFO(STB_LOCAL, STT_OBJECT), sec->idx, 0,
|
---|
| 270 | @@ -2965,9 +2965,9 @@
|
---|
| 271 | if (i == f->header.e_shnum) {
|
---|
| 272 | struct obj_section *sec;
|
---|
| 273 |
|
---|
| 274 | + f->header.e_shnum++;
|
---|
| 275 | f->sections = xrealloc_vector(f->sections, 2, i);
|
---|
| 276 | f->sections[i] = sec = arch_new_section();
|
---|
| 277 | - f->header.e_shnum = i + 1;
|
---|
| 278 |
|
---|
| 279 | sec->header.sh_type = SHT_PROGBITS;
|
---|
| 280 | sec->header.sh_flags = SHF_WRITE | SHF_ALLOC;
|
---|
| 281 | @@ -3006,12 +3006,9 @@
|
---|
| 282 | for (i = 0; i < f->header.e_shnum; ++i) {
|
---|
| 283 | struct obj_section *s = f->sections[i];
|
---|
| 284 | if (s->header.sh_type == SHT_NOBITS) {
|
---|
| 285 | + s->contents = NULL;
|
---|
| 286 | if (s->header.sh_size != 0)
|
---|
| 287 | - s->contents = memset(xmalloc(s->header.sh_size),
|
---|
| 288 | - 0, s->header.sh_size);
|
---|
| 289 | - else
|
---|
| 290 | - s->contents = NULL;
|
---|
| 291 | -
|
---|
| 292 | + s->contents = xzalloc(s->header.sh_size);
|
---|
| 293 | s->header.sh_type = SHT_PROGBITS;
|
---|
| 294 | }
|
---|
| 295 | }
|
---|
| 296 | @@ -3275,14 +3272,13 @@
|
---|
| 297 | case SHT_SYMTAB:
|
---|
| 298 | case SHT_STRTAB:
|
---|
| 299 | case SHT_RELM:
|
---|
| 300 | + sec->contents = NULL;
|
---|
| 301 | if (sec->header.sh_size > 0) {
|
---|
| 302 | - sec->contents = xmalloc(sec->header.sh_size);
|
---|
| 303 | + sec->contents = xzalloc(sec->header.sh_size);
|
---|
| 304 | fseek(fp, sec->header.sh_offset, SEEK_SET);
|
---|
| 305 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
|
---|
| 306 | bb_perror_msg_and_die("error reading ELF section data");
|
---|
| 307 | }
|
---|
| 308 | - } else {
|
---|
| 309 | - sec->contents = NULL;
|
---|
| 310 | }
|
---|
| 311 | break;
|
---|
| 312 |
|
---|
[0e9e889] | 313 | diff -Naur busybox-1.13.2.orig/testsuite/mdev.tests busybox-1.13.2/testsuite/mdev.tests
|
---|
| 314 | --- busybox-1.13.2.orig/testsuite/mdev.tests 2008-11-09 09:28:19.000000000 -0800
|
---|
[7791a76] | 315 | +++ busybox-1.13.2/testsuite/mdev.tests 2009-02-16 11:36:01.053896354 -0800
|
---|
[0e9e889] | 316 | @@ -111,6 +111,22 @@
|
---|
| 317 |
|
---|
| 318 | # continuing to use directory structure from prev test
|
---|
| 319 | rm -rf mdev.testdir/dev/*
|
---|
| 320 | +echo "sda 0:0 644 =block/ @echo @echo TEST" >mdev.testdir/etc/mdev.conf
|
---|
| 321 | +testing "mdev move and command" \
|
---|
| 322 | + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
|
---|
| 323 | + ls -lnR mdev.testdir/dev | $FILTER_LS2" \
|
---|
| 324 | +"\
|
---|
| 325 | +@echo TEST
|
---|
| 326 | +mdev.testdir/dev:
|
---|
| 327 | +drwxr-xr-x 2 0 0 block
|
---|
| 328 | +
|
---|
| 329 | +mdev.testdir/dev/block:
|
---|
| 330 | +brw-r--r-- 1 0 0 sda
|
---|
| 331 | +" \
|
---|
| 332 | + "" ""
|
---|
| 333 | +
|
---|
| 334 | +# continuing to use directory structure from prev test
|
---|
| 335 | +rm -rf mdev.testdir/dev/*
|
---|
| 336 | echo "@8,0 :1 644" >mdev.testdir/etc/mdev.conf
|
---|
| 337 | testing "mdev #maj,min and no explicit uid" \
|
---|
| 338 | "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
|
---|
| 339 | diff -Naur busybox-1.13.2.orig/util-linux/mdev.c busybox-1.13.2/util-linux/mdev.c
|
---|
| 340 | --- busybox-1.13.2.orig/util-linux/mdev.c 2008-11-09 09:28:22.000000000 -0800
|
---|
[7791a76] | 341 | +++ busybox-1.13.2/util-linux/mdev.c 2009-02-16 11:36:01.053896354 -0800
|
---|
[0e9e889] | 342 | @@ -179,8 +179,9 @@
|
---|
| 343 | unsigned i, n;
|
---|
| 344 | #endif
|
---|
| 345 | char *a = val;
|
---|
| 346 | - s = strchr(val, ' ');
|
---|
| 347 | - val = (s && s[1]) ? s+1 : NULL;
|
---|
| 348 | + s = strchrnul(val, ' ');
|
---|
| 349 | + val = (s[0] && s[1]) ? s+1 : NULL;
|
---|
| 350 | + s[0] = '\0';
|
---|
| 351 | #if ENABLE_FEATURE_MDEV_RENAME_REGEXP
|
---|
| 352 | /* substitute %1..9 with off[1..9], if any */
|
---|
| 353 | n = 0;
|
---|