/[packages]/cauldron/fakechroot/current/SOURCES/fakechroot-rpm-glob64.patch
ViewVC logotype

Contents of /cauldron/fakechroot/current/SOURCES/fakechroot-rpm-glob64.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 883248 - (show annotations) (download)
Thu Sep 24 13:40:07 2015 UTC (4 years, 6 months ago) by tv
File size: 2306 byte(s)
- new release
- rediff patch
1 Workaround for glob* vs rpm glob*
2
3 glob/glob64 is also defined by rpm in librpmio, which breaks fakechroot.
4 This patch tries to find which library is defining the symbol
5 (using dladdr, which is gnu specific) and if found, check if the symbol
6 comes from libc. If it's not from libc, call it directly.
7
8 Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
9 Index: fakechroot-2.16/src/glob64.c
10 ===================================================================
11 --- fakechroot-2.16.orig/src/glob64.c
12 +++ fakechroot-2.16/src/glob64.c
13 @@ -23,6 +23,9 @@
14 #ifdef HAVE_GLOB64
15
16 #define _LARGEFILE64_SOURCE
17 +#define _GNU_SOURCE
18 +#include <dlfcn.h>
19 +#include <string.h>
20 #include <glob.h>
21 #include "libfakechroot.h"
22
23 @@ -31,6 +34,20 @@ wrapper(glob64, int, (const char * patte
24 {
25 int rc, i;
26
27 + void *ptr;
28 +
29 + ptr = dlsym(RTLD_NEXT, "glob64");
30 + if (ptr) {
31 + Dl_info info;
32 + memset(&info, 0, sizeof(Dl_info));
33 + rc = dladdr(ptr, &info);
34 + if (rc && info.dli_sname && !strcmp(info.dli_sname, "glob64")) {
35 + if (!strstr(info.dli_fname, "libc.so")) {
36 + debug("glob64: calling %s found in %s", info.dli_sname, info.dli_fname);
37 + return nextcall(glob64)(pattern, flags, errfunc, pglob);
38 + }
39 + }
40 + }
41 debug("glob64(\"%s\", %d, &errfunc, &pglob)", pattern, flags);
42 expand_chroot_rel_path(pattern);
43
44 Index: fakechroot-2.16/src/glob.c
45 ===================================================================
46 --- fakechroot-2.16.orig/src/glob.c
47 +++ fakechroot-2.16/src/glob.c
48 @@ -20,6 +20,9 @@
49
50 #include <config.h>
51
52 +#define _GNU_SOURCE
53 +#include <dlfcn.h>
54 +#include <string.h>
55 #include <glob.h>
56 #include "libfakechroot.h"
57
58 @@ -28,6 +31,20 @@ wrapper(glob, int, (const char * pattern
59 {
60 int rc, i;
61
62 + void *ptr;
63 +
64 + ptr = dlsym(RTLD_NEXT, "glob");
65 + if (ptr) {
66 + Dl_info info;
67 + memset(&info, 0, sizeof(Dl_info));
68 + rc = dladdr(ptr, &info);
69 + if (rc && info.dli_sname && !strcmp(info.dli_sname, "glob")) {
70 + if (!strstr(info.dli_fname, "libc.so")) {
71 + debug("glob: calling %s found in %s", info.dli_sname, info.dli_fname);
72 + return nextcall(glob)(pattern, flags, errfunc, pglob);
73 + }
74 + }
75 + }
76 debug("glob(\"%s\", %d, &errfunc, &pglob)", pattern, flags);
77 expand_chroot_rel_path(pattern);
78

  ViewVC Help
Powered by ViewVC 1.1.26