[Bug 281119] pkg(7) bootstrap treats file URLs differently than pkg(8)

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 29 Aug 2024 02:39:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281119

            Bug ID: 281119
           Summary: pkg(7) bootstrap treats file URLs differently than
                    pkg(8)
           Product: Base System
           Version: 14.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: darius@dons.net.au

A user on Discord reported
(https://discord.com/channels/727023752348434432/756248834635464935/1278354826908139584)
they had trouble with pkg bootstrap and the issue ended up that they had a URL
like "file://my/pkg/repo" rather than "file:///my/pkg/repo" (ie only 2 /s after
file:)

pkg(7) uses libfetch which I think must treat this as a relative URL, whereas
pkg(8) just strips off "file:" from the URL and uses the rest as a path.

I am not sure if the solution is to change libfetch to always treat file URLs
as absolute (ie add an implicit / at the start), or change pkg(7) to treat file
URLs the same as pkg(8), or have pkg(7) reject non-absolute file URLs.

In any case they should behave the same or give an error message to make it
easier to debug.

-- 
You are receiving this mail because:
You are the assignee for the bug.