|
|
263585 |
diff -rup a/testsuite/Makefile.am b/testsuite/Makefile.am
|
|
|
263585 |
--- a/testsuite/Makefile.am 2012-12-16 20:53:45.000000000 -0500
|
|
|
263585 |
+++ b/testsuite/Makefile.am 2019-06-28 16:59:19.935602953 -0400
|
|
|
263585 |
@@ -39,6 +39,7 @@ env.exp: Makefile
|
|
|
263585 |
rm -f env.exp
|
|
|
263585 |
echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> $@
|
|
|
263585 |
echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> $@
|
|
|
263585 |
+ echo set PREFIX '"$(prefix)"' >> $@
|
|
|
263585 |
|
|
|
263585 |
CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.exp
|
|
|
263585 |
|
|
|
263585 |
diff -rup a/testsuite/Makefile.in b/testsuite/Makefile.in
|
|
|
263585 |
--- a/testsuite/Makefile.in 2013-11-04 20:22:47.000000000 -0500
|
|
|
263585 |
+++ b/testsuite/Makefile.in 2019-06-28 16:59:12.075602806 -0400
|
|
|
263585 |
@@ -648,6 +648,7 @@ env.exp: Makefile
|
|
|
263585 |
rm -f env.exp
|
|
|
263585 |
echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> $@
|
|
|
263585 |
echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> $@
|
|
|
263585 |
+ echo set PREFIX '"$(prefix)"' >> $@
|
|
|
263585 |
|
|
|
263585 |
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
|
|
263585 |
# Otherwise a system limit (for SysV at least) may be exceeded.
|
|
|
263585 |
diff -rup a/testsuite/ltrace.main/system_call_params.exp b/testsuite/ltrace.main/system_call_params.exp
|
|
|
263585 |
--- a/testsuite/ltrace.main/system_call_params.exp 2019-06-28 16:44:07.542584754 -0400
|
|
|
263585 |
+++ b/testsuite/ltrace.main/system_call_params.exp 2019-06-28 17:00:35.811604355 -0400
|
|
|
263585 |
@@ -1,5 +1,5 @@
|
|
|
263585 |
# This file is part of ltrace.
|
|
|
263585 |
-# Copyright (C) 2013, 2014 Petr Machata, Red Hat Inc.
|
|
|
263585 |
+# Copyright (C) 2013, 2014, 2015 Petr Machata, Red Hat Inc.
|
|
|
263585 |
#
|
|
|
263585 |
# This program is free software; you can redistribute it and/or
|
|
|
263585 |
# modify it under the terms of the GNU General Public License as
|
|
|
263585 |
@@ -60,8 +60,35 @@ set conf [ltraceNamedSource "$dir/syscal
|
|
|
263585 |
# somelib.conf is passed, and syscalls.conf is not available, or
|
|
|
263585 |
# doesn't list readdir, that would be taken from somelib.conf with a
|
|
|
263585 |
# wrong prototype.
|
|
|
263585 |
+#
|
|
|
263585 |
+# This test relies on the fact that there is no global config file
|
|
|
263585 |
+# that would provide legitimate system call prototypes. But that
|
|
|
263585 |
+# doesn't have to be true, maybe ltrace is already installed on the
|
|
|
263585 |
+# system with the right prefix. So first compile a wrapper that we
|
|
|
263585 |
+# use to redirect fopen calls.
|
|
|
263585 |
+
|
|
|
263585 |
+set libfopen_so [ltraceCompile libfopen.so -ldl \
|
|
|
263585 |
+ [ltraceSource c [string map [list "@PREFIX@" "$PREFIX"] {
|
|
|
263585 |
+ #define _GNU_SOURCE
|
|
|
263585 |
+ #include <dlfcn.h>
|
|
|
263585 |
+ #include <stdio.h>
|
|
|
263585 |
+ #include <string.h>
|
|
|
263585 |
+
|
|
|
263585 |
+ FILE *
|
|
|
263585 |
+ fopen(const char *path, const char *mode)
|
|
|
263585 |
+ {
|
|
|
263585 |
+ #define PATH "@PREFIX@/share"
|
|
|
263585 |
+ if (strncmp(path, PATH, sizeof(PATH) - 1) == 0)
|
|
|
263585 |
+ path = "/dev/null";
|
|
|
263585 |
|
|
|
263585 |
+ return ((FILE *(*)(const char *, const char *))
|
|
|
263585 |
+ dlsym(RTLD_NEXT, "fopen")) (path, mode);
|
|
|
263585 |
+ }
|
|
|
263585 |
+}]]]
|
|
|
263585 |
+
|
|
|
263585 |
+setenv LD_PRELOAD $libfopen_so
|
|
|
263585 |
ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^open@SYS\("/some/path", 0\)} == 0
|
|
|
263585 |
+unsetenv LD_PRELOAD
|
|
|
263585 |
|
|
|
263585 |
# On the other hand, if -F somedir/ is given, we want to accept
|
|
|
263585 |
# syscalls.conf found there.
|