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
Check for UnicodeEncodeError when reading .count-file #3816
Conversation
bf9d8b6
to
0c9005b
Compare
It was not too clever to read the file again if an IOException occurred... I updated the PR! |
conans/util/locks.py
Outdated
@@ -61,6 +61,10 @@ def _readers(self): | |||
try: | |||
return int(load(self._count_file)) | |||
except IOError: | |||
self._output.info("Could not open %s!" % self._count_file) | |||
return 0 | |||
except UnicodeEncodeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about this? The problem when reading something different than an int
is a ValueError
. I wouldn't try to load()
again the contents of the file, if it failed the first time, it will fail again. The UnicodeEncodeError
can come from the load()
not the int()
.
I would be fine with doing an except IOError, UnicodeEncodeError, ValueError
to cover all possible cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I updated the PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I updated the PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated my commit, but the PR didn't update as well. Can you do it or should I open a new one?
Cheers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated my commit, but the PR didn't update as well. Can you do it or should I open a new one?
Cheers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated my commit, but the PR didn't update as well. Can you do it or should I open a new one?
Cheers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated my commit, but the PR didn't update as well. Can you do it or should I open a new one?
Cheers!
@pianoslum it seems Github is having lots of issues, better wait until they solve them and everything goes back to normal. |
@memsharded The windows build fails but I can't see the problem and whether my commit is really the cause of it. |
It doesn't seem related, re-launched CI. |
Merged! I have run manually in the command line, and there is a small issue. Now it prints warnings like: conan install zlib/1.2.11@conan/stable
******************************
Running from source
******************************
Configuration:
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=15
build_type=Release
[options]
[build_requires]
[env]
WARN: C:\Users\memsharded\.conan\data\zlib\1.2.11\conan\stable.count does not contain a number!
zlib/1.2.11@conan/stable: Not found in local cache, looking in remotes...
zlib/1.2.11@conan/stable: Trying with 'conan-center'...
Downloading conanmanifest.txt
[==================================================] 121B/121B
Downloading conanfile.py The case of IOError is also managing the file creation, which is not a warning, but normal thing. Will submit a PR right now :) Thanks again for contributing this! |
Ok, sorry for that and thanks for the help :-) |
Check for UnicodeEncodeError when reading .count-file
Changelog: Fix: Handling corrupted lock files in cache
Fix Conan crash if .count-files consist NULL-character #3815