Commit graph

228 commits

Author SHA1 Message Date
nia
ac88c22960 mk/check: Do not waste time checking binaries that set EMUL_PLATFORM. 2022-03-07 16:53:08 +00:00
pho
a59a2656f9 Fix a broken CVS tag 2022-02-14 00:31:18 +00:00
nia
b00de445c0 check-pie-elf.awk: make the failure case amuse me less 2022-02-13 10:48:24 +00:00
pho
7606a33d85 Add a package-settable variable PKGSRC_OVERRIDE_MKPIE
This is needed by packages that require hand-holding in building PIE. Also a
post-build check for MKPIE is performed by default when PKG_DEVELOPER=YES.
2022-01-18 01:41:09 +00:00
jperkin
0148ecc87e mk: Rename variable to CHECK_SHLIBS_TOXIC.
Improves language and mirrors LD_TOXIC_PATH nomenclature available on at
least the SunOS dynamic linker.  The previous name is retained for now
for compatibility, even though I get the feeling I'm the only person who
is actually using this feature.
2021-10-11 20:26:28 +00:00
tpaul
e452b20105 mk: Use "_PKGSRC_USE_RELRO" instead of "PKGSRC_USE_RELRO"
This variable appears to be incorrect as "_PKGSRC_USE_RELRO" is set in
bsd.prefs.mk. This was causing RELRO_SUPPORTED=no to not function as intended
in lang/go/go-vars.mk

ok'd by jperkin
2021-02-01 16:03:49 +00:00
rillig
3e52f68ccc check-portability: always skip files whose name ends with tilde
Suggested by wiz.
2021-01-04 21:10:01 +00:00
gutteridge
5d6b96b9ed check-files.mk: fix typo in comment 2020-12-20 19:49:25 +00:00
jperkin
7fca306169 mk: Exclude /System/Library on Big Sur too.
As expected this is necessary, as early as requring the CoreFoundation
framework for devel/gettext-lib.
2020-10-09 20:18:30 +00:00
jperkin
4d7409c2ae mk: Handle missing system libraries on Big Sur.
The new release of macOS removes system libraries from the file system, only
providing access to them via a linker cache and dlopen().  This obviously
breaks many assumptions about how libraries work on Unix systems, and so we
unfortunately need to cripple various checks when running on those systems.

Introduce DARWIN_NO_SYSTEM_LIBS which, when defined, will trigger alternate
behaviour in the infrastructure.  Currently this is in two places:

  * In CHECK_SHLIBS, skip any path beginning with /usr/lib.

  * In registered package metadata, any path beginning with /usr/lib is
    removed from REQUIRES.

The former fixes all package builds, while the second will be necessary for
package managers such as pkgin, as they will no longer be able to verify that
those files are available on the target system.

This is obviously a gross hack, and removes our ability to ensure that the
target system is suitable for the packages we are attempting to install, but
Apple have left us with no alternative, and users will unfortunately be left
to find out at runtime instead.

It's likely this will need to be extended to /System/Library paths too, but
this is required first to actually get packages building before we can start
running bulk builds.
2020-10-09 16:00:16 +00:00
rillig
e6b0d53b3d mk/check/check-portability.mk: remove leaked debug code
Thanks jperkin@.
2020-06-07 10:42:04 +00:00
rillig
ffb8ba6d5f mk/check/check-portability.mk: use predefined tools
Just in case any of these tools defines some command line arguments. The
correct path had already been used before since both env and sh are added
to USE_TOOLS in bsd.pkg.mk.
2020-06-07 06:05:35 +00:00
maya
f1308fb6bd Flip the switch on ALLOW_VULNERABLE_PACKAGES to allow them by default.
Right now, users who install the pkg-vulnerabilities database find that
the vast majority of packages fail to build, penalizing them too severely.
Package auditing can still be done via "pkg_admin audit".

Alternatively, the previous behaviour can be restored with
ALLOW_VULNERABLE_PACKAGES=no in mk.conf.

Additionally, bmake-ify the check.mk logic. It was easier to do this,
as the package relied on a single long ${RUN} command.

Proposed on tech-pkg, with no objections to the idea of changing the
default, just the method of doing so.
2020-05-28 16:22:58 +00:00
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