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

shutil.move(): Add ability to use custom copy function to allow to ignore metadata #64039

Closed
desbma mannequin opened this issue Nov 30, 2013 · 8 comments
Closed

shutil.move(): Add ability to use custom copy function to allow to ignore metadata #64039

desbma mannequin opened this issue Nov 30, 2013 · 8 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@desbma
Copy link
Mannequin

desbma mannequin commented Nov 30, 2013

BPO 19840
Nosy @bitdancer, @PCManticore, @desbma
Files
  • shutil.patch
  • issue19840.patch: Fix trailing whitespaces.
  • issue19840_1.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2014-06-11.18:41:21.738>
    created_at = <Date 2013-11-30.13:05:40.134>
    labels = ['type-feature', 'library']
    title = 'shutil.move(): Add ability to use custom copy function to allow to ignore metadata'
    updated_at = <Date 2014-06-11.18:41:21.736>
    user = 'https://github.com/desbma'

    bugs.python.org fields:

    activity = <Date 2014-06-11.18:41:21.736>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-06-11.18:41:21.738>
    closer = 'r.david.murray'
    components = ['Library (Lib)']
    creation = <Date 2013-11-30.13:05:40.134>
    creator = 'desbma'
    dependencies = []
    files = ['32917', '34447', '35554']
    hgrepos = []
    issue_num = 19840
    keywords = ['patch']
    message_count = 8.0
    messages = ['204807', '204835', '204891', '220142', '220166', '220170', '220296', '220297']
    nosy_count = 5.0
    nosy_names = ['Arfrever', 'r.david.murray', 'Claudiu.Popa', 'python-dev', 'desbma']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19840'
    versions = ['Python 3.5']

    @desbma
    Copy link
    Mannequin Author

    desbma mannequin commented Nov 30, 2013

    shutil.move sometimes fail when the underlining filesystem has limitations.

    Here is a part of a stacktrace I'm getting :

    File "/usr/local/lib/python3.3/shutil.py", line 534, in move
    copy2(src, real_dst)
    File "/usr/local/lib/python3.3/shutil.py", line 244, in copy2
    copystat(src, dst, follow_symlinks=follow_symlinks)
    File "/usr/local/lib/python3.3/shutil.py", line 192, in copystat
    lookup("chmod")(dst, mode, follow_symlinks=follow)
    OSError: [Errno 38]

    This behaviour is expected because shutil.move uses shutil.copy2 under the hood to copy file data and metadata.

    However there is no way to tell shutil.move to use shutil.copy and to ignore metadata.

    Maybe a new copy_metadata parameter (defaulting to True) or copy_function (like in shutil.copytree) would be an elegant solution?

    @desbma desbma mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 30, 2013
    @bitdancer
    Copy link
    Member

    bitdancer commented Nov 30, 2013

    Note that the equivalent linux command generates a warning message but does the move anyway. In other words, this seems like a very reasonable request ;)

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Dec 1, 2013

    Hi. Here's a patch which adds copy_function parameter to shutil.move.

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Jun 10, 2014

    Any type of feedback will be appreciated.

    @bitdancer
    Copy link
    Member

    bitdancer commented Jun 10, 2014

    Review comments added. Patch looks good after the doc fixes. We also need a whatsnew entry.

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Jun 10, 2014

    Thanks, David. The new version of the patch is attached.

    @Arfrever Arfrever mannequin changed the title The is no way to tell shutil.move to ignore metadata shutil.move(): Add ability to use custom copy function to allow to ignore metadata Jun 10, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 11, 2014

    New changeset 0d61a2a50f9f by R David Murray in branch 'default':
    bpo-19840: Add copy_function to shutil.move.
    http://hg.python.org/cpython/rev/0d61a2a50f9f

    @bitdancer
    Copy link
    Member

    bitdancer commented Jun 11, 2014

    Thanks, Claudiu.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant