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

Fix crash when passing a very long cmdline argument #11404

Merged
merged 2 commits into from
Sep 7, 2023

Conversation

nicoddemus
Copy link
Member

Fixes #11394

@@ -262,3 +262,27 @@ def test(fix):
"* 1 passed in *",
]
)


def test_very_long_cmdline_arg(pytester: Pytester) -> None:
Copy link
Member Author

@nicoddemus nicoddemus Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iandonnelly I'm having trouble reproducing the original problem, this test is passing on all platforms.

Any hints?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its possibly related to available file-systems/path types (i believe the github runners always use unc/long paths)

would it break when using a path thats not supported on all platforms (i believe >64k)

Copy link
Member Author

@nicoddemus nicoddemus Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm thanks for the hint, trying now with a very large path (>100k), let's see.

Copy link
Member Author

@nicoddemus nicoddemus Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw anybody on linux can test this please?

>>> import errno
>>> errno.ENAMETOOLONG
38

The above is on Windows; on the original report, the errno was 36 on Linux, want to confirm that's ENAMETOOLONG is indeed 36.

EDIT: nevermind, just confirmed it is indeed 36 on Linux.

Copy link
Member Author

@nicoddemus nicoddemus Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm no good using >100k filenames, the test still passes.

I guess we can rely on patching then to ensure the behavior...

@nicoddemus nicoddemus marked this pull request as ready for review September 7, 2023 13:52
@nicoddemus
Copy link
Member Author

Ready for review -- any suggestions on how to improve the approach taken here are appreciated.

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is a special kind of icky 😮‍💨

@nicoddemus nicoddemus merged commit 28ccf47 into pytest-dev:main Sep 7, 2023
22 checks passed
@nicoddemus nicoddemus deleted the 11394-long-cmdline branch September 7, 2023 15:49
nicoddemus added a commit to nicoddemus/pytest that referenced this pull request Sep 7, 2023
nicoddemus added a commit that referenced this pull request Sep 7, 2023
[7.4.x] Fix crash when passing a very long cmdline argument (#11404)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pytest Fails to Run When Passing Long Command Line Arguments
2 participants