Skip to content

python27Packages.scandir: test failures on aarch64-darwin #156807

Closed

Description

@abathur

I noticed ofborg was failing to build resholve (which has no short-run path off of python27) on aarch64-darwin due to test failures in scandir.

I don't expect there to be much enthusiasm for the exact failure here, but I'm reporting it in case the root cause is meaningful...

Describe the bug

On aarch64-darwin, 1 scandir test errors and 5 fail as follows:
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing setuptools-check-hook
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/s0l2vkcm04z0r64ia0xh6cn91ly8xiwr-scandir-1.10.0.tar.gz
source root is scandir-1.10.0
setting SOURCE_DATE_EPOCH to timestamp 1552154153 of file scandir-1.10.0/setup.cfg
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Executing setuptoolsBuildPhase
/nix/store/7nv2sjvzxccfvrca2a9i0axxhm9y3zxp-python-2.7.18/lib/python2.7/distutils/extension.py:133: UserWarning: Unknown Extension options: 'optional'
  warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11.0-arm64-2.7
copying scandir.py -> build/lib.macosx-11.0-arm64-2.7
running build_ext
building '_scandir' extension
creating build/temp.macosx-11.0-arm64-2.7
clang -I/nix/store/7nv2sjvzxccfvrca2a9i0axxhm9y3zxp-python-2.7.18/include/python2.7 -c _scandir.c -o build/temp.macosx-11.0-arm64-2.7/_scandir.o
clang -bundle -undefined dynamic_lookup build/temp.macosx-11.0-arm64-2.7/_scandir.o -L/nix/store/7nv2sjvzxccfvrca2a9i0axxhm9y3zxp-python-2.7.18/lib -o build/lib.macosx-11.0-arm64-2.7/_scandir.so
installing to build/bdist.macosx-11.0-arm64/wheel
running install
running install_lib
creating build/bdist.macosx-11.0-arm64
creating build/bdist.macosx-11.0-arm64/wheel
copying build/lib.macosx-11.0-arm64-2.7/_scandir.so -> build/bdist.macosx-11.0-arm64/wheel
copying build/lib.macosx-11.0-arm64-2.7/scandir.py -> build/bdist.macosx-11.0-arm64/wheel
running install_egg_info
running egg_info
writing scandir.egg-info/PKG-INFO
writing top-level names to scandir.egg-info/top_level.txt
writing dependency_links to scandir.egg-info/dependency_links.txt
reading manifest file 'scandir.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'scandir.egg-info/SOURCES.txt'
Copying scandir.egg-info to build/bdist.macosx-11.0-arm64/wheel/scandir-1.10.0-py2.7.egg-info
running install_scripts
adding license file "LICENSE.txt" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-11.0-arm64/wheel/scandir-1.10.0.dist-info/WHEEL
creating 'dist/scandir-1.10.0-cp27-cp27mu-macosx_11_0_arm64.whl' and adding 'build/bdist.macosx-11.0-arm64/wheel' to it
adding '_scandir.so'
adding 'scandir.py'
adding 'scandir-1.10.0.dist-info/LICENSE.txt'
adding 'scandir-1.10.0.dist-info/METADATA'
adding 'scandir-1.10.0.dist-info/WHEEL'
adding 'scandir-1.10.0.dist-info/top_level.txt'
adding 'scandir-1.10.0.dist-info/RECORD'
removing build/bdist.macosx-11.0-arm64/wheel
Finished executing setuptoolsBuildPhase
@nix { "action": "setPhase", "phase": "installPhase" }
installing
Executing pipInstallPhase
/private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0/dist /private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0
�[33mDEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.�[0m
Processing ./scandir-1.10.0-cp27-cp27mu-macosx_11_0_arm64.whl
Installing collected packages: scandir
Successfully installed scandir-1.10.0
/private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0
Finished executing pipInstallPhase
@nix { "action": "setPhase", "phase": "fixupPhase" }
post-installation fixup
strip is /nix/store/ljxsc2chsz0qr6318mpnwhc3cagcfck7-clang-wrapper-11.1.0/bin/strip
stripping (with command strip and flags -S) in /nix/store/p5dfng0h9gaji94fvhlpbr2bnfv92kgq-python2.7-scandir-1.10.0/lib 
patching script interpreter paths in /nix/store/p5dfng0h9gaji94fvhlpbr2bnfv92kgq-python2.7-scandir-1.10.0
Executing pythonRemoveTestsDir
Finished executing pythonRemoveTestsDir
@nix { "action": "setPhase", "phase": "installCheckPhase" }
running install tests
test_basic (test_scandir.TestScandirC) ... ok
test_bytes (test_scandir.TestScandirC) ... ok
test_dir_entry (test_scandir.TestScandirC) ... ok
test_file_attributes (test_scandir.TestScandirC) ... skipped 'st_file_attributes not supported'
test_path (test_scandir.TestScandirC) ... ok
test_returns_iter (test_scandir.TestScandirC) ... ok
test_stat (test_scandir.TestScandirC) ... ok
test_symlink (test_scandir.TestScandirC) ... ok
test_unicode (test_scandir.TestScandirC) ... ok
test_walk_unicode_handling (test_scandir.TestScandirC) ... ok
test_iter_returns_dir_entry (test_scandir.TestScandirDirEntry) ... ok
test_basic (test_scandir.TestScandirGeneric) ... ok
test_bytes (test_scandir.TestScandirGeneric) ... ok
test_dir_entry (test_scandir.TestScandirGeneric) ... ok
test_file_attributes (test_scandir.TestScandirGeneric) ... skipped 'st_file_attributes not supported'
test_path (test_scandir.TestScandirGeneric) ... ok
test_returns_iter (test_scandir.TestScandirGeneric) ... ok
test_stat (test_scandir.TestScandirGeneric) ... ok
test_symlink (test_scandir.TestScandirGeneric) ... ok
test_unicode (test_scandir.TestScandirGeneric) ... ok
test_walk_unicode_handling (test_scandir.TestScandirGeneric) ... ok
test_basic (test_scandir.TestScandirPython) ... FAIL
test_bytes (test_scandir.TestScandirPython) ... FAIL
test_dir_entry (test_scandir.TestScandirPython) ... ERROR
test_file_attributes (test_scandir.TestScandirPython) ... skipped 'st_file_attributes not supported'
test_path (test_scandir.TestScandirPython) ... FAIL
test_returns_iter (test_scandir.TestScandirPython) ... ok
test_stat (test_scandir.TestScandirPython) ... ok
test_symlink (test_scandir.TestScandirPython) ... FAIL
test_unicode (test_scandir.TestScandirPython) ... FAIL
test_walk_unicode_handling (test_scandir.TestScandirPython) ... ok
test_traversal (test_walk.TestWalk) ... ok
test_symlink_to_directory (test_walk.TestWalkSymlink) ... ok
test_symlink_to_file (test_walk.TestWalkSymlink) ... ok

======================================================================
ERROR: test_dir_entry (test_scandir.TestScandirPython)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0/test/test_scandir.py", line 113, in test_dir_entry
    e = entries['file1.txt']
KeyError: u'file1.txt'

======================================================================
FAIL: test_basic (test_scandir.TestScandirPython)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0/test/test_scandir.py", line 107, in test_basic
    ('linkdir', True), ('subdir', True)])
