Skip to content

mv() rejects a prefix-only source that it would skip #1397

Open

Description

@laughingman7743

Problem

mv() rejects a move with a prefix-only source that it would skip. With the keys dir/a and x in bucket (no object at dir), at d03e034:

fs.mv(["s3://bucket/dir", "s3://bucket/x"], ["s3://bucket/x", "s3://bucket/y"])
# ValueError: Cannot move a path onto another path that is moved.

dir has no object at its key, so the move would skip it and move x to y. copy() with the same pairs does that since #1344.

Cause

S3PathPairing.conflict_candidates() (s3_path_pairing.py:143) returns, for a move, only the sources that have another source below them in the pairs. Only those are looked up, so a prefix given in a list without its keys is treated as an object, and its destination x conflicts with the source x. For a copy, #1344 made every conflicting source without a version a candidate (copy=True), so the lookup finds that dir is not an object and the pair is skipped.

AioS3FileSystem._mv() pairs its paths with S3FileSystem._move_pairs() and has the same behavior.

Open questions

Context

Found in #1344 (step 4a of #1332); predates it.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions