Blame SOURCES/ltrace-0.7.91-testsuite-system_call_params-2.patch

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