Deleting an "empty folder" object causes files under the same prefix to be deleted erroneously
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 208
- PR merge metrics
- No merged PRs in 30d
Description
Reproduce this issue as follows (replace BUCKETNAME).
```
> touch tmp.txt
> s4cmd put tmp.txt "s3://BUCKETNAME/bugcheck/" # create an empty directory marker
> s4cmd put tmp.txt s3://BUCKETNAME/bugcheck/file # create any file under that path
# ls shows both an empty directory file and a file under that path
> s4cmd ls s3://BUCKETNAME/bugcheck
2021-03-31 19:41 0 s3://BUCKETNAME/bugcheck/
2021-03-31 19:41 0 s3://BUCKETNAME/bugcheck/file
# delete just the empty directory marker (no recursive options set), we DON'T want to delete `file`, but both are deleted
> s4cmd del "s3://BUCKETNAME/bugcheck/"
Delete s3://BUCKETNAME/bugcheck/
Delete s3://BUCKETNAME/bugcheck/file
```
In the example above only the object `s3://BUCKETNAME/bugcheck/` should be deleted, but `s3://BUCKETNAME/bugcheck/file` gets deleted as well unexpectedly.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the behavior with the documented s4cmd put, ls, and del commands, using an empty directory marker and a file under the same prefix. Trace the s4cmd del entry point to determine why deleting the marker also selects the child object. Done means deleting the marker alone leaves the file intact, without recursive options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100