diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch | 165 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/pseudo_1.1.1.bb | 3 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/pseudo_git.bb | 2 |
3 files changed, 168 insertions, 2 deletions
diff --git a/meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch b/meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch new file mode 100644 index 0000000000..7beea519c5 --- /dev/null +++ b/meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch | |||
@@ -0,0 +1,165 @@ | |||
1 | commit c2f7c5ad8ef0f9c94a2a8382c109c8c6e16c8b18 | ||
2 | Author: Peter Seebach <peter.seebach@windriver.com> | ||
3 | Date: Thu Jun 9 10:53:32 2011 -0500 | ||
4 | |||
5 | Fix realpath(name, NULL) when PSEUDO_DISABLED=1 | ||
6 | |||
7 | On some Linux systems, dlsym("realpath", RTLD_NEXT) prefers | ||
8 | for reasons of its own to give a symbol that is also known | ||
9 | as old_realpath, which fails and yields EINVAL when called | ||
10 | with a null pointer as the second argument. This can be | ||
11 | avoided, on some systems, by using dlvsym() to request | ||
12 | the GLIBC_2.3 version of the symbol. | ||
13 | |||
14 | The wrapper logic is enhanced to allow for specifying | ||
15 | versions, although this currently only works for Linux | ||
16 | (Darwin has no dlvsym, apparently?). The test case is | ||
17 | a trivial program which calls realpath(name, NULL) run | ||
18 | with PSEUDO_DISABLED=1. | ||
19 | |||
20 | diff --git a/ChangeLog.txt b/ChangeLog.txt | ||
21 | index 7ffb74a..a2bbb61 100644 | ||
22 | --- a/ChangeLog.txt | ||
23 | +++ b/ChangeLog.txt | ||
24 | @@ -1,3 +1,8 @@ | ||
25 | +2011-06-08: | ||
26 | + * (seebs) Get the modern realpath from glibc instead of the old | ||
27 | + one inexplicably proferred by RTLD_NEXT. Fixes realpath(path, NULL) | ||
28 | + when PSEUDO_DISABLED=1. | ||
29 | + | ||
30 | 2011-06-06: | ||
31 | * (seebs) revise system() handler substantially. It now | ||
32 | pollutes the environment but works. | ||
33 | diff --git a/makewrappers b/makewrappers | ||
34 | index 6dcf889..20bbf2b 100755 | ||
35 | --- a/makewrappers | ||
36 | +++ b/makewrappers | ||
37 | @@ -211,6 +211,7 @@ class Function: | ||
38 | self.flags = '0' | ||
39 | self.port = port | ||
40 | self.directory = '' | ||
41 | + self.version = 'NULL' | ||
42 | # On Darwin, some functions are SECRETLY converted to foo$INODE64 | ||
43 | # when called. So we have to look those up for real_* | ||
44 | self.inode64 = None | ||
45 | diff --git a/ports/unix/wrapfuncs.in b/ports/unix/wrapfuncs.in | ||
46 | index 74bad89..e06e404 100644 | ||
47 | --- a/ports/unix/wrapfuncs.in | ||
48 | +++ b/ports/unix/wrapfuncs.in | ||
49 | @@ -18,7 +18,7 @@ int lutimes(const char *path, const struct timeval *tv); | ||
50 | char *mkdtemp(char *template); | ||
51 | char *mktemp(char *template); | ||
52 | long pathconf(const char *path, int name); | ||
53 | -char *realpath(const char *name, char *resolved_name); | ||
54 | +char *realpath(const char *name, char *resolved_name); /* version="GLIBC_2.3" */ | ||
55 | int remove(const char *path); /* flags=AT_SYMLINK_NOFOLLOW */ | ||
56 | DIR *opendir(const char *path); | ||
57 | char *tempnam(const char *template, const char *pfx); | ||
58 | diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c | ||
59 | index 600a918..07a4429 100644 | ||
60 | --- a/pseudo_wrappers.c | ||
61 | +++ b/pseudo_wrappers.c | ||
62 | @@ -90,6 +90,42 @@ pseudo_reinit_libpseudo(void) { | ||
63 | _libpseudo_init(); | ||
64 | } | ||
65 | |||
66 | +static void | ||
67 | +pseudo_init_one_wrapper(pseudo_function *func) { | ||
68 | + int (*f)(void); | ||
69 | + char *e; | ||
70 | + if (*func->real != NULL) { | ||
71 | + /* already initialized */ | ||
72 | + return; | ||
73 | + } | ||
74 | + dlerror(); | ||
75 | + | ||
76 | +#if PSEUDO_PORT_LINUX | ||
77 | + if (func->version) | ||
78 | + f = dlvsym(RTLD_NEXT, func->name, func->version); | ||
79 | + /* fall through to the general case, if that failed */ | ||
80 | + if (!f) | ||
81 | +#endif | ||
82 | + f = dlsym(RTLD_NEXT, func->name); | ||
83 | + if (f) { | ||
84 | + *func->real = f; | ||
85 | + } else { | ||
86 | + e = dlerror(); | ||
87 | +#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS | ||
88 | + char *s = func->name; | ||
89 | + s += strlen(s) - 2; | ||
90 | + /* *at() don't have to exist */ | ||
91 | + if (!strcmp(s, "at")) { | ||
92 | + continue; | ||
93 | + } | ||
94 | +#else | ||
95 | + if (e != NULL) { | ||
96 | + pseudo_diag("No real function for %s: %s\n", func->name, e); | ||
97 | + } | ||
98 | +#endif | ||
99 | + } | ||
100 | +} | ||
101 | + | ||
102 | void | ||
103 | pseudo_init_wrappers(void) { | ||
104 | int i; | ||
105 | @@ -103,29 +139,7 @@ pseudo_init_wrappers(void) { | ||
106 | */ | ||
107 | if (!done) { | ||
108 | for (i = 0; pseudo_functions[i].name; ++i) { | ||
109 | - if (*pseudo_functions[i].real == NULL) { | ||
110 | - int (*f)(void); | ||
111 | - char *e; | ||
112 | - dlerror(); | ||
113 | - f = dlsym(RTLD_NEXT, pseudo_functions[i].name); | ||
114 | - if (f) { | ||
115 | - *pseudo_functions[i].real = f; | ||
116 | - } else { | ||
117 | - e = dlerror(); | ||
118 | -#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS | ||
119 | - char *s = pseudo_functions[i].name; | ||
120 | - s += strlen(s) - 2; | ||
121 | - /* *at() don't have to exist */ | ||
122 | - if (!strcmp(s, "at")) { | ||
123 | - continue; | ||
124 | - } | ||
125 | -#else | ||
126 | - if (e != NULL) { | ||
127 | - pseudo_diag("No real function for %s: %s\n", pseudo_functions[i].name, e); | ||
128 | - } | ||
129 | -#endif | ||
130 | - } | ||
131 | - } | ||
132 | + pseudo_init_one_wrapper(&pseudo_functions[i]); | ||
133 | } | ||
134 | done = 1; | ||
135 | } | ||
136 | diff --git a/templates/wrapper_table b/templates/wrapper_table | ||
137 | index 2e79fcd..bb30530 100644 | ||
138 | --- a/templates/wrapper_table | ||
139 | +++ b/templates/wrapper_table | ||
140 | @@ -4,17 +4,21 @@ | ||
141 | |||
142 | /* This file is generated and should not be modified. See the makewrappers | ||
143 | * script if you want to modify this. */ | ||
144 | -static struct { | ||
145 | +typedef struct { | ||
146 | char *name; /* the name */ | ||
147 | int (**real)(void); /* the underlying syscall */ | ||
148 | int (*wrapper)(void); /* the wrapper from guts/name.c */ | ||
149 | -} pseudo_functions[] = { | ||
150 | + char *version; /* the version, if we know and care */ | ||
151 | +} pseudo_function; | ||
152 | + | ||
153 | +static pseudo_function pseudo_functions[] = { | ||
154 | @body | ||
155 | { /* ${comment}; */ | ||
156 | "${name}${maybe_inode64}", | ||
157 | (int (**)(void)) &real_${name}, | ||
158 | - (int (*)(void)) wrap_${name} | ||
159 | + (int (*)(void)) wrap_${name}, | ||
160 | + ${version} | ||
161 | }, | ||
162 | @footer | ||
163 | - { NULL, NULL, NULL }, | ||
164 | + { NULL, NULL, NULL, NULL }, | ||
165 | }; | ||
diff --git a/meta/recipes-devtools/pseudo/pseudo_1.1.1.bb b/meta/recipes-devtools/pseudo/pseudo_1.1.1.bb index e05fe41a6f..f1c8e63714 100644 --- a/meta/recipes-devtools/pseudo/pseudo_1.1.1.bb +++ b/meta/recipes-devtools/pseudo/pseudo_1.1.1.bb | |||
@@ -1,9 +1,10 @@ | |||
1 | require pseudo.inc | 1 | require pseudo.inc |
2 | 2 | ||
3 | PR = "r0" | 3 | PR = "r1" |
4 | 4 | ||
5 | SRC_URI = "http://www.yoctoproject.org/downloads/${BPN}/${BPN}-${PV}.tar.bz2 \ | 5 | SRC_URI = "http://www.yoctoproject.org/downloads/${BPN}/${BPN}-${PV}.tar.bz2 \ |
6 | file://oe-config.patch \ | 6 | file://oe-config.patch \ |
7 | file://realpath_fix.patch \ | ||
7 | file://static_sqlite.patch" | 8 | file://static_sqlite.patch" |
8 | 9 | ||
9 | SRC_URI[md5sum] = "dd59766c17e199fe6144fce8a2c67802" | 10 | SRC_URI[md5sum] = "dd59766c17e199fe6144fce8a2c67802" |
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb index 6505958c4a..c1f0432d59 100644 --- a/meta/recipes-devtools/pseudo/pseudo_git.bb +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb | |||
@@ -1,6 +1,6 @@ | |||
1 | require pseudo.inc | 1 | require pseudo.inc |
2 | 2 | ||
3 | SRCREV = "1d3e67cb168c3459e67a0b29f071ca30ed17dadc" | 3 | SRCREV = "c2f7c5ad8ef0f9c94a2a8382c109c8c6e16c8b18" |
4 | PV = "1.1.1+git${SRCPV}" | 4 | PV = "1.1.1+git${SRCPV}" |
5 | PR = "r19" | 5 | PR = "r19" |
6 | 6 | ||