Commit graph

228 commits

Author SHA1 Message Date
khorben
ca2b8ac385 Implement a check for RELRO
This is only performed if PKG_DEVELOPER and RELRO are in use.

After a suggestion during my talk at BSDCan 2017; thanks!
Also, submitted on tech-pkg@ for review mid-June.

As a next step, it seems this can be extended to libraries, just like the
check for SHLIBS does (from which this is inspired).
2017-07-04 18:29:24 +00:00
prlw1
5c827f6f0e Essentially from OBATA Akio in private mail, June 2015:
Introduce Icon Theme cache handling framework

Icon Theme cache files are used by GTK+ and maintained with the
gtk-update-icon-cache tool.  Each Icon Theme package duplicates
its own maintainance scripts: only the specified icon theme directory
differs.  With this framework, if packages have ICON_THEMES=yes,
associated icon themes will be detected and their cache files will
be maintained automatically.

Change cache handling behaviour as follows:
* Icon theme caches will be updated if either gtk2+ or gtk3+
  gtk-update-icon-cache tool is available.
* With installation of gtk2+ package, not only hicolor icon theme but
  also any other icon theme cache files will be updated.
* Prevent removal of icon caches at deinstall, gtk3+ may be installed and
  using them.
* Ditto with gtk3+, gtk2+ may not be installed now, so caches must be
  maintained by gtk3+.
2017-06-14 16:23:09 +00:00
jlam
0a676f1f26 Provide switch to activate new frameworks to replace "pkginstall".
If ${_USE_NEW_PKGINSTALL} is "yes", then use the new "pkgtasks",
"init", and "pkgformat/pkg"-scripts frameworks instead of the
existing "pkginstall" framework.
2017-06-01 02:15:10 +00:00
jlam
d8e9bb513c Check that some variables have the correct number of words.
Assert MAKE_DIRS_PERMS and OWN_DIRS_PERMS have the right number of
words before using a multivariable .for loop over those variables.
This prevents errors in parsing the makefiles.
2017-05-31 22:56:22 +00:00
jperkin
1421ba461a Introduce CHECK_SHLIBS_BLACKLIST which allows users to specify a list of
regexps that will cause the checks to fail if they match resolved RPATHs.
2017-05-03 13:46:53 +00:00
jperkin
c4f4067d45 Only perform the CHECK_WRKREF_EXTRA_DIRS check on the resolved path rather
than on all of the rpaths.  We can't always exclude the rpath being added,
for example when the compiler adds its own behind our back, so this avoids
false positives.
2017-04-26 11:19:16 +00:00
rillig
e120f955f9 Fixed typo. 2017-04-01 20:55:39 +00:00
adam
99864d3ee3 Fix for otool from Xcode 8.0 2016-08-20 18:52:42 +00:00
joerg
639d5b402f Remove support for USE_DESTDIR=no. 2016-04-10 15:58:02 +00:00
dholland
69936c6955 Explicitly skip directories. PR 50955. 2016-03-11 21:11:47 +00:00
jperkin
640104b74c Reset 'found' variable for each library check. Previously, all subsequent
tests would pass after the first successful check.  Exposes library issues
in a number of packages.
2016-03-10 15:56:24 +00:00
jklos
85563e4143 Fix issue with VAX when awk's split is called with empty string. 2016-02-24 08:54:23 +00:00
jperkin
f946849744 Add an additional check to ensure that library REQUIRES are not relative
paths.  These would previously pass the checks as the files would exist
when checking from within the DESTDIR, but were not resolvable at runtime.
2016-02-19 15:10:23 +00:00
jperkin
454f6fae69 Perform interpreter sed(1) check with LC_ALL=C, avoids failures on newer
Darwin releases with "sed: RE error: illegal byte sequence".
2015-11-27 12:45:04 +00:00
jperkin
266de5d44b Do the "defined && !empty" dance for NetBSD 5 make. 2015-11-24 09:41:20 +00:00
jperkin
c2fe79eceb Add support for CHECK_WRKREF_EXTRA_DIRS to check-shlibs. If "extra" is
listed in CHECK_WRKREF then these directories will added to the checks
for rpath references.
2015-11-16 17:53:29 +00:00
jperkin
f648dfa7c3 Introduce support for checking Mach-O dynamic libraries.
This works in a similar way to the ELF checks, but uses otool(1) to list the
library name and its dependencies, and the checks fail if there are WRKDIR
references or if the -install_name of the library does not match $PREFIX, as
well as ensuring that any libraries from pkgsrc are correctly registered as
full dependencies.

Removes support for the user to set USE_CHECK_SHLIBS_ELF, but there were no
reasonable reasons for doing so in the past anyway, and it may be masking
issues in platform files we should fix.
2015-08-17 17:35:23 +00:00
jperkin
6652f12ad9 Fix check-shlibs regular expression to match .dylib/.sl the same as .so 2015-08-17 16:39:13 +00:00
jperkin
9bf217a5cb Fix typo in local variable name. 2015-08-10 15:11:47 +00:00
jperkin
7ef3ff730f Use a single egrep and regexp instead of iterating over the list of files to
check and calling grep on each of them.  Idea for using ":ts|" from Joerg.

Reduces the test runtime by around 50%, depending on platform and package.
2015-04-29 13:39:43 +00:00
jperkin
bb4c5026e6 Only check executable files for valid interpreters. By the time this check is
performed all installed files should have their correct mode set, and there are
no INSTALL scripts that currently change file modes under PREFIX after
installation (nor should they ever).

This change considerably speeds up the test.  For example in www/firefox-l10n
the time to run the test reduces from 181 seconds (135 seconds of system time)
down to 10 seconds (6 seconds system time) on my SmartOS build systems.
2015-04-29 13:05:28 +00:00
jperkin
d460a8ce9f Remove obsolete bulk build variables. 2015-02-16 10:42:00 +00:00
obache
d1dc7d256d Revert "Drop obsolated old bulk build related variable settings."
proposed/discussed is required for such changes.
2015-02-01 11:42:59 +00:00
obache
da209eba3e Drop obsolated old bulk build related variable settings. 2014-11-21 10:46:36 +00:00
joerg
c6e1b83d1b Simplify PKG_DEVELOPER checks. 2014-10-12 23:39:17 +00:00
jperkin
5d44125c9b Cache the results of getline and system() calls. Testing with
x11/kde-workspace4 shows a 25x performance improvement, reducing the
runtime of _check-shlibs from 7m55s to just 18s.
2014-10-03 19:12:16 +00:00
jperkin
d72afedf87 Fix the readelf environment variable. 2014-10-01 08:59:33 +00:00
jperkin
47e3447cf5 Set nrpath correctly in the case where there is no RPATH at all. Fixes
issues seen on NetBSD.
2014-09-07 21:53:41 +00:00
jperkin
800bdaa968 Ensure we iterate over the RPATH in search order, rather than relying on
awk array iteration which could result in the wrong library being chosen.

Fixes issue seen with GCC 4.9 where the libgcc from the main GCC package
was found first and caused errors, even though the RPATH correctly had
the gcc49-libs version listed first.
2014-09-06 16:57:51 +00:00
jperkin
a4e43767b4 Add a 'wrappers' option for CHECK_WRKREF which, if enabled, will check for
references to ${WRAPPER_DIR}.

