Skip to content

Commit 6fe9b70

Browse files
committed
unix: stop building nis extension
See inline comment in discussion in #51 for more context. We also remove the shared library from the ELF allow list in the validation code and teach the validation to ensure the nis extension isn't present.
1 parent c7eb0e8 commit 6fe9b70

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

pythonbuild/cpython.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,16 @@
6262
}
6363

6464
# Modules we don't (yet) support building.
65-
UNSUPPORTED_MODULES = set([])
65+
UNSUPPORTED_MODULES = {
66+
# nis (only installable on UNIX platforms) is globally disabled because
67+
# it has a dependency on libnsl, which isn't part of the Linux Standard
68+
# Base specification. This library has a wonky history where it was once
69+
# part of glibc and core system installs but is slowly being phased away
70+
# from base installations. There are potential workarounds to adding nis
71+
# support. See discussion in
72+
# https://github.com/indygreg/python-build-standalone/issues/51.
73+
b"nis",
74+
}
6675

6776
# Packages that define tests.
6877
STDLIB_TEST_PACKAGES = {

src/main.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const ELF_ALLOWED_LIBRARIES: &[&str] = &[
5050
"libcrypt.so.1",
5151
"libdl.so.2",
5252
"libm.so.6",
53-
"libnsl.so.1",
5453
"libpthread.so.0",
5554
"librt.so.1",
5655
"libutil.so.1",
@@ -365,6 +364,11 @@ static WANTED_WINDOWS_STATIC_PATHS: Lazy<BTreeSet<PathBuf>> = Lazy::new(|| {
365364
.collect()
366365
});
367366

367+
const GLOBALLY_BANNED_EXTENSIONS: &[&str] = &[
368+
// Due to linking issues. See comment in cpython.py.
369+
"nis",
370+
];
371+
368372
fn allowed_dylibs_for_triple(triple: &str) -> Vec<MachOAllowedDylib> {
369373
match triple {
370374
"aarch64-apple-darwin" => DARWIN_ALLOWED_DYLIBS.clone(),
@@ -570,6 +574,12 @@ fn validate_json(json: &PythonJsonMain, triple: &str) -> Result<Vec<String>> {
570574
));
571575
}
572576

577+
for extension in json.build_info.extensions.keys() {
578+
if GLOBALLY_BANNED_EXTENSIONS.contains(&extension.as_str()) {
579+
errors.push(format!("banned extension detected: {}", extension));
580+
}
581+
}
582+
573583
Ok(errors)
574584
}
575585

0 commit comments

Comments
 (0)