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

Check for UnicodeEncodeError when reading .count-file #3816

Merged
merged 1 commit into from Oct 24, 2018

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Oct 21, 2018

Changelog: Fix: Handling corrupted lock files in cache

@ghost ghost assigned memsharded Oct 21, 2018
@ghost ghost added the stage: review label Oct 21, 2018
@CLAassistant
Copy link

CLAassistant commented Oct 21, 2018

CLA assistant check
All committers have signed the CLA.

@pianoslum
Copy link
Contributor

It was not too clever to read the file again if an IOException occurred... I updated the PR!

@@ -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:
Copy link
Member Author

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.

Copy link
Contributor

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!

Copy link
Contributor

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!

Copy link
Contributor

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!

Copy link
Contributor

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!

Copy link
Contributor

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!

Copy link
Contributor

@pianoslum pianoslum left a 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!

@memsharded
Copy link
Member Author

@pianoslum it seems Github is having lots of issues, better wait until they solve them and everything goes back to normal.

@pianoslum
Copy link
Contributor

@memsharded The windows build fails but I can't see the problem and whether my commit is really the cause of it.
Could you maybe give me a hint if there is something wrong?

@memsharded
Copy link
Member Author

It doesn't seem related, re-launched CI.

@memsharded memsharded merged commit 4b4d48a into conan-io:develop Oct 24, 2018
@ghost ghost removed the stage: review label Oct 24, 2018
@memsharded
Copy link
Member Author

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!

@pianoslum
Copy link
Contributor

Ok, sorry for that and thanks for the help :-)

grisumbras pushed a commit to grisumbras/conan that referenced this pull request Dec 27, 2018
Check for UnicodeEncodeError when reading .count-file
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.

None yet

3 participants