Migrate in-memory file system to new backend - #1107
Conversation
|
This PR is easiest to review one commit at a time. It is stacked on top of #1106 due to an ordering requirement but is possible to review independently. |
79c162f to
8613c9d
Compare
|
Reported by GPT-5.6 sol. Will do my own review soon. Found two high-confidence issues:
|
8613c9d to
456de45
Compare
|
I don't think it is critical, but yes to the first one. There are some subtleties with the The second one, yes, I've mentioned this before too, models like to complain about panics due to |
|
More findings by AI agents:
|
| // Linux truncates whenever the open succeeds, regardless of the access mode (an | ||
| // `O_RDONLY|O_TRUNC` open of a writable file does truncate it); `O_PATH` opens ignore | ||
| // `O_TRUNC` entirely. | ||
| // | ||
| // TODO(jayb): Linux's `may_open` also adds `MAY_WRITE` for `O_TRUNC`, and checks | ||
| // permissions _before_ truncating; the resolver does neither, so a denied | ||
| // `O_RDONLY|O_TRUNC` open still empties the file here. |
There was a problem hiding this comment.
Should we worry about Linux's semantics here?
There was a problem hiding this comment.
The Linux semantics are weird around this, and I am not particularly happy that we are still using OFlags, but changing that out is a bigger ask than the scope of this current change, thus I just wanted to document the weirdness that shows up around Linux-isms, that's all.
|
Thanks Weidong, the 4 issues your agents mention:
|
|
🤖 SemverChecks 🤖 Click for details |
This PR switches our in-memory filesystem to the new core file system design (see #887). Concretely, it adds a
InMembackend, migrates all old usage ofin_mem::FileSystemto a resolver-backed one to use the newInMembackend, and then removes the oldin_mem::FileSystem. It also revamps the in-mem backend initialization design, moving away from the ugly "temporarily change user and do operations" to an actual controlled initialization, which reduces the chances of footguns, and also makes future improvements easier :)