Skip to content

shutil.copytree() should use os.lutimes() to copy the metadata of symlinks #56911

Closed

Description

@akheron
BPO 12702
Nosy @orsenthil, @ned-deily, @akheron, @berkerpeksag
Dependencies
  • bpo-12715: Add symlink support to shutil functions
  • Superseder
  • bpo-12715: Add symlink support to shutil functions
  • 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 2012-02-22.20:08:56.458>
    created_at = <Date 2011-08-06.06:42:47.747>
    labels = ['easy', 'type-bug', 'library']
    title = 'shutil.copytree() should use os.lutimes() to copy the metadata of symlinks'
    updated_at = <Date 2012-02-22.20:08:56.457>
    user = 'https://github.com/akheron'

    bugs.python.org fields:

    activity = <Date 2012-02-22.20:08:56.457>
    actor = 'petri.lehtinen'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-02-22.20:08:56.458>
    closer = 'petri.lehtinen'
    components = ['Library (Lib)']
    creation = <Date 2011-08-06.06:42:47.747>
    creator = 'petri.lehtinen'
    dependencies = ['12715']
    files = []
    hgrepos = []
    issue_num = 12702
    keywords = ['easy']
    message_count = 5.0
    messages = ['141712', '141729', '141814', '153731', '153985']
    nosy_count = 5.0
    nosy_names = ['orsenthil', 'ned.deily', 'rosslagerwall', 'petri.lehtinen', 'berker.peksag']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '12715'
    type = 'behavior'
    url = 'https://bugs.python.org/issue12702'
    versions = ['Python 3.3']

    Activity

    1. akheron commented on Aug 6, 2011

      @akheron
      MemberAuthor

      As discussed in bpo-12183, shutil.copytree(..., symlinks=True) should copy the metadata of symlinks instead of the metadata of the file that the symlink refers to.

      This can be achieved by using os.lstat() and os.lutimes() (new in 3.3) on symlinks.

    2. added
      stdlib
      type-bug
      on Aug 6, 2011
    3. ned-deily commented on Aug 6, 2011

      @ned-deily
      Member

      Keep in mind that os.lutimes() may not be available on the platform so the patch will need to test for that.

    4. akheron commented on Aug 9, 2011

      @akheron
      MemberAuthor

      Added bpo-12715 as a dependency for this issue, as shutil.copy2(src, dst, symlinks=True) would be an obvious way to implement this.

    5. berkerpeksag commented on Feb 19, 2012

      @berkerpeksag
      Member

      I think this issue fixed in changeset 74194:cf57ef65bcd0.

      See: http://hg.python.org/cpython/rev/cf57ef65bcd0#l2.75

    6. akheron commented on Feb 22, 2012

      @akheron
      MemberAuthor

      Yeah. Seems that fixing bpo-12715 automatically also fixed this, so closing as duplicate.

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      easystdlibtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions