summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index ff59fb0ac..3dd6ddac4 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -180,14 +180,13 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
Name.erase(found);
}
- // Allow pinning by wildcards
- // TODO: Maybe we should always prefer specific pins over non-
- // specific ones.
- if (Name[0] == '/' || Name.find_first_of("*[?") != string::npos)
+ // Allow pinning by wildcards - beware of package names looking like wildcards!
+ // TODO: Maybe we should always prefer specific pins over non-specific ones.
+ if ((Name[0] == '/' && Name[Name.length() - 1] == '/') || Name.find_first_of("*[?") != string::npos)
{
pkgVersionMatch match(Data, Type);
for (pkgCache::GrpIterator G = Cache->GrpBegin(); G.end() != true; ++G)
- if (match.ExpressionMatches(Name, G.Name()))
+ if (Name != G.Name() && match.ExpressionMatches(Name, G.Name()))
{
if (Arch.empty() == false)
CreatePin(Type, string(G.Name()).append(":").append(Arch), Data, Priority);