Alexander Hall wrote:
Alexander Hall wrote:
Hi!

I'm having trouble with automated package updating using the swedish mirror (ftp.eu.openbsd.org, aka ftp.su.se). It seems that the server is not responding correctly to the "nlist *.tgz" command in OpenBSD::PackageRepository.

Here's a diff that solves the issue. I do not know how much an impact
removing "*.tgz" from the nlist command might have, but I suppose the
paths in PKG_PATH are supposed to mainly consist of .tgz's anyway.

The diff also removes a (to me) superflous
  ``m/^d.*\s+\S/'', which probably really was meant to be
  ``m/^\d.*\s+\S/'' anyway... ;-)

...and the same while removing a bunch of trailing spaces while
we're at it, should anyone be interested. :-)

/Alexander

Index: PackageRepository.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v
retrieving revision 1.52
diff -u -p -r1.52 PackageRepository.pm
--- PackageRepository.pm        16 May 2008 18:31:47 -0000      1.52
+++ PackageRepository.pm        23 May 2008 08:51:59 -0000
@@ -121,7 +121,7 @@ sub close
                waitpid($object->{pid2}, 0);
                alarm(0);
        }
- $self->parse_problems($object->{errors}, $hint, $object) + $self->parse_problems($object->{errors}, $hint, $object)
            if defined $object->{errors};
        undef $object->{errors};
        $object->deref;
@@ -222,12 +222,12 @@ sub open_pipe
                return $fh;
        } else {
                open STDERR, ">/dev/null";
- exec {OpenBSD::Paths->gzip} - "gzip", - "-d", - "-c", - "-q", - "-f", + exec {OpenBSD::Paths->gzip}
+                   "gzip",
+                   "-d",
+                   "-c",
+                   "-q",
+                   "-f",
                    $self->relative_url($object->{name})
                or die "Can't run gzip";
        }
@@ -283,12 +283,12 @@ sub open_pipe
                return $fh;
        } else {
                open STDERR, ">/dev/null";
- exec {OpenBSD::Paths->gzip} - "gzip", - "-d", - "-c", - "-q", - "-f", + exec {OpenBSD::Paths->gzip}
+                   "gzip",
+                   "-d",
+                   "-c",
+                   "-q",
+                   "-f",
                    "-"
                or die "can't run gzip";
        }
@@ -380,12 +380,12 @@ sub open_pipe
                open(STDIN, '<&', $rdfh) or die "Bad dup";
                close($rdfh);
                close($wrfh);
- exec {OpenBSD::Paths->gzip} - "gzip", - "-d", - "-c", - "-q", - "-" + exec {OpenBSD::Paths->gzip}
+                   "gzip",
+                   "-d",
+                   "-c",
+                   "-q",
+                   "-"
                or die "can't run gzip";
        }
        my $pid2 = fork();
@@ -444,10 +444,10 @@ sub grab_object
        if (defined $ENV{'FTP_KEEPALIVE'}) {
                push(@extra, "-k", $ENV{'FTP_KEEPALIVE'});
        }
- exec {$ftp} + exec {$ftp}
            $ftp,
            @extra,
- "-o", + "-o",
            "-", $self->url($object->{name})
        or die "can't run ".OpenBSD::Paths->ftp;
}
@@ -510,8 +510,8 @@ sub find
{
        my ($self, $pkgname, @extra) = @_;

- return $self->try_until_success($pkgname, - sub { + return $self->try_until_success($pkgname,
+           sub {
                return $self->SUPER::find($pkgname, @extra); });

}
@@ -520,8 +520,8 @@ sub grabPlist
{
        my ($self, $pkgname, @extra) = @_;

- return $self->try_until_success($pkgname, - sub { + return $self->try_until_success($pkgname,
+           sub {
                return $self->SUPER::grabPlist($pkgname, @extra); });
}

@@ -645,8 +645,7 @@ sub _list
        open(my $fh, '-|', "$cmd") or return;
        while(<$fh>) {
                chomp;
-               next if m/^d.*\s+\S/;
-               next unless m/([^\s]+)\.tgz\s*$/;
+               next unless m/(\S+)\.tgz\s*$/;
                push(@$l, $1);
        }
        close($fh);
@@ -658,7 +657,7 @@ sub get_ftp_list
        my ($self, $error) = @_;

        my $fullname = $self->url;
-       return $self->_list("echo 'nlist *.tgz'| ".OpenBSD::Paths->ftp
+       return $self->_list("echo 'nlist' | ".OpenBSD::Paths->ftp
            ." $fullname 2>$error");
}


Reply via email to