AssertionError: Lists differ: [(u'', True), (u'', True), (u'... != [(u'file1.txt', False), (u'fil...

First differing element 0:
(u'', True)
(u'file1.txt', False)

First list contains 2 additional elements.
First extra element 4:
(u'', True)

- [(u'', True), (u'', True), (u'', True), (u'', True), (u'', True), (u'', True)]
+ [(u'file1.txt', False),
+  (u'file2.txt', False),
+  (u'linkdir', True),
+  (u'subdir', True)]

======================================================================
FAIL: test_bytes (test_scandir.TestScandirPython)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0/test/test_scandir.py", line 211, in test_bytes
    self.assertEqual(len(entries), 1)
AssertionError: 0 != 1

======================================================================
FAIL: test_path (test_scandir.TestScandirPython)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0/test/test_scandir.py", line 168, in test_path
    ['file1.txt', 'file2.txt', 'linkdir', 'subdir'])
AssertionError: Lists differ: [u'', u'', u'', u'', u'', u''] != [u'file1.txt', u'file2.txt', u...

First differing element 0:
u''
u'file1.txt'

First list contains 2 additional elements.
First extra element 4:
u''

- [u'', u'', u'', u'', u'', u'']
+ [u'file1.txt', u'file2.txt', u'linkdir', u'subdir']

======================================================================
FAIL: test_symlink (test_scandir.TestScandirPython)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0/test/test_scandir.py", line 183, in test_symlink
    ('linksubdir', False)])
