This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Low.Kian.Seong, Tigger.Level-5, eric.araujo, eric.smith, ezio.melotti, giampaolo.rodola, ncoghlan, orsenthil, pitrou, vstinner
Date 2012-01-07.12:12:36
SpamBayes Score 8.21565e-15
Marked as misclassified No
Message-id <1325938358.16.0.531249909328.issue13033@psf.upfronthosting.co.za>
In-reply-to
Content
I believe the current "check_chown" could be passed by a no-op (since the file will be owned by the current user even *before* the call to chowntree). Testing this properly is actually rather difficult (since the only uid and gid we can rely on are those of the current process).

More significantly, I don't agree with the proposed error handling (i.e. attempting to roll back to the original state). Instead, I think it would be more appropriate to follow the rmtree ignore_errors/onerror style so that uses can either unconditionally ignore errors (including dir listing errors) or else tailor the error handling themselves. Any custom error handling should also cover the actual chown operation, not just directory listing errors inside os.walk.

I think, like walkdir itself, there's enough under the hood here that the idea requires some baking time outside the standard library. How do you feel about migrating this discussion over to the walkdir issue tracker as a higher level API proposal there? (https://bitbucket.org/ncoghlan/walkdir/issues).

I had a couple of other minor comments, although they're largely irrelevant given the more significant comments above:

There's a gratuitous inconsistency in the type-checking for uid/gid (one uses "isinstance(uid, str)", the other "not isinstance(gid, int)". Neither is a particular good check for the "None, integer or string" case anyway. It would be better to just try the following in order:

- "is None"
- operator.index
- _get_uid/gid (as appropriate)

The dict initialisation and error handler definition may as well move inside the if statement.
History
Date User Action Args
2012-01-07 12:12:38ncoghlansetrecipients: + ncoghlan, orsenthil, pitrou, vstinner, eric.smith, giampaolo.rodola, ezio.melotti, eric.araujo, Low.Kian.Seong, Tigger.Level-5
2012-01-07 12:12:38ncoghlansetmessageid: <1325938358.16.0.531249909328.issue13033@psf.upfronthosting.co.za>
2012-01-07 12:12:37ncoghlanlinkissue13033 messages
2012-01-07 12:12:36ncoghlancreate