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

   ### OpenDAL version or commit
   
   main (f5ef36e)
   
   ### Affected service or component
   
   The local path services cacache, compfs, monoiofs, persy, redb, sled and 
hf3fs, plus rocksdb and foundationdb, in `from_uri` 
(`core/services/*/src/config.rs`)
   
   ### Describe the bug
   
   These services build a local path (`datadir`, `datafile`, `root` or 
`config_path`) from the URI path and ignore the URI host. A host is therefore 
dropped silently and the data ends up somewhere else: `sled://tmp/data` uses 
the datadir `/data`, and `cacache://cache/x` uses `/x`. #9041 / #9042 fixed the 
same problem for `fs`, which now rejects a non-`localhost` host unless the 
caller passes `root` explicitly.
   
   compfs and monoiofs also let the URI path override an explicit `?root=` 
option. fs does the opposite and lets the explicit option win.
   
   ### Steps to Reproduce
   
   ```rust
   let uri = OperatorUri::new("sled://tmp/data", Vec::<(String, 
String)>::new())?;
   let cfg = SledConfig::from_uri(&uri)?;
   assert_eq!(cfg.datadir.as_deref(), Some("/data")); // host `tmp` is dropped
   ```
   
   The same happens for `cacache://`, `compfs://`, `monoiofs://`, `persy://`, 
`redb://` and `hf3fs://`. For compfs, `compfs:///a?root=/b` uses `/a`.
   
   ### Actual Behavior
   
   The host is ignored and the data goes to a different path.
   
   ### Expected Behavior
   
   Behave the same as `fs`: return `ConfigInvalid` for a host other than 
`localhost`, unless the path option is given explicitly, and let an explicit 
option take precedence over the URI path.
   
   ### Additional Context
   
   rocksdb (`datadir`) and foundationdb (`config_path`) have the same pattern. 
I left them out of the PR because they need native libraries I cannot build 
here.
   
   ### 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