]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debmetaindex.cc
apt-key: change to / before find to satisfy its CWD needs
[apt.git] / apt-pkg / deb / debmetaindex.cc
index ead07a479437e41d5cb81b3ad25b4b4f95d5a012..f756cdb1f4acfc09312b0e4c7d900878eed394e1 100644 (file)
@@ -688,9 +688,18 @@ bool debReleaseIndex::SetSignedBy(std::string const &pSignedBy)
         std::copy(fingers.begin(), fingers.end(), std::ostream_iterator<std::string>(os, ","));
         SignedBy = os.str();
       }
+      // Normalize the string: Remove trailing commas
+      while (SignedBy[SignedBy.size() - 1] == ',')
+        SignedBy.resize(SignedBy.size() - 1);
+   }
+   else {
+      // Only compare normalized strings
+      auto pSignedByView = APT::StringView(pSignedBy);
+      while (pSignedByView[pSignedByView.size() - 1] == ',')
+        pSignedByView = pSignedByView.substr(0, pSignedByView.size() - 1);
+      if (pSignedByView != SignedBy)
+        return _error->Error(_("Conflicting values set for option %s regarding source %s %s: %s != %s"), "Signed-By", URI.c_str(), Dist.c_str(), SignedBy.c_str(), pSignedByView.to_string().c_str());
    }
-   else if (SignedBy != pSignedBy)
-      return _error->Error(_("Conflicting values set for option %s regarding source %s %s"), "Signed-By", URI.c_str(), Dist.c_str());
    return true;
 }
                                                                        /*}}}*/