se more specific discrimination to know if extra data is still there after
authorespie <espie@openbsd.org>
Thu, 9 Jun 2022 09:27:11 +0000 (09:27 +0000)
committerespie <espie@openbsd.org>
Thu, 9 Jun 2022 09:27:11 +0000 (09:27 +0000)
an update.

usr.sbin/pkg_add/OpenBSD/Delete.pm

index 73801a8..2d023bb 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.164 2022/06/06 07:57:21 espie Exp $
+# $OpenBSD: Delete.pm,v 1.165 2022/06/09 09:27:11 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -645,16 +645,14 @@ use File::Basename;
 sub delete
 {
        my ($self, $state) = @_;
+       return if defined $state->{current_set}{known_extra}{$self->fullname};
        my $realname = $self->realname($state);
        if ($state->verbose >= 2 && $state->{extra}) {
                $state->say("deleting extra file: #1", $realname);
        }
        return if $state->{not};
        return unless -e $realname or -l $realname;
-       if ($state->replacing) {
-               $state->log("Remember to update #1", $realname);
-               $self->mark_dir($state);
-       } elsif ($state->{extra}) {
+       if ($state->{extra}) {
                unlink($realname) or
                    $state->say("problem deleting extra file #1: #2", $realname, $!);
        } else {
@@ -669,8 +667,8 @@ sub delete
 {
        my ($self, $state) = @_;
        return unless $state->{extra};
+       return if defined $state->{current_set}{known_extra}{$self->fullname};
        my $realname = $self->realname($state);
-       return if $state->replacing;
        if ($state->{extra}) {
                $self->SUPER::delete($state);
        } else {