spotify / snakebite

A pure python HDFS client
Apache License 2.0
856 stars 216 forks source link

mv moves globs to the wrong location when a directory already exists #232

Open daveFNbuck opened 6 years ago

daveFNbuck commented 6 years ago

Script to trigger this:

snakebite rm -R '/tmp/test*'
snakebite mkdir /tmp/test
snakebite mkdir /tmp/test/a
snakebite mkdir /tmp/test_trash
snakebite mkdir /tmp/test_trash/a
snakebite mkdir /tmp/test_trash/a/b
snakebite mv /tmp/test_trash/* /tmp/test
snakebite ls /tmp/test
snakebite ls /tmp/test/a

This fails to move /tmp/test_trash/a to /tmp/test because /tmp/test/aalready exists. Weirdly, it then goes on to successfully move/tmp/test_trash/a/bto /tmp/test/b. If we don't make the /tmp/test/a directory, this works as expected, creating /tmp/test/a/b.