fsspec / fsspec/gcsfs

Calling rm(path, recursive=true) on an empty bucket causes a FileNotFound error

Open
#324 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
398
Forks
181
Avg merge
2d 10h
Merged PRs (30d)
36

Description

What happened:
Upgrading to version 0.7.1 from 0.6.2 i found behaviour had changed where calling remove on a bucket with recursive = true with the below parameters now throws a FileNotFoundError if the bucket is empty, if the bucket contains a file it successfully deletes it, however it also deletes the bucket as well.

path = "bucket_name//"
file_system.rm(path, recursive=true)

What you expected to happen:
In 0.6.2 this did not throw exceptions on empty buckets, and when the bucket contained files it just removed all the files from the bucket but did not delete the bucket.

Minimal Complete Verifiable Example:

# Put your MCVE code here
        import gcsfs
        path = "bucket_name//"
        file_system = gcsfs.GCSFileSystem()
        file_system.rm(path, recursive=True)

Anything else we need to know?:
Realise this might be an intentional change, but i couldn't find anything mentioning it so thought i would check.
Environment:

Exception is not thrown in:

  • Dask version: 0.6.2
  • Python version: 3.6
  • Operating System: docker container
  • Install method (conda, pip, source): pip

Behaviour Changed in:

  • Dask version: 0.7.1
  • Python version: 3.8
  • Operating System: docker container
  • Install method (conda, pip, source): pip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GCSFileSystem.rm entry point and reproduce the issue using the Python MCVE with path "bucket_name//" and recursive=True. Compare behavior for an empty bucket and one containing a file; done means empty buckets no longer raise FileNotFoundError and recursive removal leaves the bucket while removing its files.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.