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

lookup: handle // and trailing slash components correctly #21

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

cyphar
Copy link
Owner

@cyphar cyphar commented Jul 23, 2024

When we hit empty components, we need to treat them as though they are a "." component. We could skip them for non-trailing components but for trailing components it's critical to actually try to do the open so that we get openat2-like errors for non-directory states.

For the single trailing slash case, it's simpler to implement it as a final "." open after we've done the other lookups (we could switch to using an array of path component like libpathrs does, but this is a simpler change).

Signed-off-by: Aleksa Sarai [email protected]

When we hit empty components, we need to treat them as though they are a
"." component. We could skip them for non-trailing components but for
trailing components it's critical to actually try to do the open so that
we get openat2-like errors for non-directory states.

For the single trailing slash case, it's simpler to implement it as a
final "." open after we've done the other lookups (we could switch to
using an array of path component like libpathrs does, but this is a
simpler change).

Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar cyphar merged commit 2404ffb into main Jul 23, 2024
11 checks passed
@cyphar cyphar deleted the lookup-empty-components branch July 23, 2024 10:21
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.

None yet

1 participant