Some OpenBSD mirrors don't seem to work with pkg_add because their
directory listings have more attributes in their "a" tags than just
"href". For example, at least these two mirrors throw errors:

  https://mirror.esc7.net/pub/OpenBSD
  https://mirror.leaseweb.com/pub/OpenBSD

An example of the error message seen when trying to run pkg_add:

  https://mirror.leaseweb.com/pub/OpenBSD/6.1/packages/amd64/quirks-2.304.tgz"; 
title="quirks-2.304.tgz: ftp: Error retrieving file: 404 Not Found

As you can see, the problem comes from the extra "title" tag, which the
esc7.net mirror also adds.

The Perl scripts that scrape directory listings use a regex that
searches until the end of the tag (">") instead of the end of the href.
Changing them to look at just the href instead of the entire tag fixes
the problem, though I don't know enough of the history of why they were
made this way to say whether this is the right solution:
(diffs against -current)

  # pkg_add/OpenBSD/PackageRepository.pm
  898c898
  <               for my $pkg (m/\<A\s+HREF=\"(.*?\.tgz)\"\>/gio) {
  ---
  >               for my $pkg (m/\<A\s+HREF=\"(.*?\.tgz)\"/gio) {

  # pkg_add/OpenBSD/PackageRepository/HTTP.pm
  915c915
  <       for my $pkg ($r =~ m/\<A\s+HREF=\"(.+?)\.tgz\"\>/gio) {
  ---
  >       for my $pkg ($r =~ m/\<A\s+HREF=\"(.+?)\.tgz\"/gio) {

Has anybody else been stung by this?

Cheers,
Taylor

Reply via email to