From e3fc38e4d045617e3baed53e3907926e5c73a8f2 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Thu, 16 Mar 2017 15:57:48 +0000 Subject: tied files should be treated like deleted files wrt checksums. --- usr.sbin/pkg_add/OpenBSD/PkgAdd.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm index 68c0d9a5dbf..7177f7f9812 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgAdd.pm,v 1.94 2017/03/13 11:36:23 espie Exp $ +# $OpenBSD: PkgAdd.pm,v 1.95 2017/03/16 15:57:47 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -89,9 +89,16 @@ sub tie_files if (defined $sha->{$self->{d}->key}) { my $tied = $sha->{$self->{d}->key}; # don't tie if there's a problem with the file - return unless -f $tied->realname($state); + my $realname = $tied->realname($state); + return unless -f $realname; # and do a sanity check that this file wasn't altered return unless (stat _)[7] == $self->{size}; + if (!$state->{quick}) { + my $d = $self->compute_digest($realname, $self->{d}); + # XXX we don't have to display anything here + # because delete will take care of that + return unless $d->equals($self->{d}); + } $self->{tieto} = $tied; $tied->{tied} = 1; $state->say("Tieing #1 to #2", $self->stringize, -- cgit v1.2.3