2017-08-04 0:37 GMT+03:00 Stuart Henderson <[email protected]>: > CC'ing ports@ in case people miss this on bugs@. Quick summary from > earlier posts: some mirrors e.g. leaseweb, esc7, have directory listings > with <a href="foo" title="foo">, which pkg_add's parser can't handle. > > On 2017/08/03 20:44, Taylor Stearns wrote: >> On Wed, Aug 02, 2017 at 11:41:52PM +0100, Stuart Henderson wrote: >> > Please send a diff -u and don't indent it. >> >> Here is the CVS diff -u: > > Thanks, that's readable now :) > > Normally I'd want to wait until espie@ is around for pkg_add changes > but the leaseweb mirror is at the top of ftplist.cgi when fetched over > https from a "new" IP address (it doesn't currently prioritize nearby > mirrors like it does over http) so it's somewhat likely that fresh > installs will be using this mirror by default, so it would be nice > to get a fix committed sooner.. > > Generally I agree with the diff except for one thing (below) > >> Index: PackageRepository.pm >> =================================================================== >> RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v >> retrieving revision 1.145 >> diff -u -p -r1.145 PackageRepository.pm >> --- PackageRepository.pm 20 Jun 2017 18:05:44 -0000 1.145 >> +++ PackageRepository.pm 3 Aug 2017 19:27:55 -0000 >> @@ -912,7 +912,7 @@ sub get_http_list >> $error) or return; >> while(<$fh>) { >> chomp; >> - for my $pkg (m/\<A\s+HREF=\"(.*?\.tgz)\"\>/gio) { >> + for my $pkg (m/\<A\s+HREF=\"(.*?\.tgz)\"/gio) { >> $pkg = $1 if $pkg =~ m|^.*/(.*)$|; >> # decode uri-encoding; from URI::Escape >> $pkg =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; >> Index: PackageRepository/HTTP.pm >> =================================================================== >> RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm,v >> retrieving revision 1.12 >> diff -u -p -r1.12 HTTP.pm >> --- PackageRepository/HTTP.pm 27 Aug 2014 18:40:03 -0000 1.12 >> +++ PackageRepository/HTTP.pm 3 Aug 2017 19:27:55 -0000 >> @@ -280,7 +280,7 @@ sub get_directory >> exit 1; >> } >> print "SUCCESS: directory $dname\n"; >> - for my $pkg ($r =~ m/\<A\s+HREF=\"(.+?)\.tgz\"\>/gio) { >> + for my $pkg ($r =~ m/\<A\s+HREF=\"(.+?)\.tgz\"/gio) { >> $pkg = $1 if $pkg =~ m|^.*/(.*)$|; >> # decode uri-encoding; from URI::Escape >> $pkg =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; >> > > The href doesn't have to immediately follow the "<a ", and it's easy > enough to cope, and I can't think of a downside, so there's a modified > diff below that handles this. > > Any OKs for either Taylor's or my amended version? > > I've tested this with "pkg_add moo" from snapshot packages from *all* > http mirrors, it works on all the non-broken ones (failures at unbr.br > which doesn't use --delete, and ulisboa.pt which is down from my > network, but these are obviously not a problem with the diff). > > Index: OpenBSD/PackageRepository.pm > =================================================================== > RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v > retrieving revision 1.145 > diff -u -p -r1.145 PackageRepository.pm > --- OpenBSD/PackageRepository.pm 20 Jun 2017 18:05:44 -0000 1.145 > +++ OpenBSD/PackageRepository.pm 3 Aug 2017 21:04:28 -0000 > @@ -912,7 +912,7 @@ sub get_http_list > $error) or return; > while(<$fh>) { > chomp; > - for my $pkg (m/\<A\s+HREF=\"(.*?\.tgz)\"\>/gio) { > + for my $pkg (m/\<A[^>]*\s+HREF=\"(.*?\.tgz)\"/gio) { > $pkg = $1 if $pkg =~ m|^.*/(.*)$|; > # decode uri-encoding; from URI::Escape > $pkg =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; > Index: OpenBSD/PackageRepository/HTTP.pm > =================================================================== > RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm,v > retrieving revision 1.12 > diff -u -p -r1.12 HTTP.pm > --- OpenBSD/PackageRepository/HTTP.pm 27 Aug 2014 18:40:03 -0000 1.12 > +++ OpenBSD/PackageRepository/HTTP.pm 3 Aug 2017 21:04:28 -0000 > @@ -280,7 +280,7 @@ sub get_directory > exit 1; > } > print "SUCCESS: directory $dname\n"; > - for my $pkg ($r =~ m/\<A\s+HREF=\"(.+?)\.tgz\"\>/gio) { > + for my $pkg ($r =~ m/\<A[^>]*\s+HREF=\"(.+?)\.tgz\"/gio) { > $pkg = $1 if $pkg =~ m|^.*/(.*)$|; > # decode uri-encoding; from URI::Escape > $pkg =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; >
Your version, Stuart, looks like okay for me (as in "I'd do the same tweak"). -- WBR, Vadim Zhukov
