|
|
f84355 |
From 1c468a7ce030c9a1528414d63c94530da6b61538 Mon Sep 17 00:00:00 2001
|
|
|
f84355 |
From: Petr Machata <pmachata@redhat.com>
|
|
|
f84355 |
Date: Tue, 3 Mar 2015 11:57:01 +0100
|
|
|
f84355 |
Subject: [PATCH] Do not assume prefix of /usr/share in system_call_params.exp
|
|
|
f84355 |
|
|
|
f84355 |
---
|
|
|
f84355 |
testsuite/Makefile.am | 2 ++
|
|
|
f84355 |
testsuite/ltrace.main/system_call_params.exp | 14 ++++++++------
|
|
|
f84355 |
2 files changed, 10 insertions(+), 6 deletions(-)
|
|
|
f84355 |
|
|
|
f84355 |
diff -up ltrace-0.7.91/testsuite/Makefile.in\~ ltrace-0.7.91/testsuite/Makefile.in
|
|
|
f84355 |
--- ltrace-0.7.91/testsuite/Makefile.in~ 2013-11-05 02:22:47.000000000 +0100
|
|
|
f84355 |
+++ ltrace-0.7.91/testsuite/Makefile.in 2015-03-06 00:13:20.164533852 +0100
|
|
|
f84355 |
@@ -648,6 +648,7 @@
|
|
|
f84355 |
rm -f env.exp
|
|
|
f84355 |
echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> $@
|
|
|
f84355 |
echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> $@
|
|
|
f84355 |
+ echo set PREFIX '"$(prefix)"' >> $@
|
|
|
f84355 |
|
|
|
f84355 |
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
|
|
f84355 |
# Otherwise a system limit (for SysV at least) may be exceeded.
|
|
|
f84355 |
diff --git a/testsuite/ltrace.main/system_call_params.exp b/testsuite/ltrace.main/system_call_params.exp
|
|
|
f84355 |
index 4eade10..90d2c86 100644
|
|
|
f84355 |
--- a/testsuite/ltrace.main/system_call_params.exp
|
|
|
f84355 |
+++ b/testsuite/ltrace.main/system_call_params.exp
|
|
|
f84355 |
@@ -67,7 +67,8 @@ set conf [ltraceNamedSource "$dir/syscalls.conf" {
|
|
|
f84355 |
# system with the right prefix. So first compile a wrapper that we
|
|
|
f84355 |
# use to redirect fopen calls.
|
|
|
f84355 |
|
|
|
f84355 |
-set libfopen_so [ltraceCompile libfopen.so -ldl [ltraceSource c {
|
|
|
f84355 |
+set libfopen_so [ltraceCompile libfopen.so -ldl \
|
|
|
f84355 |
+ [ltraceSource c [string map [list "@PREFIX@" "$PREFIX"] {
|
|
|
f84355 |
#define _GNU_SOURCE
|
|
|
f84355 |
#include <dlfcn.h>
|
|
|
f84355 |
#include <stdio.h>
|
|
|
f84355 |
@@ -76,13 +77,14 @@ set libfopen_so [ltraceCompile libfopen.so -ldl [ltraceSource c {
|
|
|
f84355 |
FILE *
|
|
|
f84355 |
fopen(const char *path, const char *mode)
|
|
|
f84355 |
{
|
|
|
f84355 |
- if (strncmp(path, "/usr/share", 10) == 0)
|
|
|
f84355 |
- path = "/dev/null";
|
|
|
f84355 |
+ #define PATH "@PREFIX@/share"
|
|
|
f84355 |
+ if (strncmp(path, PATH, sizeof(PATH) - 1) == 0)
|
|
|
f84355 |
+ path = "/dev/null";
|
|
|
f84355 |
|
|
|
f84355 |
- return ((FILE *(*)(const char *, const char *))
|
|
|
f84355 |
- dlsym(RTLD_NEXT, "fopen")) (path, mode);
|
|
|
f84355 |
+ return ((FILE *(*)(const char *, const char *))
|
|
|
f84355 |
+ dlsym(RTLD_NEXT, "fopen")) (path, mode);
|
|
|
f84355 |
}
|
|
|
f84355 |
-}]]
|
|
|
f84355 |
+}]]]
|
|
|
f84355 |
|
|
|
f84355 |
setenv LD_PRELOAD $libfopen_so
|
|
|
f84355 |
ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^open@SYS\("/some/path"} == 0
|
|
|
f84355 |
--
|
|
|
f84355 |
2.1.0
|
|
|
f84355 |
|