Windows transform regression with directory renaming

Bug #608096 reported by Martin Packman on 2010-07-21
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
High
Martin Packman

Bug Description

In r5192 the transform code was changed from using os.rename to osutils.rename which boils down to no change on nix, but to _win32_rename to fancy_rename on windows.

This made the following tests no longer pass on windows:
    bt.test_transform.TestFileMover.test_file_mover_rollback
    bt.test_transform.TestTreeTransform.test_rollback_on_directory_clash
    bt.test_transform.TestTreeTransform.test_two_directories_clash
    bt.test_transform.TestTreeTransform.test_two_directories_clash_finalize

The new test added in r5228 also fails:
    bt.test_transform.TestTreeTransform.test_rename_fails

The particular issue seems to be a difference in directory renaming. Given two directories, d1 and d2, rename(d1, d2) behaviour is as follows:

On nix with os.rename:
  d1 replaces d2, unless d2 has contents, in which case ENOTEMPTY is raised

On windows with os.rename
  EEXIST is raised

On windows with osutils._win32_rename:
  d2 is renamed to a temp name, d1 is renamed d2, and os.unlink throws EACCES

Need to never be using _win32_rename with directories, or teach it how to handle them.

Related branches

Martin Packman (gz) on 2010-07-21
Changed in bzr:
importance: Undecided → High
status: New → Confirmed
description: updated
Martin Packman (gz) wrote :

Fixed on the 2.2 branch, will be merged into bzr.dev shortly I imagine.

Changed in bzr:
assignee: nobody → Martin [gz] (gz)
milestone: none → 2.2.0
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers