Commit graph

215 commits

Author SHA1 Message Date
rillig
85f1197b55 mk/check/check-portability.mk: improve documentation 2020-05-09 19:40:10 +00:00
rillig
78ff56665f mk/check/check-portability: opt-in for newer portability checks
There are a few portability checks that have been existing for years.
Later additions need an opt-in phase to avoid breaking existing usages.

https://mail-index.netbsd.org/tech-pkg/2020/05/04/msg023084.html
2020-05-05 05:55:25 +00:00
rillig
80ac4ecc53 mk/check/check-portability: fix error message when no patches are found 2020-05-04 21:48:18 +00:00
rillig
4b2126055f mk/check/check-portability: skip X.in if X is patched
A commonly occuring scenario is that a package patches the configure
script, but that the corresponding configure.in contains shell code that
is not portable.  In cases like these, configure.in is typically not used
during the build, therefore there is no need to check it for portability.

This also applies to all other combinations where a file is patched and
the corresponding file.in contains unportable shell code.
2020-05-04 21:32:48 +00:00
rillig
fe5c19b1df mk/check/check-wrkref.mk: fix shell quoting
Before, adding "Binary file matches" (including the quotes) to
CHECK_WRKREF_EXTRA_DIRS led to a syntax error. Adding this string is so
obvious that it should have been added a long time ago already.
2020-04-26 14:23:25 +00:00
jperkin
f4e4c8e04e mk: Explain what SSP is, requested by rillig@. 2020-03-23 09:25:58 +00:00
jperkin
b44d00ddbd mk: Remove warning messages for unsupported check targets.
These appear to have been cargo culted around for a while, don't even have
anything to do with DESTDIR mode, and are completely useless.  Simplify the
logic a little while here.  Noticed by rillig@.
2020-03-23 09:24:35 +00:00
joerg
0837007143 Increase developer friendliness by including the line number. 2020-03-18 17:47:40 +00:00
rillig
774a30f68e mk/check: revert collateral damage from previous commit
Killing the editor does not stop cvs from committing; to achieve that, it
is necessary to remove the file containing the commit message being
edited.
2020-03-13 08:11:36 +00:00
rillig
f481cb99f6 mk/check/check-perms: allow packages to skip the check completely
When all files are skipped, the tool dependency is not added as well.
This allows packages to skip the check without defining the user-settable
variable CHECK_PERMS.
2020-03-13 08:04:08 +00:00
rillig
5efaae1b1b mk/check/check-portability: exclude REPLACE_BASH by default
Since the portability checks are concerned about bashisms, it doesn't make
sense to apply them to programs that will later be run in bash anyway.

Suggested by gdt via private mail.
2020-03-13 06:31:43 +00:00
rillig
8f5b373f2f mk/check/check-portability: check plain Makefiles as well
Like Makefile.in, these files contain shell commands but don't start with
a #! line.

Suggested by gdt via private mail.
2020-03-12 19:09:41 +00:00
rillig
0418380975 mk/check/check-portability: don't check Makefile.am
These files typically come with a corresponding Makefile.in file, and the
same portability issue is in the .in file as well. For building the
package it is only necessary to patch the .in file. Patching the .am file
as well would mean additional work for the pkgsrc package maintainer.

Nevertheless, such fixes should be reported upstream. The upstream
maintainer is more interested in a patch for Makefile.am, since the .in
file is only generated.

Suggested by wiz via private mail.
2020-03-12 18:54:59 +00:00
rillig
a05002b399 mk/check/check-portability: support file names with spaces
Before, file names that start or end with spaces were trimmed by read(1),
as specified by POSIX 2004 and POSIX 2018.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html

This edge case bug had been present since the very beginning of this
code, in November 2006.

Filenames containing backslashes or newlines are still not supported, and
probably never will be intentionally supported.
2020-03-12 18:40:06 +00:00
rillig
b0fc62a5e2 mk/check/check-portability: check Makefile.am and Makefile.in as well
Up to now, these files had been skipped because they didn't start with a
#! line. Still, they contain shell programs, therefore it makes sense to
check them.
2020-03-12 08:44:15 +00:00
rillig
a08feb9dad mk/check/check-portability: document why *.am and *.in must be checked
Thanks gdt for noticing this.
2020-03-11 23:59:27 +00:00
rillig
1e7918cf88 mk/check: reduce running time of portability check
Since several years, the portability check only checks for shell files.
Instead of opening each extracted file to see whether it is a shell file,
it is more efficient to filter the files based on their names. This saves
a few system calls and in the case of lang/gcc9, half of the total
running time.

The file extensions to be excluded from the check have been sorted by
their count in the PLISTs. This data does not accurately represent the
source files of the package, but it's better than nothing.
2020-03-11 22:30:59 +00:00
rillig
203bc78cac mk/check: remove obsolete SKIP_PORTABILITY_CHECK variable
Marking a variable as obsolete for 12 years should be enough for everyone
to migrate.
2020-03-11 19:58:45 +00:00
rillig
edf2ea6495 mk/check: enable check-portability for [[
Since pkgtools/check-portability is not installed by default, it will not
harm any existing pkgsrc setup. To activate it, it has to be installed
manually. After a testing phase, it will be installed whenever
PKG_DEVELOPER is set.
2020-03-11 19:21:00 +00:00
joerg
1389f0e895 Don't escape newline and tab in regex, newer gawk complains. 2020-01-16 22:53:11 +00:00
rillig
e5b3aa104f mk/check: remove documentation for obsolete SKIP_PORTABILITY_CHECK 2019-10-06 13:38:22 +00:00
rillig
1a49091403 mk/check/check-perms.mk: complete the _VARGROUPS section 2019-10-01 21:56:11 +00:00
rillig
3e43360828 mk/check/check-perms.mk: fix typo in _VARGROUPS section 2019-10-01 21:48:30 +00:00
maya
e34ba8f311 Don't complain if binaries without an interpreter or .dynamic section don't
have a GNU_RELRO flag. (they won't because it doesn't do anything to them).

Should eliminate some of the need for CHECK_RELRO_SKIP, especially for some
Go binaries.
2019-04-24 22:56:47 +00:00
rillig
2b74bc126e mk/check: document how check-portability.sh is typically invoked 2019-01-17 00:11:44 +00:00
triaxx
1866d140cc check-shlibs.mk: avoid l10n of awk-parsed messages.
Fix PR 53119
2018-10-01 14:59:49 +00:00
dbj
ad7e5443a5 check-shlibs-macho.awk: revert previous
Revert this fix until we can determine a possibly better fix.
2018-06-07 07:00:10 +00:00
dbj
0af4e4a4a0 check-shlibs-macho.awk: fix support for checking modules
Allow the dylib install_name to be just the library basename
2018-06-07 04:58:46 +00:00
jperkin
47e24bbfb7 check-shlibs-macho.awk: Implement revision 1.3 correctly.
Skip any lines of otool output that do not start with a tab, ensuring we
only check valid files and ignore e.g. shell scripts.  Older versions of
otool would simply print no output on such files, whereas newer releases
print "is not an object file".
2018-05-25 10:57:28 +00:00
jperkin
3a6695c335 check-shlibs-macho.awk: Revert revision 1.3.
It completely broke the checks, resulting in broken binary packages
being shipped, e.g. https://github.com/joyent/pkgsrc/issues/104
2018-05-25 09:26:49 +00:00
triaxx
0ea3f55391 Wrong place to patch readelf 2018-03-23 04:31:53 +00:00
triaxx
317bd14dc5 Fix wrong parsing due to localized readelf on Linux
Linux version of readelf (at least on Arch) translates output
(e.g. "Shared library") and makes the script broken.
2018-03-22 09:37:17 +00:00
rillig
cb09d12497 mk/check/check-relro.mk: explain what RELRO means 2018-03-04 20:45:19 +00:00
jperkin
1605dd1b43 mk: Add support for SSP checks. 2017-10-03 09:43:06 +00:00
wiz
bece876d09 mk: check for installed files that are not in PLIST by default
Previously, this was only enabled with PKG_DEVELOPER.

Ok kamil@ jperkin@
2017-10-02 14:14:04 +00:00
khorben
b6f9200eca Also check for RELRO in shared libraries 2017-07-05 15:49:00 +00:00
khorben
b6e04d7b1c Only check ELF binaries for RELRO 2017-07-05 15:24:22 +00:00
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