Hi! 2010/8/26 Julian Andres Klode <j...@debian.org>: > On Do, 2010-08-26 at 01:38 +0100, Ben Hutchings wrote: >> The *only* example of pinning by origin in apt_preferences(5) is:
That was fixed in version 0.7.26~exp3 and is part of 0.8.0 which will be in a few days in testing hopefully. > I personally do not want quoting here, as it just complicates parsing > and breaks backwards compatibility. The documentation could state > explicitly that quotes are not supported; but this is purely a > documentation issue, and thus minor (it may also break translations of > the manpage). I don't get the complicated parser argument, how could a single char increase the complexity of a parser - especially as the empty string needs to be represented somehow anyway… And compatibility? Its long ago that i saw a hostname starting with "… Or do we need to maintain compatibilty with this bugs as users have non working rules in their preferences file because of this bug? I personally don't want to complicated it for a human being if a machine could do the hard work - at least in my understand we created machines to do the hard and boring work for us in the first place, so why enforce a silly "no quotes allowed - but needed if origin is empty" rule? Anyway, the "fun" fact is that the manpage is wrong: First of all "" doesn't work as expected, especially not if the local archive is not flat. Further more i made the mistake to document the origin now by writing "ftp.de.debian.org" which is obviously also wrong. Thankfully, we have two simple options to fix it: 1. Fix "" and remove the quotes around the hostname by fiddling with the po's 2. Fix "" and allow the quotes around the hostname Attached is the overly complicated patch to fix it by implementing option 2 - option 1 would only differ a bit in the first if-else block and would need a bit too much handwork on the po files for my taste… Best regards David Kalnischkies
=== modified file 'apt-pkg/versionmatch.cc' --- apt-pkg/versionmatch.cc 2010-06-28 15:38:08 +0000 +++ apt-pkg/versionmatch.cc 2010-08-30 09:33:13 +0000 @@ -118,7 +118,10 @@ if (Type == Origin) { - OrSite = Data; + if (Data[0] == '"' && Data.end()[-1] == '"') + OrSite = Data.substr(1, Data.length() - 2); + else + OrSite = Data; return; } } @@ -259,10 +262,10 @@ if (Type == Origin) { if (OrSite.empty() == false) { - if (File->Site == 0 || !ExpressionMatches(OrSite, File.Site())) + if (File->Site == 0) return false; } else // so we are talking about file:// or status file - if (strcmp(File.Site(),"") == 0 && File->Archive != 0) // skip the status file + if (strcmp(File.Site(),"") == 0 && File->Archive != 0 && strcmp(File.Archive(),"now") == 0) // skip the status file return false; return (ExpressionMatches(OrSite, File.Site())); /* both strings match */ }