Skip to content

Fix directory move into itself and prevent more fs changes when read-only #1645

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

Merged
merged 3 commits into from
Mar 14, 2019

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented Mar 13, 2019

No description provided.

@tannewt
Copy link
Member Author

tannewt commented Mar 13, 2019

Here is the code I tested with:

import os
try:
    os.rmdir("/tmp/bar")
except OSError:
    pass
try:
    os.rmdir("/tmp/barfoo")
except OSError:
    pass
try:
    os.mkdir("/tmp")
except OSError:
    pass
try:
    os.mkdir("/tmp/foo")
except OSError:
    pass
print(os.listdir("/tmp"))
try:
    os.rename("/tmp/foo", "/tmp/foo/bar")
except OSError as e:
    print(e)
print(os.listdir("/tmp"))
os.rename("/tmp/foo", "/tmp/bar")
print(os.listdir("/tmp"))
os.rename("/tmp/bar", "/tmp/barfoo")
print(os.listdir("/tmp"))
os.rename("/tmp/barfoo", "/tmp/barfoo/hello/world")
print(os.listdir("/tmp"))

@tannewt tannewt force-pushed the fix_directory_move branch from 0d80cf0 to e05ab64 Compare March 14, 2019 00:20
@tannewt tannewt requested a review from dhalbert March 14, 2019 01:04
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Looks good! i2cslave is still on for M0 Express boards, so you could turn it off to make more room next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cpython api modules from cpython
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants