Skip to content

python3Packages.cffi: disable tests on FreeBSD#328776

Closed
rhelmot wants to merge 1 commit intoNixOS:masterfrom
rhelmot:freebsd-cffi
Closed

python3Packages.cffi: disable tests on FreeBSD#328776
rhelmot wants to merge 1 commit intoNixOS:masterfrom
rhelmot:freebsd-cffi

Conversation

@rhelmot
Copy link
Contributor

@rhelmot rhelmot commented Jul 20, 2024

Description of changes

This test suite cannot work on FreeBSD under nix. It only works on linux because of hardcoded exceptions in cffi's library loading logic which are not present for FreeBSD, requiring it to fall back to /sbin/ldconfig (does not work obviously).

Disable the tests.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
    • x86_64-freebsd
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

This test suite cannot work on FreeBSD under nix. It only works on linux
because of hardcoded exceptions in the library loading logic which are
not present for FreeBSD, requiring it to fall back to /sbin/ldconfig
(does not work obviously).
@github-actions github-actions bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Jul 20, 2024
@rhelmot rhelmot added the 6.topic: bsd Running or building packages on BSD label Jul 20, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jul 21, 2024
@Artturin
Copy link
Member

@rhelmot
Copy link
Contributor Author

rhelmot commented Jul 21, 2024

Looks like I misremembered - it's cpython that has the fallbackless code, not cffi. https://github.com/python/cpython/blob/c4c7097e64b0c9cb0081de8872b90594865c892b/Lib/ctypes/util.py#L224

@rhelmot
Copy link
Contributor Author

rhelmot commented Jul 21, 2024

I was so wrong about the cause of this, it's worse than I thought.

We actually patch out the code that would make this work in cpython (here, here) because it is usually useless and slows down startup. CPython on Linux has an extra case that invokes ld in order to do what could also have been done with gcc, in case the gcc case fails. I think this is why it works on Linux.

Several questions remain:

  • Was this final fallback present when the nixpkgs patch was made to cpython?
  • If not, should it be patched out too?
  • If so, should it be duplicated for FreeBSD?

@rhelmot
Copy link
Contributor Author

rhelmot commented Jul 21, 2024

This final fallback was not present when the nixpkgs patch was made to cpython originally. I did some tests and determined that the function being patched out is in fact never called during cpython 3.12 startup, even on importing uuid as mentioned in the code, so I'm going to pivot to try to remove that patch entirely from the cpython derivation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: bsd Running or building packages on BSD 6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants