3
0
forked from pool/systemtap
systemtap/systemtap-change-extra_cflags-escape-processing.patch
Tony Jones 4fee6ccbe4 Accepting request 544008 from home:jones_tony:branches:devel:tools
- Upgrade to version 3.2. See systemtap.spec for changelog
  Drop patch: systemtap-doc-back-down-gettext-version.diff
- Upgrade to version 3.2
  Changelog: https://sourceware.org/ml/systemtap/2017-q4/msg00096.html
  Drop patch: systemtap-tweak-i386-argument-passing.patch (upstream)
  Add patch: systemtap-change-extra_cflags-escape-processing.patch
  Update keyring.

OBS-URL: https://build.opensuse.org/request/show/544008
OBS-URL: https://build.opensuse.org/package/show/devel:tools/systemtap?expand=0&rev=90
2017-11-21 02:55:31 +00:00

46 lines
1.7 KiB
Diff

From: David Smith <dsmith@redhat.com>
Date: Mon Nov 20 09:51:40 2017 -0600
Subject: change EXTRA_CFLAGS escape processing
Git-commit: c0a01780574234b7c87a7babdc7ee41f33a83983
References: bsc#1067437
Signed-off-by: Tony Jones <tonyj@suse.de>
Fix PR22462 by updating the way we generate the Makefile.
* buildrun.cxx (compile_pass): If the runtime path doesn't have any odd
characters in it, don't bother quoting it in the generated Makefile.
diff --git a/buildrun.cxx b/buildrun.cxx
index 6dc4e5fda..c286a4a80 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -36,6 +36,8 @@ extern "C" {
// https://bugs.gentoo.org/show_bug.cgi?id=522908
#define WERROR ("-W" "error")
+#define PATH_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+,-./_"
+
using namespace std;
/* Adjust and run make_cmd to build a kernel module. */
@@ -513,7 +515,18 @@ compile_pass (systemtap_session& s)
#if CHECK_POINTER_ARITH_PR5947
o << "EXTRA_CFLAGS += -Wpointer-arith" << endl;
#endif
- o << "EXTRA_CFLAGS += -I\"" << s.runtime_path << "\"" << endl;
+
+ // If we've got a reasonable runtime path from the user, we'll just
+ // do '-IDIR'. If there are any sneaky/odd characters in it, we'll
+ // have to quote it, like '-I"DIR"'.
+ if (s.runtime_path.find_first_not_of(PATH_ALLOWED_CHARS, 0) == string::npos)
+ o << "EXTRA_CFLAGS += -I" << s.runtime_path << endl;
+ else
+ {
+ s.print_warning("quoting runtime path in the module Makefile.");
+ o << "EXTRA_CFLAGS += -I\"" << s.runtime_path << "\"" << endl;
+ }
+
// XXX: this may help ppc toc overflow
// o << "CFLAGS := $(subst -Os,-O2,$(CFLAGS)) -fminimal-toc" << endl;
o << "obj-m := " << s.module_name << ".o" << endl;