# HG changeset patch # User Mike Sullivan # Date 1323886991 28800 # Node ID 15f87c23a86ed6d625c71feaf02af3372ac83bbc # Parent fd8f0e501744c41a20043250482df71cc4b3cb8f 7109831 userland pkglint should audit runpaths diff -r fd8f0e501744 -r 15f87c23a86e components/Makefile --- a/components/Makefile Tue Dec 13 13:58:15 2011 -0800 +++ b/components/Makefile Wed Dec 14 10:23:11 2011 -0800 @@ -61,7 +61,9 @@ prep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1 # turn off pkglint for the individual component builds. +ifeq ($(strip $(PKGLINT_COMPONENT)),) publish: MAKEFLAGS += PKGLINT=/bin/true +endif .DEFAULT: publish @@ -86,10 +88,15 @@ $(PKGREPO) create $(PKG_REPO) $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER) +DUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n" +DUMMYPKG += "set pkg.summary=dummy\n" +DUMMYPKG += "set org.opensolaris.consolidation=userland\n" +DUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core" + $(WS_LINT_CACHE): $(WS_LOGS) ifdef CANONICAL_REPO @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..." - @(echo "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)" | $(PKGLINT) \ + @(echo $(DUMMYPKG) | $(PKGLINT) \ -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \ >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0) else diff -r fd8f0e501744 -r 15f87c23a86e components/gnuplot/Makefile --- a/components/gnuplot/Makefile Tue Dec 13 13:58:15 2011 -0800 +++ b/components/gnuplot/Makefile Wed Dec 14 10:23:11 2011 -0800 @@ -44,6 +44,7 @@ CONFIGURE_OPTIONS += --libexecdir=$(CONFIGURE_LIBDIR.$(BITS)) CONFIGURE_OPTIONS += --sysconfdir=/etc/gnu CONFIGURE_OPTIONS += --infodir=$(CONFIGURE_INFODIR) +CONFIGURE_OPTIONS += --x-libraries=$(CONFIGURE_LIBDIR.$(BITS)) CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)" diff -r fd8f0e501744 -r 15f87c23a86e components/graphviz/Makefile --- a/components/graphviz/Makefile Tue Dec 13 13:58:15 2011 -0800 +++ b/components/graphviz/Makefile Wed Dec 14 10:23:11 2011 -0800 @@ -55,6 +55,7 @@ CONFIGURE_OPTIONS += --without-included-ltdl CONFIGURE_OPTIONS += --enable-python=no CONFIGURE_OPTIONS += --enable-python26=yes +CONFIGURE_OPTIONS += --x-libraries=$(CONFIGURE_LIBDIR.$(BITS)) COMPONENT_BUILD_ARGS += GREP=/usr/bin/ggrep diff -r fd8f0e501744 -r 15f87c23a86e tools/python/pkglint/userland.py --- a/tools/python/pkglint/userland.py Tue Dec 13 13:58:15 2011 -0800 +++ b/tools/python/pkglint/userland.py Wed Dec 14 10:23:11 2011 -0800 @@ -50,6 +50,11 @@ re.compile('^/usr/'), re.compile('^\$ORIGIN/') ] + self.runpath_64_re = [ + re.compile('^.*/64(/.*)?$'), + re.compile('^.*/amd64(/.*)?$'), + re.compile('^.*/sparcv9(/.*)?$') + ] self.initscript_re = re.compile("^etc/(rc.|init)\.d") self.lint_paths = {} @@ -195,11 +200,13 @@ return result - def __elf_runpath_check(self, path): + def __elf_runpath_check(self, path, engine): result = None list = [] ed = elf.get_dynamic(path) + ei = elf.get_info(path) + bits = ei.get("bits") for dir in ed.get("runpath", "").split(":"): if dir == None or dir == '': continue @@ -213,6 +220,22 @@ if match == False: list.append(dir) + if bits == 32: + for expr in self.runpath_64_re: + if expr.search(dir): + engine.warning( + _("64-bit runpath in 32-bit binary, '%s' includes '%s'") % (path, dir), + msgid="%s%s.3" % (self.name, "001")) + else: + match = False + for expr in self.runpath_64_re: + if expr.search(dir): + match = True + break + if match == False: + engine.warning( + _("32-bit runpath in 64-bit binary, '%s' includes '%s'") % (path, dir), + msgid="%s%s.3" % (self.name, "001")) if len(list) > 0: result = _("bad RUNPATH, '%%s' includes '%s'" % ":".join(list)) @@ -298,7 +321,7 @@ if result != None: engine.error(result % path, msgid="%s%s.2" % (self.name, pkglint_id)) - result = self.__elf_runpath_check(fullpath) + result = self.__elf_runpath_check(fullpath, engine) if result != None: engine.error(result % path, msgid="%s%s.3" % (self.name, pkglint_id))