source: clfs-embedded/patches/busybox-1.13.2-branch_update-1.patch @ 0e9e889

Last change on this file since 0e9e889 was 0e9e889, checked in by Jim Gifford <clfs@…>, 11 years ago

Starting Busybox Updates

  • Property mode set to 100644
File size: 5.9 KB
RevLine 
[0e9e889]1Submitted By: Jim Gifford (jim at cross-lfs dot org)
2Date: 01-25-2009
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
11+++ busybox-1.13.2/archival/tar.c       2009-01-25 12:52:44.955898588 -0800
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 
21diff -Naur busybox-1.13.2.orig/modutils/depmod.c busybox-1.13.2/modutils/depmod.c
22--- busybox-1.13.2.orig/modutils/depmod.c       2008-11-09 09:28:03.000000000 -0800
23+++ busybox-1.13.2/modutils/depmod.c    2009-01-25 12:52:44.229924290 -0800
24@@ -33,7 +33,7 @@
25 enum {
26        ARG_a = (1<<0), /* All modules, ignore mods in argv */
27        ARG_A = (1<<1), /* Only emit .ko that are newer than modules.dep file */
28-       ARG_b = (1<<2), /* not /lib/modules/$(uname -r)/ but this base-dir */
29+       ARG_b = (1<<2), /* base directory when modules are in staging area */
30        ARG_e = (1<<3), /* with -F, print unresolved symbols */
31        ARG_F = (1<<4), /* System.map that contains the symbols */
32        ARG_n = (1<<5)  /* dry-run, print to stdout only */
33@@ -57,7 +57,7 @@
34        *first = info;
35 
36        info->dnext = info->dprev = info;
37-       info->name = xstrdup(fname);
38+       info->name = xasprintf("/%s", fname);
39        info->modname = filename2modname(fname, NULL);
40        for (ptr = image; ptr < image + len - 10; ptr++) {
41                if (strncmp(ptr, "depends=", 8) == 0) {
42@@ -123,44 +123,61 @@
43        }
44 }
45 
46+static void xfreopen_write(const char *file, FILE *f)
47+{
48+       if (freopen(file, "w", f) == NULL)
49+               bb_perror_msg_and_die("can't open '%s'", file);
50+}
51+
52 int depmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
53 int depmod_main(int argc UNUSED_PARAM, char **argv)
54 {
55        module_info *modules = NULL, *m, *dep;
56-       char *moddir_base = (char *)CONFIG_DEFAULT_MODULES_DIR;
57+       const char *moddir_base = "/";
58+       char *moddir, *version;
59+       struct utsname uts;
60        int tmp;
61 
62        getopt32(argv, "aAb:eF:n", &moddir_base, NULL);
63        argv += optind;
64 
65        /* goto modules location */
66+       xchdir(moddir_base);
67 
68        /* If a version is provided, then that kernel version's module directory
69         * is used, rather than the current kernel version (as returned by
70         * "uname -r").  */
71-       xchdir(moddir_base);
72-       if (*argv && (sscanf(*argv, "%d.%d.%d", &tmp, &tmp, &tmp) == 3)) {
73-               xchdir(*argv++);
74+       if (*argv && sscanf(*argv, "%d.%d.%d", &tmp, &tmp, &tmp) == 3) {
75+               version = *argv++;
76        } else {
77-               struct utsname uts;
78                uname(&uts);
79-               xchdir(uts.release);
80+               version = uts.release;
81        }
82-       /* If no modules are given on the command-line, -a is on per default.  */
83-       option_mask32 |= *argv == NULL;
84+       moddir = concat_path_file(&CONFIG_DEFAULT_MODULES_DIR[1], version);
85 
86        /* Scan modules */
87-       moddir_base = xrealloc_getcwd_or_warn(NULL);
88-       do {
89-               recursive_action((option_mask32 & ARG_a) ? moddir_base : *argv,
90-                               ACTION_RECURSE, parse_module, NULL,  &modules, 0);
91-       } while (!(option_mask32 & ARG_a) && *(++argv));
92+       if (*argv) {
93+               char *modfile;
94+               struct stat sb;
95+               do {
96+                       modfile = concat_path_file(moddir, *argv);
97+                       xstat(modfile, &sb);
98+                       parse_module(modfile, &sb, &modules, 0);
99+                       free(modfile);
100+               } while (*(++argv));
101+       } else {
102+               recursive_action(moddir, ACTION_RECURSE,
103+                                parse_module, NULL, &modules, 0);
104+       }
105+
106+       /* Prepare for writing out the dep files */
107+       xchdir(moddir);
108        if (ENABLE_FEATURE_CLEAN_UP)
109-               free(moddir_base);
110+               free(moddir);
111 
112        /* Generate dependency and alias files */
113        if (!(option_mask32 & ARG_n))
114-               freopen(CONFIG_DEFAULT_DEPMOD_FILE, "w", stdout);
115+               xfreopen_write(CONFIG_DEFAULT_DEPMOD_FILE, stdout);
116        for (m = modules; m != NULL; m = m->next) {
117                printf("%s:", m->name);
118 
119@@ -174,12 +191,12 @@
120                        dep->dprev->dnext = dep->dnext;
121                        dep->dnext = dep->dprev = dep;
122                }
123-               puts("");
124+               bb_putchar('\n');
125        }
126 
127 #if ENABLE_FEATURE_MODUTILS_ALIAS
128        if (!(option_mask32 & ARG_n))
129-               freopen("modules.alias", "w", stdout);
130+               xfreopen_write("modules.alias", stdout);
131        for (m = modules; m != NULL; m = m->next) {
132                while (m->aliases) {
133                        printf("alias %s %s\n",
134@@ -190,7 +207,7 @@
135 #endif
136 #if ENABLE_FEATURE_MODUTILS_SYMBOLS
137        if (!(option_mask32 & ARG_n))
138-               freopen("modules.symbols", "w", stdout);
139+               xfreopen_write("modules.symbols", stdout);
140        for (m = modules; m != NULL; m = m->next) {
141                while (m->symbols) {
142                        printf("alias symbol:%s %s\n",
143diff -Naur busybox-1.13.2.orig/testsuite/mdev.tests busybox-1.13.2/testsuite/mdev.tests
144--- busybox-1.13.2.orig/testsuite/mdev.tests    2008-11-09 09:28:19.000000000 -0800
145+++ busybox-1.13.2/testsuite/mdev.tests 2009-01-25 12:52:44.443204916 -0800
146@@ -111,6 +111,22 @@
147 
148 # continuing to use directory structure from prev test
149 rm -rf mdev.testdir/dev/*
150+echo "sda 0:0 644 =block/ @echo @echo TEST" >mdev.testdir/etc/mdev.conf
151+testing "mdev move and command" \
152+       "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
153+       ls -lnR mdev.testdir/dev | $FILTER_LS2" \
154+"\
155+@echo TEST
156+mdev.testdir/dev:
157+drwxr-xr-x 2 0 0 block
158+
159+mdev.testdir/dev/block:
160+brw-r--r-- 1 0 0 sda
161+" \
162+       "" ""
163+
164+# continuing to use directory structure from prev test
165+rm -rf mdev.testdir/dev/*
166 echo "@8,0 :1 644" >mdev.testdir/etc/mdev.conf
167 testing "mdev #maj,min and no explicit uid" \
168        "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
169diff -Naur busybox-1.13.2.orig/util-linux/mdev.c busybox-1.13.2/util-linux/mdev.c
170--- busybox-1.13.2.orig/util-linux/mdev.c       2008-11-09 09:28:22.000000000 -0800
171+++ busybox-1.13.2/util-linux/mdev.c    2009-01-25 12:52:44.443204916 -0800
172@@ -179,8 +179,9 @@
173                        unsigned i, n;
174 #endif
175                        char *a = val;
176-                       s = strchr(val, ' ');
177-                       val = (s && s[1]) ? s+1 : NULL;
178+                       s = strchrnul(val, ' ');
179+                       val = (s[0] && s[1]) ? s+1 : NULL;
180+                       s[0] = '\0';
181 #if ENABLE_FEATURE_MDEV_RENAME_REGEXP
182                        /* substitute %1..9 with off[1..9], if any */
183                        n = 0;
Note: See TracBrowser for help on using the repository browser.