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

Better UX error for migrations #7966

Merged
merged 11 commits into from Oct 29, 2020

Conversation

uilianries
Copy link
Member

@uilianries uilianries commented Oct 28, 2020

I didn't find specific test file only related to Migrator or ClientMigrator, so I created an unit test to validate the current error message.

This change should affect more tests, as now save raises an error. Let's see ...

Changelog: Fix: Improve permission error message when migrating cache folder.
Docs: Omit

Related to #7948

/cc @ngrodzitski @memsharded

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
conans/util/files.py Outdated Show resolved Hide resolved
Signed-off-by: Uilian Ries <uilianries@gmail.com>
conans/util/files.py Outdated Show resolved Hide resolved
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries uilianries closed this Oct 28, 2020
@uilianries uilianries reopened this Oct 28, 2020
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries uilianries closed this Oct 28, 2020
@uilianries uilianries reopened this Oct 28, 2020
@memsharded memsharded added this to the 1.31 milestone Oct 29, 2020
conans/util/files.py Outdated Show resolved Hide resolved
conans/migrations.py Outdated Show resolved Hide resolved
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
conans/util/files.py Outdated Show resolved Hide resolved
conans/util/files.py Outdated Show resolved Hide resolved
conans/util/files.py Outdated Show resolved Hide resolved
conans/util/files.py Outdated Show resolved Hide resolved
Signed-off-by: Uilian Ries <uilianries@gmail.com>
There is a note on chmod docs:
https://docs.python.org/2.7/library/os.html#os.chmod

"Although Windows supports chmod(), you can only set the file’s
read-only flag with it (via the stat.S_IWRITE and stat.S_IREAD constants
or a corresponding integer value). All other bits are ignored."

However, it works for files, not for folder.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries
Copy link
Member Author

uilianries commented Oct 29, 2020

I skipped Windows test because os.chmod has no effect under Windows folders, I would need other libraries, like pywin32 or oschmod.

The documentation is clear about Windows support: https://docs.python.org/2.7/library/os.html#os.chmod

Although Windows supports chmod(), you can only set the file’s read-only flag with it (via the stat.S_IWRITE and stat.S_IREAD constants or a corresponding integer value). All other bits are ignored.

It works for file only ...

For some reason, if I inject os.stat() before calling os.makedirs() it works, but I won't change save() only because a single test.

I also tried subprocess call with attrib +R dir_path /D but had no effect.

@memsharded memsharded merged commit c7f6749 into conan-io:develop Oct 29, 2020
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

2 participants