surprised nobody noticed before me
authorespie <espie@openbsd.org>
Mon, 27 Jun 2016 08:38:15 +0000 (08:38 +0000)
committerespie <espie@openbsd.org>
Mon, 27 Jun 2016 08:38:15 +0000 (08:38 +0000)
let scp:// work with PKG_CACHE
basically, we do an extra fork, so we end up cleaning up the connection twice
that's okay for the handles, but not for the commands, since we do a spurious
ABORT BYE BYE on cleanup.

usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
usr.sbin/pkg_add/OpenBSD/PackageRepository/Persistent.pm

index 209c8c9..45e8424 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: PackageRepository.pm,v 1.123 2016/04/25 10:53:13 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.124 2016/06/27 08:38:15 espie Exp $
 #
 # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
 #
@@ -87,6 +87,10 @@ sub parse_fullurl
        return $class->unique($class->parse_url($r, $state));
 }
 
+sub dont_cleanup
+{
+}
+
 sub ftp() { 'OpenBSD::PackageRepository::FTP' }
 sub http() { 'OpenBSD::PackageRepository::HTTP' }
 sub https() { 'OpenBSD::PackageRepository::HTTPS' }
@@ -550,6 +554,7 @@ sub open_pipe
                        my $pid3 = open(my $in, "-|");
                        $self->did_it_fork($pid3);
                        if ($pid3) {
+                               $self->dont_cleanup;
                                $self->pkg_copy($in, $object);
                        } else {
                                $self->grab_object($object);
index 4df2556..9b8b03c 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: Persistent.pm,v 1.1 2014/08/27 18:40:03 kspillner Exp $
+# $OpenBSD: Persistent.pm,v 1.2 2016/06/27 08:38:15 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -129,9 +129,18 @@ sub cleanup
                CORE::close($cmdfh);
                CORE::close($getfh);
                waitpid($self->{controller}, 0);
+               delete $self->{controller};
        }
 }
 
+sub dont_cleanup
+{
+       my $self = shift;
+       CORE::close($self->{cmdfh});
+       CORE::close($self->{getfh});
+       delete $self->{controller};
+}
+
 sub reinitialize
 {
        my $self = shift;