From: Andy Ross <andy.ross@windriver.com>
To: openembedded-core@openembedded.org
Subject: [PATCH] insane.bbclass: Fix RPATH warning in the face of funny path strings
Date: Wed, 15 Aug 2012 15:46:22 -0700 [thread overview]
Message-ID: <1345070782-4518-2-git-send-email-andy.ross@windriver.com> (raw)
In-Reply-To: <1345070782-4518-1-git-send-email-andy.ross@windriver.com>
In toolchain edge cases it's possible for the RPATH of a library to be
set to something like "/usr/lib/../lib". This should be detected as
"/usr/lib" and generate a warning. Also clarify the warning text to
indicate potential link-time pollution from the host libraries.
Signed-off-by: Andy Ross <andy.ross@windriver.com>
---
meta/classes/insane.bbclass | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 556a176..ade0616 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -161,6 +161,17 @@ def package_qa_check_rpath(file,name, d, elf, messages):
if dir in line:
messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file))
+def rpath_norm(s):
+ import re
+ s = re.sub('[^/]+/\.\.(/|$)', '/', s) # snip ".." components
+ s = re.sub('/\.(/|$)', '/', s) # snip "." components
+ s = re.sub('/+', '/', s) # snip repeated slashes
+ s = re.sub('/$', '', s) # snip trailing slash
+ return s
+
+def rpath_eq(a, b):
+ return rpath_norm(a) == rpath_norm(b)
+
QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
def package_qa_check_useless_rpaths(file, name, d, elf, messages):
"""
@@ -181,10 +192,13 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages):
m = rpath_re.match(line)
if m:
rpath = m.group(1)
- if rpath == libdir or rpath == base_libdir:
- # The dynamic linker searches both these places anyway. There is no point in
- # looking there again.
- messages.append("%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d), rpath))
+ if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir):
+ # The dynamic linker searches both these places anyway.
+ # There is no point in looking there again. And it may
+ # be harmful: the RPATH may point to host directories
+ # (e.g. /usr/lib) which will be searched at link time,
+ # creating build issues.
+ messages.append("%s: %s contains probably-redundant, possibly host-polluted RPATH %s" % (name, package_qa_clean_path(file, d), rpath))
QAPATHTEST[dev-so] = "package_qa_check_dev"
def package_qa_check_dev(path, name, d, elf, messages):
--
1.7.11.2
next prev parent reply other threads:[~2012-08-15 22:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-15 22:46 [PATCH] Fix RPATH warning vs. weird paths Andy Ross
2012-08-15 22:46 ` Andy Ross [this message]
2012-08-16 0:14 ` [PATCH] insane.bbclass: Fix RPATH warning in the face of funny path strings Chris Larson
2012-08-16 16:10 ` Andy Ross
2012-08-16 16:10 ` Andy Ross
2012-08-16 8:39 ` Phil Blundell
2012-08-16 17:43 ` Andy Ross
2012-08-17 10:28 ` Richard Purdie
2012-08-17 15:02 ` Andy Ross
-- strict thread matches above, loose matches on Subject: below --
2012-08-17 16:20 [PATCH 1/2] " Richard Purdie
2012-08-20 21:05 ` [PATCH] " Andy Ross
2012-08-21 15:49 ` Saul Wold
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=1345070782-4518-2-git-send-email-andy.ross@windriver.com \
--to=andy.ross@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=openembedded-core@openembedded.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