summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-06-09 12:06:44 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-09 18:20:29 +0100
commit4b66ce472871618cfe4761861392b7f9c3c265b0 (patch)
tree1eab5c084661a8be9a6c6f7fb8fe05c904b27ca0 /meta/recipes-devtools/pseudo
parentdc15ddd1613035e3f7cf19556d9b7e6b025c7702 (diff)
downloadpoky-4b66ce472871618cfe4761861392b7f9c3c265b0.tar.gz
pseudo: Fix problem related to realpath
When pseudo is disabled, certain programs that call realpath may not work properly. This was discovered when using the Qt MOC tool when certain qmake project features are used. [YOCTO #1150] (From OE-Core rev: d1d87429d751e0bff115ff60d1b5fc55b8fa6249) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/pseudo')
-rw-r--r--meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch165
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_1.1.1.bb3
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_git.bb2
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 @@
1commit c2f7c5ad8ef0f9c94a2a8382c109c8c6e16c8b18
2Author: Peter Seebach <peter.seebach@windriver.com>
3Date: 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
20diff --git a/ChangeLog.txt b/ChangeLog.txt
21index 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.
33diff --git a/makewrappers b/makewrappers
34index 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
45diff --git a/ports/unix/wrapfuncs.in b/ports/unix/wrapfuncs.in
46index 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);
58diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
59index 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 }
136diff --git a/templates/wrapper_table b/templates/wrapper_table
137index 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 @@
1require pseudo.inc 1require pseudo.inc
2 2
3PR = "r0" 3PR = "r1"
4 4
5SRC_URI = "http://www.yoctoproject.org/downloads/${BPN}/${BPN}-${PV}.tar.bz2 \ 5SRC_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
9SRC_URI[md5sum] = "dd59766c17e199fe6144fce8a2c67802" 10SRC_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 @@
1require pseudo.inc 1require pseudo.inc
2 2
3SRCREV = "1d3e67cb168c3459e67a0b29f071ca30ed17dadc" 3SRCREV = "c2f7c5ad8ef0f9c94a2a8382c109c8c6e16c8b18"
4PV = "1.1.1+git${SRCPV}" 4PV = "1.1.1+git${SRCPV}"
5PR = "r19" 5PR = "r19"
6 6