-
Notifications
You must be signed in to change notification settings - Fork 84
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
Improve Windows support #248
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows will throw ValueError and not OSError if the path is too long pathobj = WindowsPath('{"compilation_units": {"/home/monty/tob/tools/slither/tests/ast-parsing/function-0.6.0.sol": {"compiler":...unction abstractFunc2() public virtual override(C6) {}/n function abstractFunc3() public virtual override {}/n}"}}') args = () @functools.wraps(strfunc) def wrapped(pathobj, *args): > return strfunc(str(pathobj), *args) E ValueError: stat: path too long for Windows c:\hostedtoolcache\windows\python\3.6.8\x64\lib\pathlib.py:387: ValueError
Windows may throw an exception if the path is too long, which is the case when the string is not really a path. Catch it and try decoding the JSON in that case.
Some of the command executions could fail on Windows with errors such as the following: FileNotFoundError: [WinError 2] The system cannot find the file specified This is because the program name used in the command (e.g. "npm") is unqualified, and PATH lookup is not performed on Windows when `shell=False` is used. We can avoid this problem by converting the executable name to a fully-qualified path by using `shutil.which` and passing it as `executable` on the `Popen` call.
When looking up full paths, Windows-style paths may show up, but standardize on using POSIX-style paths for everything else.
These were introduced in bb594de ("upgrade pylint and black for super-linter v4") and currently break Slither's tests, which expect a certain output.
It is currently broken, and tries to pull a repository via git:// which GH Actions now blocks.
Is this still a draft? It might be nice to merge this so we can depend on master here crytic/slither#1137 |
@0xalpharush undrafted and ready for review 👍 |
0xalpharush
approved these changes
Mar 23, 2022
This was referenced Mar 30, 2022
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to improve Windows support on crytic-compile: