Skip to content

bpo-30088: Document that existing dir structure isn't verified by mailbox.Maildir #1163

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

Conversation

webknjaz
Copy link
Contributor

@webknjaz webknjaz commented Apr 16, 2017

Hi,

I've faced an issue w/ mailbox.Maildir(). The case is following:

  1. I create a folder with tempfile.TemporaryDirectory(), so it's empty
  2. I pass that folder path as an argument when instantiating mailbox.Maildir()
  3. Then I receive an exception happening because "there's no such file or directory" (namely cur, tmp or new) during interaction with Maildir

Expected result: subdirs are created during Maildir() instance creation.

Actual result: subdirs are assumed as existing which leads to exceptions during use.

Workaround: remove the actual dir before passing the path to Maildir(). It will be created automatically with all subdirs needed.

Fix: This PR. Basically it adds creation of subdirs regardless of whether the base dir existed before.

https://bugs.python.org/issue30088

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@webknjaz webknjaz changed the title [bug] Fix creation of dir structure in mailbox.Maildir (when create=True) [trivial] [bug] Fix creation of dir structure in mailbox.Maildir (when create=True) Apr 16, 2017
@webknjaz
Copy link
Contributor Author

@the-knights-who-say-ni I've signed it, it just hasn't got checked yet.

@serhiy-storchaka
Copy link
Member

Please open an issue on the bug tracker for discussion and sign the CLA. This isn't trivial PR like fixing a typo.

@webknjaz webknjaz changed the title [trivial] [bug] Fix creation of dir structure in mailbox.Maildir (when create=True) bpo-30088 [bug] Fix creation of dir structure in mailbox.Maildir (when create=True) Apr 17, 2017
@webknjaz
Copy link
Contributor Author

@serhiy-storchaka http://bugs.python.org/issue30088

Plz revisit this PR in 1 US business day (I think). The doc says that the CLA is checked manually.

@louisom
Copy link
Contributor

louisom commented Apr 17, 2017

@webknjaz a small point that the title should be bpo-30088: Fix creation of....

@webknjaz webknjaz changed the title bpo-30088 [bug] Fix creation of dir structure in mailbox.Maildir (when create=True) bpo-30088: Fix creation of dir structure in mailbox.Maildir (when create=True) Apr 17, 2017
@webknjaz
Copy link
Contributor Author

(CLA signed: http://bugs.python.org/user17410)

@serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Dec 8, 2018
@csabella
Copy link
Contributor

csabella commented Jul 3, 2019

cc @maxking

@maxking
Copy link
Contributor

maxking commented Jul 4, 2019

From the conversation on BPO, it seems like this is wrong behaviour and if we are operating on a directory expecting it to be a Maildir, it should already have subdirectories created. And I agree with the reasoning.

If there is a more specific Doc change that needs to be made to make the current behaviour more easy to understand, that can be a separate PR.

@csabella I think we can close the PR and maybe the associated Issue.

@webknjaz webknjaz force-pushed the bugfix/mailbox-maildir-create-dir-structure branch from e2059dc to f7aa474 Compare July 13, 2019 12:37
@webknjaz webknjaz requested a review from a team as a code owner July 13, 2019 12:37
@webknjaz webknjaz changed the title bpo-30088: Fix creation of dir structure in mailbox.Maildir (when create=True) bpo-30088: Document that existing dir structure isn't verified by mailbox.Maildir Jul 13, 2019
@webknjaz
Copy link
Contributor Author

@maxking hi, i've tried to do the suggested docs clarification on this.

@miss-islington
Copy link
Contributor

Thanks @webknjaz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 13, 2019
…lbox.Maildir (pythonGH-1163)

Hi,

I've faced an issue w/ `mailbox.Maildir()`. The case is following:
1. I create a folder with `tempfile.TemporaryDirectory()`, so it's empty
2. I pass that folder path as an argument when instantiating `mailbox.Maildir()`
3. Then I receive an exception happening because "there's no such file or directory" (namely `cur`, `tmp` or `new`) during interaction with Maildir

**Expected result:** subdirs are created during `Maildir()` instance creation.

**Actual result:** subdirs are assumed as existing which leads to exceptions during use.

**Workaround:** remove the actual dir before passing the path to `Maildir()`. It will be created automatically with all subdirs needed.

**Fix:** This PR. Basically it adds creation of subdirs regardless of whether the base dir existed before.

https://bugs.python.org/issue30088
(cherry picked from commit e441847)

Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
@bedevere-bot
Copy link

GH-14749 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 13, 2019
…lbox.Maildir (pythonGH-1163)

Hi,

I've faced an issue w/ `mailbox.Maildir()`. The case is following:
1. I create a folder with `tempfile.TemporaryDirectory()`, so it's empty
2. I pass that folder path as an argument when instantiating `mailbox.Maildir()`
3. Then I receive an exception happening because "there's no such file or directory" (namely `cur`, `tmp` or `new`) during interaction with Maildir

**Expected result:** subdirs are created during `Maildir()` instance creation.

**Actual result:** subdirs are assumed as existing which leads to exceptions during use.

**Workaround:** remove the actual dir before passing the path to `Maildir()`. It will be created automatically with all subdirs needed.

**Fix:** This PR. Basically it adds creation of subdirs regardless of whether the base dir existed before.

https://bugs.python.org/issue30088
(cherry picked from commit e441847)

Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
@bedevere-bot
Copy link

GH-14750 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Jul 13, 2019
…lbox.Maildir (GH-1163)

Hi,

I've faced an issue w/ `mailbox.Maildir()`. The case is following:
1. I create a folder with `tempfile.TemporaryDirectory()`, so it's empty
2. I pass that folder path as an argument when instantiating `mailbox.Maildir()`
3. Then I receive an exception happening because "there's no such file or directory" (namely `cur`, `tmp` or `new`) during interaction with Maildir

**Expected result:** subdirs are created during `Maildir()` instance creation.

**Actual result:** subdirs are assumed as existing which leads to exceptions during use.

**Workaround:** remove the actual dir before passing the path to `Maildir()`. It will be created automatically with all subdirs needed.

**Fix:** This PR. Basically it adds creation of subdirs regardless of whether the base dir existed before.

https://bugs.python.org/issue30088
(cherry picked from commit e441847)

Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
miss-islington added a commit that referenced this pull request Jul 13, 2019
…lbox.Maildir (GH-1163)

Hi,

I've faced an issue w/ `mailbox.Maildir()`. The case is following:
1. I create a folder with `tempfile.TemporaryDirectory()`, so it's empty
2. I pass that folder path as an argument when instantiating `mailbox.Maildir()`
3. Then I receive an exception happening because "there's no such file or directory" (namely `cur`, `tmp` or `new`) during interaction with Maildir

**Expected result:** subdirs are created during `Maildir()` instance creation.

**Actual result:** subdirs are assumed as existing which leads to exceptions during use.

**Workaround:** remove the actual dir before passing the path to `Maildir()`. It will be created automatically with all subdirs needed.

**Fix:** This PR. Basically it adds creation of subdirs regardless of whether the base dir existed before.

https://bugs.python.org/issue30088
(cherry picked from commit e441847)

Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
…lbox.Maildir (pythonGH-1163)

Hi,

I've faced an issue w/ `mailbox.Maildir()`. The case is following:
1. I create a folder with `tempfile.TemporaryDirectory()`, so it's empty
2. I pass that folder path as an argument when instantiating `mailbox.Maildir()`
3. Then I receive an exception happening because "there's no such file or directory" (namely `cur`, `tmp` or `new`) during interaction with Maildir

**Expected result:** subdirs are created during `Maildir()` instance creation.

**Actual result:** subdirs are assumed as existing which leads to exceptions during use.

**Workaround:** remove the actual dir before passing the path to `Maildir()`. It will be created automatically with all subdirs needed.

**Fix:** This PR. Basically it adds creation of subdirs regardless of whether the base dir existed before.


https://bugs.python.org/issue30088
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
…lbox.Maildir (pythonGH-1163)

Hi,

I've faced an issue w/ `mailbox.Maildir()`. The case is following:
1. I create a folder with `tempfile.TemporaryDirectory()`, so it's empty
2. I pass that folder path as an argument when instantiating `mailbox.Maildir()`
3. Then I receive an exception happening because "there's no such file or directory" (namely `cur`, `tmp` or `new`) during interaction with Maildir

**Expected result:** subdirs are created during `Maildir()` instance creation.

**Actual result:** subdirs are assumed as existing which leads to exceptions during use.

**Workaround:** remove the actual dir before passing the path to `Maildir()`. It will be created automatically with all subdirs needed.

**Fix:** This PR. Basically it adds creation of subdirs regardless of whether the base dir existed before.


https://bugs.python.org/issue30088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants