Skip to content

Commit 90da303

Browse files
[PHP-wasm] File mounting in NODEFS (#2338)
## Motivation for the change, related issues We accidentally added support for mounting files to the Playground CLI by creating a directory with the file path and mounting the file into that node. This PR removes the accidental mount implementation and adds file mounting support to `createNodeFsMountHandler` by detecting the mount type and creating the correct node type (symlink, file, directory). Because Emscripten allows only the mounting of directories, we had to remove the directory check from `FS.mount` during PHP-wasm compile time. To ensure mounting works as expected for files, directories, and symlinks, this PR also adds mount tests that include file system operations like reading files, modifying files, deleting, moving, and unmounting. While writing tests I found two bugs and addressed them in this PR: - When attempting to remove a mountpoint node `FSHelpers.rmdir` would first remove all files and directories from the mountpoint and fail to remove the mountpoint in the end. To address this, we now detect if a directory we are attempting to delete is a mount point and throw an error early. The same applies for moving a mount point. - `FSHelpers.copyRecursive` copied files and directories, but skipped symlinks. Now the function will also copy symlinks. ## Testing Instructions (or ideally a Blueprint) - CI --------- Co-authored-by: Brandon Payton <[email protected]>
1 parent b2d5364 commit 90da303

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1331
-518
lines changed

packages/php-wasm/compile/php/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
-263 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/php-wasm/node/asyncify/php_7_2.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change

0 commit comments

Comments
 (0)