GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Windows with_rw-directory TC helper fails to delete repos · Issue #32 · gitpython-developers/gitdb

This repository was archived by the owner on Jul 26, 2026. It is now read-only.
This repository was archived by the owner on Jul 26, 2026. It is now read-only.

Windows with_rw-directory TC helper fails to delete repos #32

Copy link
Copy link
Open
Open
Windows with_rw-directory TC helper fails to delete repos#32
Copy link
Labels
acknowledgedtag.leaks

Description

@ankostis
ankostis
opened on Sep 27, 2016
Issue body actions

On Windows, os.rmtree cannot not remove directories with read-only files; such are the git db directories.

The fix is something like this:

           ...
        finally:
            # Need to collect here to be sure all handles have been closed. It appears
            # a windows-only issue. In fact things should be deleted, as well as
            # memory maps closed, once objects go out of scope. For some reason
            # though this is not the case here unless we collect explicitly.
            if not keep:
                gc.collect()

                # From http://stackoverflow.com/a/4829285/548792
                def on_rm_error(func, path, exc_info):
                    import stat
                    os.chmod(path, stat.S_IWRITE)
                    func(path)

                shutil.rmtree(path, onerror=on_rm_error)

Activity

  1. Byron
    added
    acknowledged
    on Oct 1, 2016
  2. Byron commented on Oct 1, 2016

    @Byron
    Byron
    on Oct 1, 2016
    Member
    More actions

    I assume that this one could be fixed in conjunction with this PR ?
    In any case, thanks for reporting, it's good to keep track of the issue and a possible solution.

  3. ankostis
    added
    tag.leaks
    on Oct 27, 2016
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

    acknowledgedtag.leaks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.