Mola-maker opened a new issue, #9043:
URL: https://github.com/apache/opendal/issues/9043

   ### OpenDAL version or commit
   
   main (57f8b75)
   
   ### Affected service or component
   
   services/compfs and services/monoiofs: `from_uri` in `config.rs`
   
   ### Describe the bug
   
   `OperatorUri::root()` returns the URI path with its slashes trimmed. `fs` 
and `hf3fs` add the leading `/` back, but `compfs` and `monoiofs` pass the 
trimmed path through as-is. As a result, `compfs:///data` and 
`monoiofs:///data` get the **relative** root `data`, and the builder resolves 
it against the process working directory, not `/data`. The existing tests 
assert this relative value (`Some("workdir")`, `Some("tmp")`). But 
`monoiofs/src/docs.md` says "the root must be absolute path", and RFC 5444 
treats `fs:///tmp/test` as absolute.
   
   The service creates the root directory if it is missing, so data silently 
ends up under whatever directory the process happens to run from.
   
   ### Steps to Reproduce
   
   Windows 11, main 57f8b75 (compfs; monoiofs builds only on Linux):
   
   ```rust
   std::env::set_current_dir(&cwd)?;          // cwd = %TEMP%\opendal-compfs-cwd
   let op = Operator::from_uri("compfs:///opendal-compfs-probe/data")?;
   op.write("hello.txt", "x").await?;
   ```
   
   ```
   cwd = C:\Users\me\AppData\Local\Temp\opendal-compfs-cwd
   compfs:///opendal-compfs-probe/data
       info().root() = "opendal-compfs-probe/data"
       file under cwd: 
...\opendal-compfs-cwd\opendal-compfs-probe/data/hello.txt exists=true
   ```
   
   ### Actual Behavior
   
   The root is relative to the current working directory.
   
   ### Expected Behavior
   
   `compfs:///data` and `monoiofs:///data` use `/data`, the same as 
`fs:///data` and `hf3fs:///data`. On Windows, `compfs:///C:/data` keeps working 
as `C:/data`.
   
   ### Additional Context
   
   These two services also ignore the URI host, the same as fs (#9041). This 
issue covers only the relative root.
   
   ### Reproduction confirmation
   
   - [x] I reproduced this issue against the affected component. For a 
service-specific report, I used the actual service rather than only a mock, 
emulator, or source-code analysis.
   
   ### Are you willing to submit a PR to fix this bug?
   
   - [x] Yes, I would like to submit a PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to