On Wed, Jan 28, 2009 at 10:55:24PM +0100, Matthias Kilian wrote: > [cc'ing the creator of pkg_add] > > On Wed, Jan 28, 2009 at 09:11:44PM +0000, Stuart Henderson wrote: > > > > Of course, the other possibility might be that the mirror might > > > > implement some FTP commands pkg_add needs differently or not at all. > > > > > > I'm pretty sure it's something like this. > > > > bingo. ftp.freenet.de precede filenames in NLIST output with ./ Sigh... why can't they implement nlist correctly.
> The patch below seems to fix it, but it looks ugly, and my perl > knowledge is really bad. > Index: OpenBSD/PackageRepository.pm > =================================================================== > RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v > retrieving revision 1.61 > diff -u -p -r1.61 PackageRepository.pm > --- OpenBSD/PackageRepository.pm 11 Dec 2008 15:43:19 -0000 1.61 > +++ OpenBSD/PackageRepository.pm 28 Jan 2009 21:48:28 -0000 > @@ -756,6 +756,7 @@ sub _list > open(my $fh, '-|', "$cmd") or return; > while(<$fh>) { > chomp; > + s/^\.\///; > next if m/^\d\d\d\s+\S/; > next unless m/(\S+)\.tgz\s*$/; > push(@$l, $1); This is slightly incorrect, it shouldn't even try to strip the filename before looking for a nnn error code. Slightly more compact and better version below: Index: PackageRepository.pm =================================================================== RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v retrieving revision 1.61 diff -u -p -r1.61 PackageRepository.pm --- PackageRepository.pm 11 Dec 2008 15:43:19 -0000 1.61 +++ PackageRepository.pm 2 Feb 2009 18:01:30 -0000 @@ -757,7 +757,7 @@ sub _list while(<$fh>) { chomp; next if m/^\d\d\d\s+\S/; - next unless m/(\S+)\.tgz\s*$/; + next unless m/^(?:\.\/)?(\S+)\.tgz\s*$/; push(@$l, $1); } close($fh);