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

Implement cross-platform POSIX path normalization function for establishing ELF relationships #13

Closed
nightlark opened this issue Jul 21, 2023 · 0 comments · Fixed by #14
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@nightlark
Copy link
Collaborator

nightlark commented Jul 21, 2023

The ELF relationships code currently uses os.path.normpath to cleanup and normalize paths, however the behavior of this function is different on Windows than POSIX systems tested (including macOS). This leads to the unit tests for ELF relationships failing on Windows systems.

The description of the Clean function in Go describes a working normalization function for that would be suitable for this, with the exception of a "//" appearing at the start of a path remaining intact. A few examples of this special behavior:

os.path.normpath("/") -> "/"
os.path.normpath("//") -> "//"
os.path.normpath("///") -> "/"
os.path.normpath("////") -> "/"
os.path.normpath("/..") -> "/"
os.path.normpath("/../") -> "/"
os.path.normpath("//../") -> "//"
os.path.normpath("//a//b/c///d") -> "//a/b/c/d"
os.path.normpath("///a//b/c///d") -> "/a/b/c/d"

The Python docs for the os.path.normpath function can be found at https://docs.python.org/3/library/os.path.html#os.path.normpath and they link to the IEEE Standard on pathname resolution

This fix will also make CI tests pass for #7.

@nightlark nightlark added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant