diff options
author | wcmaier <wcmaier@cvs.openbsd.org> | 2009-06-04 18:59:29 +0000 |
---|---|---|
committer | wcmaier <wcmaier@cvs.openbsd.org> | 2009-06-04 18:59:29 +0000 |
commit | d409410843f7f442a485acce00b7a923ffe6328f (patch) | |
tree | 45a075f1123ba0f4f523f54904b67d6e011d3c7c | |
parent | aa72098595c243f20aca39f74cb402060e7fc251 (diff) |
Canonicalise package names when comparing them against the package database.
This unconfuses pkg_* when passed paths that, while valid, don't exactly
match /var/db/pkg. For example, the following now works (note the double
slash):
$ pkg_info /var//db/pkg/somepackage
Hasty tab-completers the world over shall rejoice. Tweaks and ok espie@.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageInfo.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm index a57600eb54a..9c3f8f219ac 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageInfo.pm,v 1.38 2008/06/15 08:23:50 espie Exp $ +# $OpenBSD: PackageInfo.pm,v 1.39 2009/06/04 18:59:28 wcmaier Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -167,7 +167,8 @@ sub is_installed sub installed_name { - my $name = shift; + require File::Spec; + my $name = File::Spec->canonpath(shift); $name =~ s|/$||o; # XXX remove the o if we allow pkg_db to change dynamically $name =~ s|^\Q$pkg_db\E/?||o; |