You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
/tmp$ rm -rf x
/tmp$ mkdir x; touch x/y/tmp$nodeWelcometoNode.jsv19.0.0.Type".help"formoreinformation.>require('fs').statSync('/tmp/x').mtime2022-10-26T01:54:22.172Z>require('fs').mkdirSync('/tmp/x/z')undefined>require('fs').statSync('/tmp/x').mtime2022-10-26T01:54:52.265Z
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...
- see #4
- I'm not 100% sure I got the posix semantics right. This is
a lot better than doing absolutely nothing though!
- See streamich#869 to see
if there was any discussion on upstream.
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
The text was updated successfully, but these errors were encountered: