Skip to content

PHP Node: Only consider NODEFS to be a shared filesystem #2300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@ const LibraryForFileLocking = {
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (!node?.mount?.opts?.fs?.lookupPath || !node?.mount?.type?.realPath) {
return false;
}

const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
22 changes: 18 additions & 4 deletions packages/php-wasm/node/jspi/php_7_2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5659,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) {
if (node?.isSharedFS) {
return true;
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (
!node?.mount?.opts?.fs?.lookupPath ||
!node?.mount?.type?.realPath
) {
return false;
}

// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode =
node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
22 changes: 18 additions & 4 deletions packages/php-wasm/node/jspi/php_7_3.js
Original file line number Diff line number Diff line change
Expand Up @@ -5659,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) {
if (node?.isSharedFS) {
return true;
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (
!node?.mount?.opts?.fs?.lookupPath ||
!node?.mount?.type?.realPath
) {
return false;
}

// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode =
node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
22 changes: 18 additions & 4 deletions packages/php-wasm/node/jspi/php_7_4.js
Original file line number Diff line number Diff line change
Expand Up @@ -5659,13 +5659,27 @@ export function init(RuntimeName, PHPLoader) {
if (node?.isSharedFS) {
return true;
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (
!node?.mount?.opts?.fs?.lookupPath ||
!node?.mount?.type?.realPath
) {
return false;
}

// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode =
node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
22 changes: 18 additions & 4 deletions packages/php-wasm/node/jspi/php_8_0.js
Original file line number Diff line number Diff line change
Expand Up @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
if (node?.isSharedFS) {
return true;
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (
!node?.mount?.opts?.fs?.lookupPath ||
!node?.mount?.type?.realPath
) {
return false;
}

// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode =
node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
22 changes: 18 additions & 4 deletions packages/php-wasm/node/jspi/php_8_1.js
Original file line number Diff line number Diff line change
Expand Up @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
if (node?.isSharedFS) {
return true;
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (
!node?.mount?.opts?.fs?.lookupPath ||
!node?.mount?.type?.realPath
) {
return false;
}

// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode =
node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
22 changes: 18 additions & 4 deletions packages/php-wasm/node/jspi/php_8_2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
if (node?.isSharedFS) {
return true;
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (
!node?.mount?.opts?.fs?.lookupPath ||
!node?.mount?.type?.realPath
) {
return false;
}

// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode =
node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
22 changes: 18 additions & 4 deletions packages/php-wasm/node/jspi/php_8_3.js
Original file line number Diff line number Diff line change
Expand Up @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
if (node?.isSharedFS) {
return true;
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (
!node?.mount?.opts?.fs?.lookupPath ||
!node?.mount?.type?.realPath
) {
return false;
}

// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode =
node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
22 changes: 18 additions & 4 deletions packages/php-wasm/node/jspi/php_8_4.js
Original file line number Diff line number Diff line change
Expand Up @@ -5677,13 +5677,27 @@ export function init(RuntimeName, PHPLoader) {
if (node?.isSharedFS) {
return true;
}

// Handle PROXYFS nodes which wrap other nodes.
if (!node?.mount?.opts?.fs?.lookupPath) {
if (
!node?.mount?.opts?.fs?.lookupPath ||
!node?.mount?.type?.realPath
) {
return false;
}

// Only NODEFS can be shared between workers at the moment.
if (node.mount.type !== NODEFS) {
return false;
}
const vfsPath = node.mount.type.realPath(node);
try {
const underlyingNode =
node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
} catch (e) {
return false;
}
const vfsPath = NODEFS.realPath(node);
const underlyingNode = node.mount.opts.fs.lookupPath(vfsPath)?.node;
return !!underlyingNode?.isSharedFS;
},
is_path_to_shared_fs(path) {
const { node } = FS.lookupPath(path);
Expand Down
Loading