NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.54k forks source link

python37.pkgs.pyroma: test fails with segmentation fault #136901

Open charlieshanley opened 3 years ago

charlieshanley commented 3 years ago

Describe the bug

A test for the python package pyroma produces a segmentation fault under Python 3.7.

Steps To Reproduce

nix-shell -p python37.pkgs.pyroma -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/9fe0b74ae40c4e83552aed1df137e379e64b3680.tar.gz

Use --check if somehow it is already in your nix store. By comparison, building succeeds if I change 37 to 38 or 39.

Expected behavior

Successfully builds and tests, or problematic tests disabled.

Additional context

I encountered this because pyroma is a transitive dependency of python37.pkgs.google-api-python-client, via this path: pyroma -> Pillow -> faker -> pytest-randomly -> httplib2 -> google-api-python-client

Notify maintainers

@fabaff -- not listed in maintainers but recently worked on pyromas nixpkgs expression.

Metadata

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.60, NixOS, 21.05.2680.871e8c4d585 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre20210802_47e96bb`
 - channels(root): `"nixos-21.05.2796.110a2c9ebbf"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: python37.pkgs.pyroma
# a list of nixos modules affected by the problem
module: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/pyroma/default.nix
fabaff commented 3 years ago

Works for me with 3.9 on master.

...gs]$ nix-build -A python3Packages.pyroma --check
checking outputs of '/nix/store/p6lfp2xxq3g7w01p07kx033b7pn9jv1j-python3.9-pyroma-3.2.drv'...
[...]
================= 9 passed, 2 deselected, 2 warnings in 0.61s ==================
Finished executing pytestCheckPhase
pytestcachePhase
/nix/store/zf8m6v0lf8vinw6bfjx8dczxwd3xm906-python3.9-pyroma-3.2

3.7 fails indeed:

gs]$ nix-build -A python37Packages.pyroma
these derivations will be built:
  /nix/store/a728y6cc68cllh37qkhwiaxzhja0d6c5-python3.7-pyroma-3.2.drv
[...]
Executing pytestCheckPhase
============================= test session starts ==============================
platform linux -- Python 3.7.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /build/source
collecting ... Fatal Python error: Segmentation fault

Current thread 0x00007ffff786d340 (most recent call first):
  File "/build/source/pyroma/tests.py", line 91 in __getattr__
  File "/build/source/pyroma/tests.py", line 91 in __getattr__
[...]
  File "/build/source/pyroma/tests.py", line 91 in __getattr__
  ...
/nix/store/n5dhgplgxawrh6bszhx8yflf1qb0wkrd-pytest-check-hook/nix-support/setup-hook: line 53:   183 Segmentation fault      (core dumped) /nix/store/4z7d194syfyp4ghacl4fbd61q4a13kyn-python3-3.7.11/bin/python3.7 -m pytest -k "not PyPITest" pyroma/tests.py
builder for '/nix/store/a728y6cc68cllh37qkhwiaxzhja0d6c5-python3.7-pyroma-3.2.drv' failed with exit code 139
error: build of '/nix/store/a728y6cc68cllh37qkhwiaxzhja0d6c5-python3.7-pyroma-3.2.drv' failed

Disable the tests for Python < 3.8 would be one solution. Upstream claims that there is support for Python > 3.6.

Upstream report: https://github.com/regebro/pyroma/issues/65

rmcgibbo commented 3 years ago

FWIW, I bisected this to b86f54b571dc29bd491daeb23aafef18c3e60a94 (which, not surprisingly, was the first commit to enable the test suite for this package).

rmcgibbo commented 3 years ago

I believe the issue is https://nedbatchelder.com/blog/201010/surprising_getattr_recursion.html, and also https://bugs.python.org/issue41909. I opened https://github.com/regebro/pyroma/pull/66 which fixes it.

fabaff commented 2 years ago

I enabled the tests but unfortunately I didn't test it with Python 3.7.

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info