source: clfs-embedded/patches/busybox-1.13.2-branch_update-2.patch@ 77100d2

Last change on this file since 77100d2 was b36d112, checked in by Jim Gifford <clfs@…>, 16 years ago

Update to Busybox Branch Update Patch

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