1 From 4ffecddf5433d65a6f01241990c9d516586b1c79 Mon Sep 17 00:00:00 2001
2 From: Victor Kamensky <kamensky@cisco.com>
3 Date: Mon, 19 Mar 2018 08:53:51 -0500
4 Subject: [PATCH] Delay adding sysroot path to module name in case of non
7 Current stap code adds sysroot prematurely for probes that specify non
8 absolute path name, i.e like "foo", so when find_executable called it
9 receives full path as <sysroot>/foo and find_executable does not search
10 PATH while applying sysroot.
12 Fix delays adding sysroot till path inside of sysroot is searched first.
14 Also fix missing sysroot addition in glob expansion case.
16 Upstream-Status: Backport
17 Signed-off-by: Victor Kamensky <kamensky@cisco.com>
19 tapsets.cxx | 8 ++++----
20 1 file changed, 4 insertions(+), 4 deletions(-)
22 Index: git/tapsets.cxx
23 ===================================================================
24 --- git.orig/tapsets.cxx
26 @@ -746,7 +746,7 @@ base_query::base_query(dwflpp & dw, lite
28 get_string_param(params, TOK_PROCESS, module_val);
30 - module_val = find_executable (module_val, "", sess.sysenv);
31 + module_val = find_executable (module_val, sess.sysroot, sess.sysenv);
32 if (!is_fully_resolved(module_val, "", sess.sysenv))
33 throw SEMANTIC_ERROR(_F("cannot find executable '%s'",
34 module_val.to_string().c_str()));
35 @@ -8287,7 +8287,6 @@ dwarf_builder::build(systemtap_session &
39 - module_name = (string)sess.sysroot + (string)module_name;
40 filled_parameters[TOK_PROCESS] = new literal_string(module_name);
43 @@ -8321,7 +8320,8 @@ dwarf_builder::build(systemtap_session &
46 // Evaluate glob here, and call derive_probes recursively with each match.
47 - const auto& globs = glob_executable (module_name);
48 + const auto& globs = glob_executable (sess.sysroot
49 + + string(module_name));
50 unsigned results_pre = finished_results.size();
51 for (auto it = globs.begin(); it != globs.end(); ++it)
53 @@ -8413,7 +8413,7 @@ dwarf_builder::build(systemtap_session &
54 // PR13338: unquote glob results
55 module_name = unescape_glob_chars (module_name);
56 user_path = find_executable (module_name, "", sess.sysenv); // canonicalize it
57 - if (!is_fully_resolved(user_path, "", sess.sysenv))
58 + if (!is_fully_resolved(user_path, sess.sysroot, sess.sysenv))
59 throw SEMANTIC_ERROR(_F("cannot find executable '%s'",
60 user_path.to_string().c_str()));