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