Update the error message when an invalid CHECK_WRKREF option is used.
2014-09-04 16:09:33 +00:00
richard
8a4981f558 use configured in check-perms 2014-05-09 11:59:27 +00:00
ryoon
370bb25b4d Revert rev. 1.5 2014-03-11 23:27:40 +00:00
ryoon
88465f1339 Revert rev. 1.5 and 1.6
The change introduced in rev. 1.5 disables portability check.
2014-03-11 23:23:01 +00:00
ryoon
5b659c4f2a Fix "illegal reference to local variable word" error with lang/nawk
under Debian GNU/Linux 7.4.
lang/nawk's length(array) does not work as expected. So length(array) make
array as usual variable.
2014-03-11 21:32:11 +00:00
obache
e98bbce8cb Imprement CHECK_SHLIBS_SKIP, same as other CHECK_*_SKIP. 2014-03-02 05:43:16 +00:00
jklos
3e9df3ec81 Fixes floating point exceptions on VAX. 2014-03-01 17:57:01 +00:00
obache
0e0d049625 Prevent _CHECK_FILES_{PRE,POST} to include check-files-{pre,post}-message
target, it is unwanted in check-files-clean target.
2014-02-20 09:15:15 +00:00
joerg
71bda04a66 Some Linux systems now use DT_RUNPATH, so match it here as well. 2013-10-25 14:11:13 +00:00
obache
add5c36964 drop `file' command from default USE_TOOLS list.
It is used in limited case, and does not exist by default on some platforms.
proposed at over 30 months ago, and no negative feedback (only one request).
2013-05-12 06:17:50 +00:00
riastradh
9e0c502480 Split BUILD_DEPENDS into TOOL_DEPENDS and BUILD_DEPENDS in mk/.
Build depends are target packages that are needed at build-time for,
e.g., static libraries to link against, header files to include, &c.
Tool depends are native packages that are needed at build-time for,
e.g., compilers/linkers/&c. to run.

ok agc
2013-05-09 23:37:25 +00:00
wiz
3ca0214c05 Add DESTDIR to error message in case of PLIST mismatch.
Noted by Edgar Fuß.
2013-03-08 15:32:52 +00:00
obache
354965a339 skip symbolic link for shlibs check, it may point to absolute path and currently
installed old version's file.
2013-02-20 06:00:51 +00:00
jperkin
568e518ff4 Don't print the /bin/sh warning on SunOS-5.11, where /bin/sh is ksh93. 2013-01-04 10:51:57 +00:00
joerg
86a1f7d707 Expand the list of full dependencies, so that the shared library check
can work without further calls for indirect full dependencies.
2012-07-02 14:53:13 +00:00
obache
746a40d55d Revert last change.
Honor dicision of the copyright holder.
2012-06-16 11:58:07 +00:00
obache
36a4eb2941 allow DSO in not only non-full dependency packages but also indirect full dependency. 2012-06-15 14:46:53 +00:00
joerg
bd737b69e2 Extend shared library check to all files that match *.so. 2012-05-29 21:53:55 +00:00
marino
9220ff46a6 mk/check/check-files.mk: Skip locale.alias
On DragonFly, packages like devel/doc++ and net/wap-utils were failing the
file check during installation due to a present locale.alias file.  Treat
it the same as charset.alias.
2012-05-22 07:59:31 +00:00
reed
88166ad6f5 Rename "flavor" to "pkgformat".
This is from Anton Panev's GSoC 2011 project to add RPM and DPKG
support to pkgsrc. (I am not adding that further support in this
commit.)

This is just a rename of the existing functionality. Now it will
be easy to test the GSoC work by simply putting in a single
directory (such as "rpm" or "deb"). See
http://addpackageforma.sourceforge.net/ for some details.

This is from Anton's CVS, but I made some minor changes:

- changed plural pkgformats to singular pkgformat (to be consistent)

- fixed a few places (in comments) that were missed

- catch up on some additions to flavor not in the pkgforma cvs:
PKGSRC_SETENV and _flavor-destdir-undo-replace and
undo-destdir-replace-install.
2011-10-15 00:23:07 +00:00
abs
fc3bada41a Introduce PKGSRC_SETENV, defaulting to SETENV. Can be set to ${SETENV} -i
to santise environment
2011-09-08 20:17:15 +00:00
roy
7ecb96b2ef Just warn about non executable files using env. 2011-04-19 15:31:45 +00:00
roy
b73064c230 Disallow the use of env(1) as an interpreter. 2011-04-19 14:28:28 +00:00
obache
fb23ffa128 Skip interpreter check unless regular file.
PR#44089, avoid warnings from broken symbolic link or link to a directory.
2011-01-11 12:03:18 +00:00
bad
89f715edf7 I'm fed up with having to waste time because PKG_DEVELOPER is "special" and
can't be disabled by setting it to "no" like the other variables.
Besides, flavor/pkg/metadata.mk has been expecting for a long time that "no"
is a valid value.

Make PKG_DEVELOPER DWIM.
2010-08-24 19:08:28 +00:00
joerg
40c00aad94 Deal with cases where the first dependency of a package is a build
dependency, but a full dependency follows later.
2010-02-02 23:35:36 +00:00
tnn
f7cda37482 The missing run-time search path test cannot run reliably in DESTDIR mode
when not using the readelf(1) method, so skip the test and warn about it.
2010-02-02 15:36:15 +00:00
tnn
ab33a2bb5f revert previous - better do a bulk build with this change first to see
if/how much stuff is dependent on it.
2009-10-21 18:00:00 +00:00
tnn
33518e0113 remove lib/charset.alias from CHECK_FILES_SKIP 2009-10-21 17:00:33 +00:00
joerg
013ced16d3 Add wrkref check for using the .buildlink or .x11-buildlink
subdirectories. Update comment on the default checks.
2009-09-02 14:43:06 +00:00
agc
d07c430fe5 Get rid of an abstraction violation which has been in the tree since
March 2008. Not vital, but the previous way does not scale well/at all.
2009-07-26 05:32:43 +00:00
tnn
ddc47f016a fix typo in comment 2009-06-18 14:51:55 +00:00
minskim
ecb0f805f1 Remove a redundant "$" from a grep pattern. 2009-05-08 20:46:29 +00:00
uebayasi
c166eebbec Fix check-wrkref path.
_CHECK_WRKREF_FILELIST_CMD is a command which prints PLIST paths
converted to absolute path.  _CHECK_WRKREF_FILELIST_CMD can run
anywhere, so cd ${DESTDIR} before that is pointless.  To access files,
_CHECK_WRKREF_FILELIST_CMD's output needs to be s/^/${DESTDIR}/ when
destdir is used.


Reviewed By:	joerg
2009-01-12 13:11:22 +00:00
rillig
c448324760 Oops. 2008-12-15 12:28:49 +00:00
rillig
9a009cf3a3 Made the code shorter.
The info messages can be omitted. At least for ELF binaries, the code is
sufficiently stable.
2008-12-15 11:03:49 +00:00
rillig
0e70dc215e Removed unused variables. 2008-11-18 21:58:22 +00:00
joerg
8f45797884 "Downgrade" checkperms dependency to a normal build dependency.
This way it doesn't have to be installed for make checksum etc.
to run.
2008-06-22 22:05:19 +00:00
tnn
29fefc1b76 Enable USE_CHECK_SHLIBS_ELF on FreeBSD. Aleksej Saushev PR pkg/38606. 2008-05-13 11:40:24 +00:00
joerg
630dcf7283 Enable USE_CHECK_SHLIBS_ELF by default on DragonFly and NetBSD. 2008-03-09 13:47:08 +00:00
rillig
0f02165471 Removed colons from variable names so they are accessible to "bmake
help".
2008-02-20 10:43:55 +00:00
rillig
5530265343 After being deprecated for 16 months, SKIP_PORTABILITY_CHECK is now
obsolete.
2008-02-20 10:27:35 +00:00
rillig
5f7de0ffaa Removed colons for the sake of "bmake help". 2008-02-20 10:23:26 +00:00
rillig
c18f3fed81 Added a new check for binaries, so that they are installed according to
the INSTALL_UNSTRIPPED variable. By default, this check is disabled, so
that it does not cause any breakage.

NB: The file(1) command needs the explicit locale to prevent translated
messages. This file is copied from check-interpreter.mk.
2008-02-13 15:02:20 +00:00
rillig
339e8ef931 Adjusted the documentation to the source code. 2008-02-13 08:33:08 +00:00
tnn
8a03a4df4f Enable check-fakehome.mk. 2008-02-10 11:44:48 +00:00
tnn
d91ec32482 Enable fake home directory support. Also add a wrkref check because an
embedded path to the HOME directory can be a security problem if, say,
the package looks in the HOME directory of an unprivileged user for
configuration files.

Note that this has the potential to cause some short-term fallout.
2008-02-10 11:43:20 +00:00
adrianp
d08d9e77fe Skip ${PREFIX}/emul/linux32/proc.* as well 2008-02-08 23:13:35 +00:00
rillig
66736dde43 Replaced _PKG_SILENT and _PKG_DEBUG with RUN. 2008-02-07 21:36:13 +00:00
tnn
96ef75e1dd No need to walk the whole directory when checking for emptyness.
From Robert Elz.
2008-02-05 11:17:00 +00:00
tnn
3b84dc1b5a This is the check part of the fake $HOME code. Not enabled yet. 2008-02-05 09:45:00 +00:00
tnn
a1bf36e0ae Convert to ${RUN} 2008-02-05 08:17:59 +00:00
rillig
cef72b1779 STEP_MSG may be a hidden command. 2008-01-23 14:30:59 +00:00
rillig
3444dbc941 The package x11/gdm embeds ${exec_prefix} into a macro containing a
PATH, in which it is not directly preceded by a quote character:

	#define GDM_USER_PATH "/usr/bin:/bin:${exec_prefix}"

Catch this by complaining about "${" also when it appears after a colon.

Since this check is still disabled by default, it will not surprise anyone.
2008-01-21 06:11:09 +00:00
joerg
daa4ab9470 Make the default rpath for USE_CHECK_SHLIBS_ELF a platform variable.
Define the values for NetBSD and DragonFly.
2008-01-16 14:03:31 +00:00
bjs
c4ff3e236e The interpreter check for packages which are their own interpreter,
e.g. lang/perl5, was failing.  Adding a check for ${DESTDIR}"$$interp"
fixes this.
2007-11-30 08:34:31 +00:00
rillig
91b1d082d9 Print a warning for every file that has /bin/sh as interpreter, but only
on Solaris.
2007-11-28 17:00:04 +00:00
rillig
e5fa877447 Activated the check-interpreter for PKG_DEVELOPERs. I don't remember why
activating this has taken so long.
2007-11-07 10:52:00 +00:00
dsl
d24555b956 Fix the .include lines so that make looks in the right place first.
Remember .include "foo.mk" is looked for (first) in the directory that
contains the makefile being processed (like in C), so remove all the
${.PARSEDIR} and ../ sequences that just cause grief.
2007-10-13 11:04:15 +00:00
rillig
3e6363f13d Even though VARBASE is sometimes below LOCALBASE, some users want to
check it. Don't prevent that in CHECK_FILES_STRICT=yes mode.
2007-09-27 13:57:12 +00:00
rillig
7c238f4588 In bulk builds with a custom PKGSRCDIR, that directory should not appear
in binary packages. This check can be enabled by adding "pkgsrc" to
CHECK_WRKREF.
2007-09-13 09:52:46 +00:00
rillig
c852fe8d9a check-files shouldn't complain about files in VARBASE, since they cannot
be represented in the PLIST.
2007-09-12 10:22:53 +00:00
rillig
876b9237c3 Now it's possible to add custom directories to the check for directory
references.
2007-09-05 13:34:32 +00:00
jlam
f7addad279 Allow the existence of symlinks that point nowhere. 2007-08-21 21:44:23 +00:00
joerg
8b88cd8fca Add actual license and a small description of what this is doing. 2007-08-21 21:08:18 +00:00
joerg
80b8a5c96a Add a cross-compile and DESTDIR safe alternative to ldd for
check-shlibs. This allows more stricter detection (e.g. it checks
whether the package links against a build dependency). It also checks
whether the rpath contains wrkdir references (like qt3-libs). It depends
on readelf and is only available for ELF systems for now. To test it,
add USE_CHECK_SHLIBS_ELF to mk.conf.

Supported-by: Google SoC 2007
2007-08-20 11:04:02 +00:00
joerg
8eae292c51 Fix a number of bugs in the DESTDIR support:
- check-perms.mk was not DESTDIR aware, prefix files before passing it
  to the directory extraction
- PKG_FILELIST_CMD was calling pkg_info, which is fine for normal
  installation, but fails of course for DESTDIR. Just drop the @ lines
  from ${_DEPENDS_PLIST} and use that.
- To make he former work, ensure that _flavor-generate-metadata is part
  of _INSTALL_ALL_TARGETS. It was normally a dependency of
  _flavor-register, but that is skipped for DESTDIR.
- Remove ${_DEPENDS_PLIST} when running install-clean.
2007-08-14 23:58:24 +00:00
rillig
4c34803115 Prevented the files check from being confused by concurrent instances of
"make replace". Since these are currently not locked properly, they may
remove files from PKG_DBDIR while another package is being installed.
2007-08-13 05:05:11 +00:00
joerg
ebe8eba5a1 When using check-perms, also depend on sysutils/checkperms. 2007-07-23 12:10:56 +00:00
tnn
146da1286c Teach pkgsrc about HP-UX. 2007-04-14 14:17:49 +00:00
heinz
5f663ce08e Made this check work again. The regular expression did not match relative
paths from .PLIST.

Changed the working directory to ${DESTDIR}${PREFIX} so files can be
accessed correctly.

Extended the relative paths to absolute paths again for better clarity.

Improved (IMHO) some wording.
2007-03-24 18:23:54 +00:00