public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Chunmei Xu <xuchunmei@linux.alibaba.com>
To: smakarov@redhat.com
Cc: systemtap@sourceware.org
Subject: [PATCH] add default "/usr/bin:/bin" after $PATH
Date: Fri, 15 May 2020 14:28:45 +0800	[thread overview]
Message-ID: <1589524125-58854-1-git-send-email-xuchunmei@linux.alibaba.com> (raw)

my use case is like this, I install gcc-4.8.5 and devtoolset-9-gcc,
while I set the PATH by "source /opt/rh/devtoolset-9/enable" to use
gcc-9, but when I use "stap test.stap", I always get compile errors
for "gcc: error: unrecognized command line option
‘-fpatchable-function-entry=2’", the option
‘-fpatchable-function-entry=2’ is not supported by gcc-4.8.5 but
supported by gcc-9.
The stap process building always use gcc-4.8.5 from /usr/bin not from
the first path of PATH.
As I think the default /usr/bin:/bin should be added after $PATH.

Signed-off-by: Chunmei Xu <xuchunmei@linux.alibaba.com>
---
 buildrun.cxx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/buildrun.cxx b/buildrun.cxx
index 12abe78..371da96 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -95,13 +95,14 @@ run_make_cmd(systemtap_session& s, vector<string>& make_cmd,
 static vector<string>
 make_any_make_cmd(systemtap_session& s, const string& dir, const string& target)
 {
-  string newpath("PATH=/usr/bin:/bin");
+  string newpath("PATH=");
   const char *oldpath = getenv("PATH");
   if (oldpath != NULL)
     {
-      newpath += ':';
       newpath += oldpath;
+      newpath += ':';
     }
+  newpath += "/usr/bin:/bin";
 
   vector<string> make_cmd
     {
-- 
1.8.3.1


             reply	other threads:[~2020-05-15  6:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  6:28 Chunmei Xu [this message]
2020-05-15  6:57 ` Chunmei Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1589524125-58854-1-git-send-email-xuchunmei@linux.alibaba.com \
    --to=xuchunmei@linux.alibaba.com \
    --cc=smakarov@redhat.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).