summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-09-24 12:52:20 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-09-24 12:52:20 +0000
commitd80f4bd68c5724cc57c8c65063c33de5415cf483 (patch)
tree3e66a889b7d973c8c7b0bc6bd72337fa979e4268 /usr.sbin/pkg_add
parent31dea6e6f15e461783f2b4fb47f12d5d9b1bee31 (diff)
pass actual items to prepare_long and check_name so that we can also
verify that modes/groups/owners are correct (code to come)
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/ArcCheck.pm11
-rw-r--r--usr.sbin/pkg_add/pkg_create4
-rw-r--r--usr.sbin/pkg_add/pkg_merge4
4 files changed, 12 insertions, 11 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index 2b95a746ddf..e3bf3bf536c 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.41 2005/09/04 22:53:51 espie Exp $
+# $OpenBSD: Add.pm,v 1.42 2005/09/24 12:52:19 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -361,7 +361,7 @@ sub prepare_to_extract
Fatal "Error: truncated archive\n";
}
$file->{cwd} = $self->cwd();
- if (!$file->check_name($self->{name})) {
+ if (!$file->check_name($self)) {
Fatal "Error: archive does not match ", $file->{name}, "!=",
$self->{name}, "\n";
}
diff --git a/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm b/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm
index 96c68d97a89..c543a023a71 100644
--- a/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm
+++ b/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: ArcCheck.pm,v 1.2 2005/09/24 12:07:38 espie Exp $
+# $OpenBSD: ArcCheck.pm,v 1.3 2005/09/24 12:52:19 espie Exp $
#
# Copyright (c) 2005 Marc Espie <espie@openbsd.org>
#
@@ -21,10 +21,10 @@ package OpenBSD::Ustar::Object;
sub check_name
{
- my ($self, $name) = @_;
- return 1 if $self->{name} eq $name;
+ my ($self, $item) = @_;
+ return 1 if $self->{name} eq $item->{name};
if ($self->{name} =~ m/^LongName\d+$/) {
- $self->{name} = $name;
+ $self->{name} = $item->{name};
return 1;
}
return 0;
@@ -65,7 +65,8 @@ package OpenBSD::Ustar;
sub prepare_long
{
- my ($self, $filename) = @_;
+ my ($self, $item) = @_;
+ my $filename = $item->{name};
my $entry = $self->prepare($filename);
if (!defined $entry->{uname}) {
die "No user name for ", $entry->{name}, " (uid ", $entry->{uid}, ")\n";
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index 296b18b45e0..c784d741972 100644
--- a/usr.sbin/pkg_add/pkg_create
+++ b/usr.sbin/pkg_add/pkg_create
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_create,v 1.40 2005/09/11 10:12:01 espie Exp $
+# $OpenBSD: pkg_create,v 1.41 2005/09/24 12:52:18 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -41,7 +41,7 @@ sub archive
my ($self, $arc, $base, $verbose) = @_;
if (defined $arc) {
- my $o = $arc->prepare_long($self->{name});
+ my $o = $arc->prepare_long($self);
$o->write();
}
if ($verbose) {
diff --git a/usr.sbin/pkg_add/pkg_merge b/usr.sbin/pkg_add/pkg_merge
index 9b71291b599..554b05a3600 100644
--- a/usr.sbin/pkg_add/pkg_merge
+++ b/usr.sbin/pkg_add/pkg_merge
@@ -41,7 +41,7 @@ sub copy_over
{
my ($self, $wrarc, $prefix, $pkg) = @_;
my $e = $pkg->{pkg}->next();
- if (!$e->check_name($self->{name})) {
+ if (!$e->check_name($self)) {
die "Names don't match: ", $e->{name}, " ", $self->{name};
}
$e->{name} = $prefix."/".$e->{name};
@@ -52,7 +52,7 @@ sub make_alias
{
my ($self, $wrarc, $prefix, $pkg, $alias) = @_;
my $e = $pkg->{pkg}->next();
- if (!$e->check_name($self->{name})) {
+ if (!$e->check_name($self)) {
die "Names don't match: ", $e->{name}, " ", $self->{name};
}
$e->{name} = $prefix."/".$e->{name};