AssertionError: Lists differ: [(u'', False), (u'', False), (... != [(u'file1.txt', False), (u'lin...

First differing element 0:
(u'', False)
(u'file1.txt', False)

First list contains 2 additional elements.
First extra element 4:
(u'', False)

- [(u'', False),
+ [(u'file1.txt', False),
?     +++++++++

+  (u'link_to_dir', True),
+  (u'link_to_file', True),
+  (u'linksubdir', False)]
-  (u'', False),
-  (u'', False),
-  (u'', False),
-  (u'', False),
-  (u'', False)]

======================================================================
FAIL: test_unicode (test_scandir.TestScandirPython)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/tmp/nix-build-python2.7-scandir-1.10.0.drv-0/scandir-1.10.0/test/test_scandir.py", line 229, in test_unicode
    self.assertEqual(len(entries), 1)
AssertionError: 0 != 1

----------------------------------------------------------------------
Ran 34 tests in 0.012s

FAILED (failures=5, errors=1, skipped=3)

Additional context

I don't see any similar issues upstream. I haven't yet filed anything there (but I do have a tab open to do so, if it sounds like this is intrinsic).

Notify maintainers

@abbradar Just in case you've seen anything like this?

Activity

  1. added
    0.kind: bug
    6.topic: darwin
    on Jan 26, 2022
  2. added
    2.status: stale
    on Jul 31, 2022
  3. abathur commented on Sep 23, 2022

    @abathur
    MemberAuthor

    You'll have to clarify how some arch post closes a nixpkgs issue.

  4. wamserma commented on Sep 23, 2022

    @wamserma
    Member

    @abathur You're right. Now that I've got your attention: Wasn't this closed by #155251
    Granted, the PR is just a workaround, but I don't expect any further work on this.

    I'll leave it up to you to close the issue.

  5. abathur commented on Sep 23, 2022

    @abathur
    MemberAuthor

    Now that I've got your attention:

    Did you fail to reach me some other way? :)

    Wasn't this closed by #155251

    I don't think so, at least. It doesn't affect a ton of packages at this point, but resholve isn't the only one. At minimum, gimp, a bunch of gimp plugins, and monogodb all depend on scandir and are successfully building on x86_64-darwin but not on aarch64-darwin. I haven't tried to confirm why (I don't maintain them and don't have an aarch64-darwin system to directly test this stuff out on yet), but I imagine it's the same cause since the x86 builds work.

    I don't expect any further work on this.

    Certainly possible. I'm not sure if anyone is trying to use gimp or mongodb on aarch64 macs; I've hoped/assumed that as the number of those out in the wild increase that someone who actually has the hardware to pick at this will be affected.

    I'll leave it up to you to close the issue.

    That's fine. I develop a package that depends on it; I won't forget it's here.

  6. stephank commented on Sep 30, 2022

    @stephank
    Contributor

    It looks like this is an upstream bug specific to aarch64-darwin, and not something Nix-specific.

    The library calls opendir/readdir using FFI, and tries to parse a struct dirent. It has some variants for layout defined here: https://github.com/benhoyt/scandir/blob/34a0cc1dd2b8f31d6f8a859db7b287c491f50fd9/scandir.py#L417-L442

    On Darwin, sys/dirent.h defines variants for 32-bit and 64-bit inodes, and it looks like only the 64-bit variant is available on aarch64. This happens via the define of __DARWIN_ONLY_64_BIT_INO_T in sys/cdefs.h. The scandir code always assumes 32-bit on Darwin, though.

  7. abathur commented on Sep 30, 2022

    @abathur
    MemberAuthor

    Ok. I was afraid this might be falling down on a difference between the stdenvs.

    I guess just disabling the tests may be fine if it's only a test dependency (as in my resholve's case), though I imagine it would be causing real misbehavior if it's actually in use at runtime.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug2.status: stale6.topic: darwin

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions