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

Fix temporary file permission issue in LogReport #4528

Merged
merged 4 commits into from Mar 29, 2018

Conversation

niboshi
Copy link
Member

@niboshi niboshi commented Mar 26, 2018

Fixed the same issue as #4461.
This kind of use of temporary directory is very common, so I made a context manager as utils.tempdir(), and applied to all such instances.

@niboshi niboshi force-pushed the tempfile-permission-log-report branch from fa9b4b3 to 6ca4514 Compare March 26, 2018 14:39
@okuta okuta self-assigned this Mar 27, 2018
@okuta okuta added cat:enhancement Implementation that does not break interfaces. to-be-backported Pull request that should be backported. st:test-and-merge State indicating that pull request is approved by a reviewer and can be merged after CI passes. labels Mar 27, 2018
@okuta okuta added this to the v5.0.0a1 milestone Mar 27, 2018
@okuta
Copy link
Member

okuta commented Mar 27, 2018

LGTM!

try:
yield temp_dir
finally:
shutil.rmtree(temp_dir, ignore_errors=True)
Copy link
Member

Choose a reason for hiding this comment

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

Is it safe to ignore errors? (c.f. tempfile.TemporaryDirectory raise error when failure of cleanup: https://github.com/python/cpython/blob/3.6/Lib/tempfile.py#L777-L811)

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree.
I made it optional and False by default.

@kmaehashi
Copy link
Member

LGTM!

@okuta Test passed. Could you merge?

@okuta okuta merged commit 74f2042 into chainer:master Mar 29, 2018
@niboshi niboshi deleted the tempfile-permission-log-report branch March 30, 2018 00:46
kmaehashi pushed a commit to kmaehashi/chainer that referenced this pull request Apr 17, 2018
…report

Fix temporary file permission issue in LogReport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:enhancement Implementation that does not break interfaces. st:test-and-merge State indicating that pull request is approved by a reviewer and can be merged after CI passes. to-be-backported Pull request that should be backported.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants