On Thu, Jan 16, 2020 at 06:29:11AM -0800, David Christensen wrote: > As I understand Unix paths, 'foo' and './foo' should be the same file. But, > apparently apt treats the first as a package name while treating the second > as a path to a *.deb package file. Subtle; and a good trap for the unwary.
Long before apt gained the ability to handle local .deb files, someone had already used the / character to act as a separator between a package name and a release name. As in, apt-get install bash/testing which means something like "install the version of the bash package from a repository named testing, instead of the most recent version you can find". Therefore, a command like apt-get install mydebs/foobar.deb looks syntactically like "install the package named mydebs from a repository named foobar.deb". Apt isn't clever enough to figure out that mydebs refers to a local directory, and foobar.deb to a local file. When the ability to read local .deb files was added, apt needed some way to tell what's intended to be a pathname, and what's intended to be a package/repository concatenation. The compromise of "if it starts with / or ./ or ../" was decided upon, because the empty string and . and .. aren't legal package names.