Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inclusive language updates #5301

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda_build/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _get_default_settings():
# (GNU ld: -as-needed, Apple ld64: -dead_strip_dylibs -no_implicit_dylibs)
# 2. A missing package in reqs/run (maybe that package is missing run_exports?)
# 3. A missing (or broken) CDT package in reqs/build or (on systems without CDTs)
# 4. .. a missing value in the hard-coded but metadata-augmentable library whitelist
# 4. .. a missing value in the hard-coded but metadata-augmentable library allowlist
# It is important that packages do not suffer from 2 because uninstalling that missing
# package leads to an inability to run this package.
#
Expand Down
1 change: 1 addition & 0 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ def parse(data, config, path=None):
"post-link": str,
"pre-unlink": str,
"missing_dso_whitelist": None,
"missing_dso_allowlist": None, # preferred keyword for inclusive language
"error_overdepending": None,
"error_overlinking": None,
"overlinking_ignore_patterns": [],
Expand Down
78 changes: 43 additions & 35 deletions conda_build/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def library_nature(


# This is really just a small, fixed sysroot and it is rooted at ''. `libcrypto.0.9.8.dylib` should not be in it IMHO.
DEFAULT_MAC_WHITELIST = [
DEFAULT_MAC_ALLOWLIST = [
"/opt/X11/",
"/usr/lib/libSystem.B.dylib",
"/usr/lib/libcrypto.0.9.8.dylib",
Expand Down Expand Up @@ -798,7 +798,7 @@ def library_nature(

# Should contain the System32/SysWOW64 DLLs present on a clean installation of the
# oldest version of Windows that we support (or are currently) building packages for.
DEFAULT_WIN_WHITELIST = [
DEFAULT_WIN_ALLOWLIST = [
"**/ADVAPI32.dll",
"**/bcrypt.dll",
"**/COMCTL32.dll",
Expand Down Expand Up @@ -863,7 +863,7 @@ def _collect_needed_dsos(
if resolved.startswith(run_prefix):
resolved = relpath(resolved, run_prefix).replace(os.sep, "/")
# If resolved still starts with '$RPATH' then that means we will either find it in
# the whitelist or it will present as an error later.
# the allowlist or it will present as an error later.
res["resolved"] = resolved
needed_dsos_for_file[f] = needed
all_needed_dsos = all_needed_dsos.union(
Expand Down Expand Up @@ -980,9 +980,9 @@ def caseless_sepless_fnmatch(paths, pat):
return matches


def _lookup_in_sysroots_and_whitelist(
def _lookup_in_sysroots_and_allowlist(
errors,
whitelist,
allowlist,
needed_dso,
sysroots_files,
msg_prelude,
Expand All @@ -1001,7 +1001,7 @@ def _lookup_in_sysroots_and_whitelist(
]
else:
replacements = [needed_dso]
in_whitelist = False
in_allowlist = False
in_sysroots = False
if len(sysroots_files):
# Check if we have a CDT package or a file in a sysroot.
Expand Down Expand Up @@ -1050,29 +1050,29 @@ def _lookup_in_sysroots_and_whitelist(
_print_msg(
errors,
f"{msg_prelude}: {n_dso_p} not found in any CDT/compiler package,"
" nor the whitelist?!",
" nor the allowlist?!",
verbose=verbose,
)
if not in_sysroots:
# It takes a very long time to glob in C:/Windows so we do not do that.
for replacement in replacements:
needed_dso_w = needed_dso.replace(sysroot_substitution, replacement + "/")
# We should pass in multiple paths at once to this, but the code isn't structured for that.
in_whitelist = any(
[caseless_sepless_fnmatch([needed_dso_w], w) for w in whitelist]
in_allowlist = any(
[caseless_sepless_fnmatch([needed_dso_w], w) for w in allowlist]
)
if in_whitelist:
if in_allowlist:
n_dso_p = f"Needed DSO {needed_dso_w}"
_print_msg(
errors,
f"{info_prelude}: {n_dso_p} found in the whitelist",
f"{info_prelude}: {n_dso_p} found in the allowlist",
verbose=verbose,
)
break
if not in_whitelist and not in_sysroots:
if not in_allowlist and not in_sysroots:
_print_msg(
errors,
f"{msg_prelude}: {needed_dso} not found in packages, sysroot(s) nor the missing_dso_whitelist.\n"
f"{msg_prelude}: {needed_dso} not found in packages, sysroot(s) nor the missing_dso_allowlist.\n"
".. is this binary repackaging?",
verbose=verbose,
)
Expand All @@ -1083,7 +1083,7 @@ def _lookup_in_prefix_packages(
needed_dso,
files,
run_prefix,
whitelist,
allowlist,
info_prelude,
msg_prelude,
warn_prelude,
Expand All @@ -1101,17 +1101,17 @@ def _lookup_in_prefix_packages(
for prec in precs_in_reqs:
if prec in lib_packages:
lib_packages_used.add(prec)
in_whitelist = any([fnmatch(in_prefix_dso, w) for w in whitelist])
in_allowlist = any([fnmatch(in_prefix_dso, w) for w in allowlist])
if len(precs_in_reqs) == 1:
_print_msg(
errors,
f"{info_prelude}: {n_dso_p} found in {precs_in_reqs[0]}{and_also}",
verbose=verbose,
)
elif in_whitelist:
elif in_allowlist:
_print_msg(
errors,
f"{info_prelude}: {n_dso_p} found in the whitelist",
f"{info_prelude}: {n_dso_p} found in the allowlist",
verbose=verbose,
)
elif len(precs_in_reqs) == 0 and len(precs) > 0:
Expand Down Expand Up @@ -1157,11 +1157,12 @@ def _show_linking_messages(
pkg_name,
error_overlinking,
runpath_whitelist,
rpath_allowlist, # preferred keyword for inclusive language
verbose,
requirements_run,
lib_packages,
lib_packages_used,
whitelist,
allowlist,
sysroots,
sysroot_prefix,
sysroot_substitution,
Expand Down Expand Up @@ -1193,7 +1194,9 @@ def _show_linking_messages(
)
continue
if runpaths and not (
runpath_whitelist or any(fnmatch(f, w) for w in runpath_whitelist)
runpath_whitelist
or rpath_allowlist
or any(fnmatch(f, w) for w in runpath_whitelist or rpath_allowlist)
):
_print_msg(
errors,
Expand All @@ -1213,7 +1216,7 @@ def _show_linking_messages(
needed_dso,
files,
run_prefix,
whitelist,
allowlist,
info_prelude,
msg_prelude,
warn_prelude,
Expand All @@ -1229,9 +1232,9 @@ def _show_linking_messages(
verbose=verbose,
)
else:
_lookup_in_sysroots_and_whitelist(
_lookup_in_sysroots_and_allowlist(
errors,
whitelist,
allowlist,
needed_dso,
sysroots,
msg_prelude,
Expand All @@ -1256,7 +1259,9 @@ def check_overlinking_impl(
run_prefix,
build_prefix,
missing_dso_whitelist,
missing_dso_allowlist, # preferred keyword for inclusive language
runpath_whitelist,
rpath_allowlist, # preferred keyword for inclusive language
error_overlinking,
error_overdepending,
verbose,
Expand Down Expand Up @@ -1324,7 +1329,7 @@ def check_overlinking_impl(
"_timeout",
]
# ignore_for_statics = ['gcc_impl_linux*', 'compiler-rt*', 'llvm-openmp*', 'gfortran_osx*']
# sysroots and whitelists are similar, but the subtle distinctions are important.
# sysroots and allowlists are similar, but the subtle distinctions are important.
CONDA_BUILD_SYSROOT = variants.get("CONDA_BUILD_SYSROOT", None)
if CONDA_BUILD_SYSROOT and os.path.exists(CONDA_BUILD_SYSROOT):
# When on macOS and CBS not set, sysroots should probably be '/'
Expand All @@ -1338,10 +1343,10 @@ def check_overlinking_impl(
sysroot + os.sep
for sysroot in utils.glob(join(sysroot_prefix, "**", "sysroot"))
]
whitelist = []
allowlist = []
vendoring_record = dict()
# When build_is_host is True we perform file existence checks for files in the sysroot (e.g. C:\Windows)
# When build_is_host is False we must skip things that match the whitelist from the prefix_owners (we could
# When build_is_host is False we must skip things that match the allowlist from the prefix_owners (we could
# create some packages for the Windows System DLLs as an alternative?)
build_is_host = False
if not len(sysroots):
Expand All @@ -1353,14 +1358,14 @@ def check_overlinking_impl(
# Here we mean that we have a sysroot at '/' (could be a tokenized value like '$SYSROOT'?)
# .. and in that sysroot there are 3 suddirs in which we may search for DSOs.
sysroots = ["/usr/lib", "/opt/X11", "/System/Library/Frameworks"]
whitelist = DEFAULT_MAC_WHITELIST
allowlist = DEFAULT_MAC_ALLOWLIST
build_is_host = True if on_mac else False
elif subdir.startswith("win"):
sysroots = ["C:/Windows"]
whitelist = DEFAULT_WIN_WHITELIST
allowlist = DEFAULT_WIN_ALLOWLIST
build_is_host = True if on_win else False

whitelist += missing_dso_whitelist or []
allowlist += missing_dso_whitelist or missing_dso_allowlist or []

# Sort the sysroots by the number of files in them so things can assume that
# the first sysroot is more important than others.
Expand Down Expand Up @@ -1444,12 +1449,12 @@ def check_overlinking_impl(
not in [o.lower() for o in prefix_owners[run_prefix]]
and resolved not in filesu
):
in_whitelist = False
in_allowlist = False
if not build_is_host:
in_whitelist = any(
[caseless_sepless_fnmatch([orig], w) for w in whitelist]
in_allowlist = any(
[caseless_sepless_fnmatch([orig], w) for w in allowlist]
)
if not in_whitelist:
if not in_allowlist:
if resolved in prefix_owners[build_prefix]:
print(f" ERROR :: {needed_dso} in prefix_owners[build_prefix]")
elif not needed_dso.startswith("$PATH"):
Expand All @@ -1473,11 +1478,12 @@ def check_overlinking_impl(
pkg_name,
error_overlinking,
runpath_whitelist,
rpath_allowlist, # preferred keyword for inclusive language
verbose,
requirements_run,
lib_packages,
lib_packages_used,
whitelist,
allowlist,
sysroots_files,
sysroot_prefix,
sysroot_substitution,
Expand Down Expand Up @@ -1563,8 +1569,10 @@ def check_overlinking(m: MetaData, files, host_prefix=None):
[req.split(" ")[0] for req in m.get_value("requirements/host", [])],
host_prefix or m.config.host_prefix,
m.config.build_prefix,
m.get_value("build/missing_dso_whitelist", []),
m.get_value("build/runpath_whitelist", []),
m.get_value(
("build/missing_dso_whitelist" or "build/missing_dso_allowlist"), []
),
m.get_value(("build/runpath_whitelist" or "build/rpath_allowlist"), []),
m.config.error_overlinking,
m.config.error_overdepending,
m.config.verbose,
Expand Down
2 changes: 1 addition & 1 deletion conda_build/skeletons/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
build:
number: 2
noarch: generic
missing_dso_whitelist:
missing_dso_allowlist:
- '*'

{depends}
Expand Down
10 changes: 5 additions & 5 deletions docs/source/resources/define-metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,10 @@ Use this sparingly, as the overlinking checks generally do prevent you from maki
- "bin/*"


Whitelisting shared libraries
Allowlisting shared libraries
-----------------------------

The ``missing_dso_whitelist`` build key is a list of globs for
The ``missing_dso_allowlist`` build key is a list of globs for
dynamic shared object (DSO) files that should be ignored when
examining linkage information.

Expand All @@ -923,20 +923,20 @@ or error ``--error-overlinking`` will result.
.. code-block:: yaml

build:
missing_dso_whitelist:
missing_dso_allowlist:


These keys allow additions to the list of allowed libraries.

The ``runpath_whitelist`` build key is a list of globs for paths
The ``rpath_allowlist`` build key is a list of globs for paths
which are allowed to appear as runpaths in the package's shared
libraries. All other runpaths will cause a warning message to be
printed during the build.

.. code-block:: yaml

build:
runpath_whitelist:
rpath_allowlist:


.. _requirements:
Expand Down
19 changes: 19 additions & 0 deletions news/5301-inclusive-language-phase1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* Replace non-recipe-keyword instances of `whitelist` to `allowlist`. (#5301)
Loading