bug(services/fs): deleting "/" removes the configured root directory
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 81/100
Research direction
Start in core/services/fs/src/deleter.rs, at FsDeleter::delete_once, and check how root_join resolves / before the filesystem removal. Reproduce both cases from the issue: non-recursive deletion on empty and populated roots, and recursive deletion after writing a file. Done means non-recursive root deletion preserves the root and recursive deletion clears its children while preserving the root directory.
Written by the indexing model from the issue text.
Description
Describe the bug
In core/services/fs/src/deleter.rs, FsDeleter::delete_once resolves path via self.core.root_join(&path)? and removes the resulting path directly without checking whether it resolves to self.core.root:
op.delete("/")(non-recursive) on an empty root runstokio::fs::remove_dir(&self.core.root), removing the configured root directory itself from disk (and failing with a directory-not-empty error on a populated root instead of keeping non-recursive root deletion as a safe no-op).op.delete_with("/").recursive(true)(andop.remove_all("/")) runstokio::fs::remove_dir_all(&self.core.root), deleting the configured root directory itself rather than clearing its children.
Steps to Reproduce
let temp_dir = tempfile::tempdir().unwrap();
let root = temp_dir.path().join("root");
let op = Operator::new(Fs::default().root(root.to_str().unwrap())).unwrap();
op.delete("/").await.unwrap();
assert!(root.is_dir()); // fails: configured root directory was removed
let op = Operator::new(Fs::default().root(root.to_str().unwrap())).unwrap();
op.write("file.txt", "hello").await.unwrap();
op.delete_with("/").recursive(true).await.unwrap();
assert!(root.is_dir()); // fails: configured root directory was removed
Expected Behavior
Matching root-preservation semantics (see #9630):
- Non-recursive
delete("/")should be a safe no-op that preserves both empty and populated configured roots. - Recursive
delete_with("/").recursive(true)should clear all children inside the configured root (unlinking symlinks without touching external targets) while preserving the configured root directory itself.
AI Usage Statement
- Harness: Antigravity
- Model: Gemini 3.1 Pro
- Effort: High
- Role: Identified the missing root guard in
FsDeleter::delete_once, reproduced both non-recursive and recursive root deletion failures locally, and drafted this report.
- Dominant language
- Rust
- Stars
- 5.5k
- Forks
- 869
- Avg merge
- 8h 2m
- Merged PRs (30d)
- 862
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/opendal
-
core enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
apache/opendal#9572 · 1 reaction ·
Maintainers usually reply within 1 day
-
fix(bindings/nodejs): reject negative and overflowing BigInt values in WriteOptions.chunk and Read/ReaderOptions.gapPossibly taken @rohan4naik claimed this today. Openbindings/nodejs bug
Difficulty 3/5 1-2 days Newbie friendliness 76/100
apache/opendal#9569 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
bug(layers/throttle): throttle streaming ReadStream bytes instead of pre-charging ReadOptions::limit upper bounds on open()Possibly taken @Xuanwo claimed this today. Openbug core
Difficulty 5/5 Over a week Newbie friendliness 25/100
apache/opendal#9567 · 1 reaction ·
Maintainers usually reply within 1 day
-
bindings/c bindings/dotnet bindings/go bindings/java bindings/python bindings/ruby core integrations/object_store release release-blocker services/azblob services/azdls services/dropbox services/gcs_grpc services/git services/hf3fs services/redis services/remotestorage services/s3 website
Difficulty 5/5 Over a week Newbie friendliness 20/100
apache/opendal#9560 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
bug services/dropbox services/gcs_grpc services/git services/hf3fs services/remotestorage
Difficulty 5/5 Over a week Newbie friendliness 25/100
apache/opendal#9553 · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
marketing
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
area/geometry good first issue help wanted kind/doc-mismatch severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Apich-Organization/rssn#295 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
thisnick/agent-wechat#908 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
FortoGraphy/prism-download-manager#242 ·
Maintainers usually reply within 1 day