Open williamstein opened 1 year ago
Here is how I fixed this is @cowasm/memfs: https://github.com/sagemathinc/memfs-js/commit/8454383a819ee4c99bc96aa2ef23a051a5fe577e
If you like this and agree with the semantics (?), let me know and I'll create a PR.
@williamstein let's open a PR and go from there :)
This could related to #116.
The rules are possibly complicated (see [1] and [2]), but certain operations, e.g., "create a new file" in a directory should result in the modification timestamp of the directory itself being updated. Posix OS's rely on this behavior; as an example, Python won't scan a path again if its time isn't updated, so without this behavior you can't install new modules in a running Python session, which is causing trouble for python-wasm. Here's a simple example to illustrate the problem:
Note that the mtime did not change. Now try the same on your normal filesystem:
Notice that the timestamp changed this time.
I haven't even begun to think about how to implement this in memfs, but I do think it's important and not doing so leads to subtle bugs, so I'll try...
[1] https://stackoverflow.com/questions/3451863/when-does-a-unix-directory-change-its-timestamp [2] https://medium.com/@quoscient/mac-b-timestamps-across-posix-implementations-linux-openbsd-freebsd-1e2d5893e4f