Meziu / rust-horizon

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
3 stars 1 forks source link

`std::path` handling for different resource schemes #13

Open ian-h-chamberlain opened 2 years ago

ian-h-chamberlain commented 2 years ago

Broke this out of #11 since I think it's a separate issue from reading the files themselves, but we need to figure out some way to handle the weirdness of using paths like smdc:/, romfs:/.


Edit: I think we might also need to reconsider the path scheme (or add OS-specific helpers), since I have noticed some weird behavior with .parent() and .pop().... and the romfs:/ seems a bit nonstandard for unix-like OSes.

Edit: seems like RedoxOS already uses a similar scheme (and has some support in sys::path), so maybe we can piggyback off of that: https://doc.redox-os.org/book/ch04-06-schemes.html

Originally posted by @ian-h-chamberlain in https://github.com/Meziu/rust-horizon/issues/11#issuecomment-1037402780

ian-h-chamberlain commented 2 years ago

It seems this is still unsolved for redox itself:

Meziu commented 2 years ago

Those Redox issues are quite old, has nothing of those made it into std? I wonder what the Redox users are doing to prevent that...

AzureMarker commented 2 years ago

It sounds like they are still using a fork. Looking that the open issue, I think we could try making a PR of our own against std for either option 4 or 5.

ian-h-chamberlain commented 2 years ago

I found some of the changes used in Redox: https://gitlab.redox-os.org/redox-os/rust/-/commit/6ab9e2656b8aa3d43c4977cc09a098dec7bcdafd and https://gitlab.redox-os.org/redox-os/rust/-/commit/f5eee2c14346c7c6e919721e4b0221f73f2fca9e

Seems like they never ended up upstreaming those changes since the Rust maintainers didn't really want to expand those APIs in std::path... It seems like option 5 is the most likely to be accepted upstream, and clearly it's not a huge priority for the Redox folks to get that kind of support upstream.

Maybe we can implement an OS extension trait for now, and just try to make a non-breaking change like https://github.com/rust-lang/rust/pull/51537 to at least fix components() in the meantime?

Edit: one more reference, which actually includes a reference to the 3DS (!): https://github.com/rust-lang-nursery/portability-wg/issues/18

jackpot51 commented 2 years ago

@ian-h-chamberlain I still need help determining the best option and then I would implement it.

ian-h-chamberlain commented 2 years ago

@jackpot51 I've asked for some help on Zulip, maybe we can get some additional feedback there. My thinking is that the "Option 5" there seems like the right way to go, but it probably requires some buy-in from the libs team before being implemented.

FenrirWolf commented 2 years ago

I like how I ran into this shit 3 years ago and it's still not fixed