]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/policy.cc
The entire concept of PendingError() is flawed :/.
[apt.git] / apt-pkg / policy.cc
index ff59fb0ac6605385e786c93166534fdc46ce8993..a13510e66782ca4dcb695d1b9c556f46ba22b260 100644 (file)
@@ -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);
@@ -321,7 +320,7 @@ bool ReadPinDir(pkgPolicy &Plcy,string Dir)
    bool const PendingErrors = _error->PendingError();
    _error->MergeWithStack();
    if (PendingErrors)
-      return false;
+      return _error->ReturnError();
 
    // Read the files
    for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I)
@@ -392,6 +391,7 @@ bool ReadPinFile(pkgPolicy &Plcy,string File)
       if (priority < std::numeric_limits<short>::min() ||
           priority > std::numeric_limits<short>::max() ||
          newError) {
+        _error->ReturnError();
         return _error->Error(_("%s: Value %s is outside the range of valid pin priorities (%d to %d)"),
                              File.c_str(), Tags.FindS("Pin-Priority").c_str(),
                              std::numeric_limits<short>::min(),