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 host component handling in file:// URLs #2342

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Conversation

kevemueller
Copy link

pkg handles file:// URLs in libpkg/fetch_file.c which translates the file URL into an access to the local filesystem. Ignoring the host component altogether in this process is semantically wrong. The host component, if given, directs the file to be fetched from that host, not from the local filesystem.

Extend the handling of the host component to accept the localhost host component - the null host component file:/// is anyway accepted already, but reject any other host component, as the code is not intended to go around looking for files on other hosts.
Update the test cases for the changed error message (invalid URL), as well as add a test case for accepting file://localhost/path URL.

closes #2339

pkg handles file:// URLs in libpkg/fetch_file.c which translates the file URL into an access to the local filesystem.
Ignoring the host component altogether in this process is semantically wrong.
The host component, if given, directs the file to be fetched from that host, not from the local filesystem.

Extend the handling of the host component to accept the localhost host component - the null host component file:/// is anyway accepted already, but reject any other host component, as the code is not intended to go around looking for files on other hosts.
@kevemueller
Copy link
Author

This makes MacOS/amd64 pass all kyua tests (with WORKERS_COUNT=1). MacOS/arm64 still has pending issues.

@bapt bapt merged commit e737ef9 into freebsd:main Nov 13, 2024
7 checks passed
@kevemueller kevemueller deleted the fileurl branch November 13, 2024 10:25
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.

fetch_file with file URL is accidentally accepted on MacOS causing failure of a test case
2 participants