Skip to content
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

[BUG] Scaffolding A Zome Fails on Windows Due to Path Canonicalization Issue #440

Open
ClayAmore opened this issue Dec 27, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ClayAmore
Copy link

Description

Scaffolding a zome fails on Windows due to issues with path canonicalization. The extended-length path prefix \\?\ remains in the path, which prevents the scaffolding tool from executing correctly. This issue occurs in the following function:

src\scaffold\app\cargo.rs::exec_metadata

The error message that appears is:

failed to load manifest for workspace member `\\?\C:\rust\test-app\dnas\*\zomes\coordinator\*`
referenced by workspace at `\\?\C:\rust\test-app\Cargo.toml`

Caused by:
  failed to read `\\?\C:\rust\test-app\dnas\*\zomes\coordinator\*\Cargo.toml`

Caused by:
  Filnavnet, mappenavnet eller volumnavnesyntaksen er feil. (os error 123)
`cargo metadata` exited with an error:

Expected behavior

The canonicalized path should not retain the \\?\ extended-length path prefix, allowing the tool to execute successfully.

System information

  • OS: [Windows 10]
  • Scaffolding Version: 4.0.0 and any version above

Steps to reproduce

  1. Ensure extended-length path support is enabled on Windows.
  2. Use the scaffolding tool to create a new web app and add a DNA and zome:
hc scaffold web-app`
cd {web-app-name}
hc scaffold dna
hc scaffold zome
  1. The following error will occur:
failed to load manifest for workspace member `\\?\C:\rust\test-app\dnas\*\zomes\coordinator\*`
referenced by workspace at `\\?\C:\rust\test-app\Cargo.toml`

Caused by:
  failed to read `\\?\C:\rust\test-app\dnas\*\zomes\coordinator\*\Cargo.toml`

Caused by:
  Filnavnet, mappenavnet eller volumnavnesyntaksen er feil. (os error 123)
`cargo metadata` exited with an error:

Possible fix

To resolve this issue, the dunce crate can be used for path canonicalization, which avoids the extended-length path prefix.

Current code

src\scaffold\app\cargo.rs:161

let path = current_dir
    .join(workspace_cargo_toml_path(app_file_tree))
    .canonicalize()?;

Proposed fix:

let path = current_dir.join(workspace_cargo_toml_path(app_file_tree));
let path = dunce::canonicalize(path)?;
@c12i c12i self-assigned this Jan 2, 2025
@c12i c12i added the bug Something isn't working label Jan 2, 2025
@c12i
Copy link
Collaborator

c12i commented Jan 7, 2025

Hey @ClayAmore thanks for opening the issue and you suggestion. We have not been able to reproduce this bug unfortunately, so we need to gather more information before implementing the proposed fix. In the meantime, I recommend using WSL for development on Windows, to avoid similar path-related issues.

@c12i c12i added this to Holochain Jan 8, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Holochain Jan 8, 2025
@jost-s jost-s added wontfix This will not be worked on and removed wontfix This will not be worked on labels Jan 15, 2025
@jost-s
Copy link

jost-s commented Jan 15, 2025

replace canonicalize by dunce::canonicalize

This is an edge case anyway, regular paths are working under Windows directly.

@jost-s jost-s moved this from Backlog to Ready for refinement in Holochain Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready for refinement
Development

No branches or pull requests

3 participants