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

Fix WASI Path Mapping Processing #3923

Merged
merged 2 commits into from
Nov 24, 2024

Conversation

dpjohnst
Copy link
Contributor

Filesystem paths can be mapped from the host path to a guest path using the format <guest-path>::<host-path>.

Previously strtok was used to find the :: delimiter. Unfortunately strtok processes each delimiter character individually. This meant that the code was ~equivalent to strtok(mapping_copy, ":") which breaks with Windows-style paths (E.g. C:\my_path\).

To fix this strstr is used to search for the exact delimiter.

Filesystem paths can be mapped from the host path to a guest path using
the format `<guest-path>::<host-path>`.

Previously `strtok` was used to find the `::` delimiter. Unfortunately
`strtok` processes each delimiter character individually. This meant
that the code was ~equivalent to `strtok(mapping_copy, ":")` which
breaks with Windows-style paths (E.g. `C:\my_path\`).

To fix this `strstr` is used to search for the exact delimiter.
@dpjohnst dpjohnst marked this pull request as ready for review November 21, 2024 22:41
Copy link
Collaborator

@lum1n0us lum1n0us left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lum1n0us lum1n0us merged commit 9d8150e into bytecodealliance:main Nov 24, 2024
383 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants