summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/aptconfiguration.cc16
-rw-r--r--apt-pkg/contrib/gpgv.cc2
-rw-r--r--apt-pkg/contrib/proxy.cc19
-rw-r--r--apt-pkg/contrib/strutl.cc113
-rw-r--r--apt-pkg/deb/debmetaindex.cc42
-rw-r--r--apt-pkg/deb/debsystem.cc2
-rw-r--r--cmdline/apt-helper.cc3
-rw-r--r--cmdline/apt-key.in1
-rw-r--r--doc/apt.conf.5.xml19
-rw-r--r--methods/http.cc8
-rw-r--r--po/nb.po141
-rwxr-xr-xtest/integration/test-apt-helper49
-rwxr-xr-xtest/integration/test-different-methods-for-same-source33
-rw-r--r--test/libapt/strutil_test.cc35
14 files changed, 319 insertions, 164 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index 32778e273..68135c926 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -39,8 +39,8 @@ static void setDefaultConfigurationForCompressors() {
_config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
_config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
_config->CndSet("Dir::Bin::lz4", "/usr/bin/lz4");
- if (FileExists(_config->FindFile("Dir::Bin::xz")) == true) {
- _config->Set("Dir::Bin::lzma", _config->FindFile("Dir::Bin::xz"));
+ if (FileExists(_config->Find("Dir::Bin::xz")) == true) {
+ _config->Set("Dir::Bin::lzma", _config->Find("Dir::Bin::xz"));
_config->Set("APT::Compressor::lzma::Binary", "xz");
if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) {
_config->Set("APT::Compressor::lzma::CompressArg::", "--format=lzma");
@@ -125,7 +125,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
// add the special "uncompressed" type
if (std::find(types.begin(), types.end(), "uncompressed") == types.end())
{
- std::string const uncompr = _config->FindFile("Dir::Bin::uncompressed", "");
+ std::string const uncompr = _config->Find("Dir::Bin::uncompressed", "");
if (uncompr.empty() == true || FileExists(uncompr) == true)
types.push_back("uncompressed");
}
@@ -366,31 +366,31 @@ const Configuration::getCompressors(bool const Cached) {
setDefaultConfigurationForCompressors();
compressors.push_back(Compressor(".", "", "", NULL, NULL, 0));
- if (_config->Exists("Dir::Bin::lz4") == false || FileExists(_config->FindFile("Dir::Bin::lz4")) == true)
+ if (_config->Exists("Dir::Bin::lz4") == false || FileExists(_config->Find("Dir::Bin::lz4")) == true)
compressors.push_back(Compressor("lz4",".lz4","lz4","-1","-d",50));
#ifdef HAVE_LZ4
else
compressors.push_back(Compressor("lz4",".lz4","false", NULL, NULL, 50));
#endif
- if (_config->Exists("Dir::Bin::gzip") == false || FileExists(_config->FindFile("Dir::Bin::gzip")) == true)
+ if (_config->Exists("Dir::Bin::gzip") == false || FileExists(_config->Find("Dir::Bin::gzip")) == true)
compressors.push_back(Compressor("gzip",".gz","gzip","-6n","-d",100));
#ifdef HAVE_ZLIB
else
compressors.push_back(Compressor("gzip",".gz","false", NULL, NULL, 100));
#endif
- if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true)
+ if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->Find("Dir::Bin::xz")) == true)
compressors.push_back(Compressor("xz",".xz","xz","-6","-d",200));
#ifdef HAVE_LZMA
else
compressors.push_back(Compressor("xz",".xz","false", NULL, NULL, 200));
#endif
- if (_config->Exists("Dir::Bin::bzip2") == false || FileExists(_config->FindFile("Dir::Bin::bzip2")) == true)
+ if (_config->Exists("Dir::Bin::bzip2") == false || FileExists(_config->Find("Dir::Bin::bzip2")) == true)
compressors.push_back(Compressor("bzip2",".bz2","bzip2","-6","-d",300));
#ifdef HAVE_BZ2
else
compressors.push_back(Compressor("bzip2",".bz2","false", NULL, NULL, 300));
#endif
- if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true)
+ if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->Find("Dir::Bin::lzma")) == true)
compressors.push_back(Compressor("lzma",".lzma","lzma","-6","-d",400));
#ifdef HAVE_LZMA
else
diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc
index 0929ae0e2..1873f41f2 100644
--- a/apt-pkg/contrib/gpgv.cc
+++ b/apt-pkg/contrib/gpgv.cc
@@ -47,7 +47,7 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG,
int const &statusfd, int fd[2], std::string const &key)
{
#define EINTERNAL 111
- std::string const aptkey = _config->FindFile("Dir::Bin::apt-key", "/usr/bin/apt-key");
+ std::string const aptkey = _config->Find("Dir::Bin::apt-key", "/usr/bin/apt-key");
bool const Debug = _config->FindB("Debug::Acquire::gpgv", false);
diff --git a/apt-pkg/contrib/proxy.cc b/apt-pkg/contrib/proxy.cc
index cbe640634..4529cf230 100644
--- a/apt-pkg/contrib/proxy.cc
+++ b/apt-pkg/contrib/proxy.cc
@@ -51,19 +51,26 @@ bool AutoDetectProxy(URI &URL)
if(Popen(&Args[0], PipeFd, Child, FileFd::ReadOnly) == false)
return _error->Error("ProxyAutoDetect command '%s' failed!", AutoDetectProxyCmd.c_str());
char buf[512];
- if (PipeFd.ReadLine(buf, sizeof(buf)) == nullptr)
- return _error->Error("Failed to read in AutoDetectProxy");
+ bool const goodread = PipeFd.ReadLine(buf, sizeof(buf)) != nullptr;
PipeFd.Close();
- ExecWait(Child, "ProxyAutoDetect", true);
+ if (ExecWait(Child, "ProxyAutoDetect") == false)
+ return false;
+ // no output means the detector has no idea which proxy to use
+ // and apt will use the generic proxy settings
+ if (goodread == false)
+ return true;
auto const cleanedbuf = _strstrip(buf);
-
+ // We warn about this as the implementor probably meant to use DIRECT instead
if (cleanedbuf[0] == '\0')
- return _error->Warning("ProxyAutoDetect returned no data");
+ {
+ _error->Warning("ProxyAutoDetect command returned an empty line");
+ return true;
+ }
if (Debug)
std::clog << "auto detect command returned: '" << cleanedbuf << "'" << std::endl;
- if (strstr(cleanedbuf, URL.Access.c_str()) == cleanedbuf)
+ if (strstr(cleanedbuf, URL.Access.c_str()) == cleanedbuf || strcmp(cleanedbuf, "DIRECT") == 0)
_config->Set("Acquire::"+URL.Access+"::proxy::"+URL.Host, cleanedbuf);
return true;
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index fba1e3306..84fc14bb1 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -867,7 +867,7 @@ bool ReadMessages(int Fd, vector<string> &List)
// ---------------------------------------------------------------------
/* This was lifted from the boa webserver which lifted it from 'wn-v1.07'
Made it a bit more robust with a few tolower_ascii though. */
-static int MonthConv(char *Month)
+static int MonthConv(char const * const Month)
{
switch (tolower_ascii(*Month))
{
@@ -930,46 +930,87 @@ static time_t timegm(struct tm *t)
method used to ignore the timezone and assume always UTC. */
bool RFC1123StrToTime(const char* const str,time_t &time)
{
- struct tm t;
- auto const &posix = std::locale("C.UTF-8");
- auto const parse_time = [&](char const * const s, bool const has_timezone) {
- std::istringstream ss(str);
- ss.imbue(posix);
- ss >> std::get_time(&t, s);
- if (has_timezone && ss.fail() == false)
- {
- std::string timezone;
- ss >> timezone;
- if (timezone.empty())
+ unsigned short day = 0;
+ signed int year = 0; // yes, Y23K problem – we gonna worry then…
+ std::string weekday, month, datespec, timespec, zone;
+ std::istringstream ss(str);
+ ss >> weekday;
+ // we only superficially check weekday, mostly to avoid accepting localized
+ // weekdays here and take only its length to decide which datetime format we
+ // encounter here. The date isn't stored.
+ std::transform(weekday.begin(), weekday.end(), weekday.begin(), ::tolower);
+ std::array<char const * const, 7> c_weekdays = {{ "sun", "mon", "tue", "wed", "thu", "fri", "sat" }};
+ if (std::find(c_weekdays.begin(), c_weekdays.end(), weekday.substr(0,3)) == c_weekdays.end())
+ return false;
+
+ switch (weekday.length())
+ {
+ case 4:
+ // Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
+ if (weekday[3] != ',')
+ return false;
+ ss >> day >> month >> year >> timespec >> zone;
+ break;
+ case 3:
+ // Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
+ ss >> month >> day >> timespec >> year;
+ zone = "UTC";
+ break;
+ case 0:
+ case 1:
+ case 2:
+ return false;
+ default:
+ // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
+ if (weekday[weekday.length() - 1] != ',')
+ return false;
+ ss >> datespec >> timespec >> zone;
+ auto const expldate = VectorizeString(datespec, '-');
+ if (expldate.size() != 3)
+ return false;
+ try {
+ size_t pos;
+ day = std::stoi(expldate[0], &pos);
+ if (pos != expldate[0].length())
return false;
- if (timezone != "GMT" && timezone != "UTC" && timezone != "Z") // RFC 822
- {
- // numeric timezones as a should of RFC 1123 and generally preferred
- try {
- size_t pos;
- auto const zone = std::stoi(timezone, &pos);
- if (zone != 0 || pos != timezone.length())
- return false;
- } catch (...) {
- return false;
- }
- }
+ year = 1900 + std::stoi(expldate[2], &pos);
+ if (pos != expldate[2].length())
+ return false;
+ strprintf(datespec, "%.4d-%.2d-%.2d", year, MonthConv(expldate[1].c_str()) + 1, day);
+ } catch (...) {
+ return false;
}
- t.tm_isdst = 0;
- return ss.fail() == false;
- };
+ break;
+ }
- bool const good =
- // Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
- parse_time("%a, %d %b %Y %H:%M:%S", true) ||
- // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
- parse_time("%A, %d-%b-%y %H:%M:%S", true) ||
- // Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
- parse_time("%c", false); // "%a %b %d %H:%M:%S %Y"
- if (good == false)
+ if (ss.fail() || ss.bad() || !ss.eof())
return false;
- time = timegm(&t);
+ if (zone != "GMT" && zone != "UTC" && zone != "Z") // RFC 822
+ {
+ // numeric timezones as a should of RFC 1123 and generally preferred
+ try {
+ size_t pos;
+ auto const z = std::stoi(zone, &pos);
+ if (z != 0 || pos != zone.length())
+ return false;
+ } catch (...) {
+ return false;
+ }
+ }
+
+ if (datespec.empty())
+ {
+ if (month.empty())
+ return false;
+ strprintf(datespec, "%.4d-%.2d-%.2d", year, MonthConv(month.c_str()) + 1, day);
+ }
+
+ std::string const datetime = datespec + ' ' + timespec;
+ struct tm Tm;
+ if (strptime(datetime.c_str(), "%Y-%m-%d %H:%M:%S", &Tm) == nullptr)
+ return false;
+ time = timegm(&Tm);
return true;
}
/*}}}*/
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index f756cdb1f..c70c39a45 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -80,20 +80,19 @@ std::string debReleaseIndex::MetaIndexFile(const char *Type) const
return _config->FindDir("Dir::State::lists") +
URItoFileName(MetaIndexURI(Type));
}
-
-std::string debReleaseIndex::MetaIndexURI(const char *Type) const
+static std::string constructMetaIndexURI(std::string URI, std::string const &Dist, char const * const Type)
{
- std::string Res;
-
if (Dist == "/")
- Res = URI;
+ ;
else if (Dist[Dist.size()-1] == '/')
- Res = URI + Dist;
+ URI += Dist;
else
- Res = URI + "dists/" + Dist + "/";
-
- Res += Type;
- return Res;
+ URI += "dists/" + Dist + "/";
+ return URI + Type;
+}
+std::string debReleaseIndex::MetaIndexURI(const char *Type) const
+{
+ return constructMetaIndexURI(URI, Dist, Type);
}
/*}}}*/
// ReleaseIndex Con- and Destructors /*{{{*/
@@ -919,27 +918,30 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/
std::string const &Dist, std::string const &Section,
bool const &IsSrc, std::map<std::string, std::string> const &Options) const
{
- debReleaseIndex *Deb = NULL;
- for (std::vector<metaIndex *>::const_iterator I = List.begin();
- I != List.end(); ++I)
+ debReleaseIndex * Deb = nullptr;
+ std::string const FileName = URItoFileName(constructMetaIndexURI(URI, Dist, "Release"));
+ for (auto const &I: List)
{
// We only worry about debian entries here
- if (strcmp((*I)->GetType(), "deb") != 0)
+ if (strcmp(I->GetType(), "deb") != 0)
+ continue;
+
+ auto const D = dynamic_cast<debReleaseIndex*>(I);
+ if (unlikely(D == nullptr))
continue;
- /* This check insures that there will be only one Release file
+ /* This check ensures that there will be only one Release file
queued for all the Packages files and Sources files it
corresponds to. */
- if ((*I)->GetURI() == URI && (*I)->GetDist() == Dist)
+ if (URItoFileName(D->MetaIndexURI("Release")) == FileName)
{
- Deb = dynamic_cast<debReleaseIndex*>(*I);
- if (Deb != NULL)
- break;
+ Deb = D;
+ break;
}
}
// No currently created Release file indexes this entry, so we create a new one.
- if (Deb == NULL)
+ if (Deb == nullptr)
{
Deb = new debReleaseIndex(URI, Dist);
List.push_back(Deb);
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 56ca8f4c6..e2b1df950 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -221,7 +221,7 @@ signed debSystem::Score(Configuration const &Cnf)
signed Score = 0;
if (FileExists(Cnf.FindFile("Dir::State::status","/var/lib/dpkg/status")) == true)
Score += 10;
- if (FileExists(Cnf.FindFile("Dir::Bin::dpkg","/usr/bin/dpkg")) == true)
+ if (FileExists(Cnf.Find("Dir::Bin::dpkg","/usr/bin/dpkg")) == true)
Score += 10;
if (FileExists("/etc/debian_version") == true)
Score += 10;
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
index f3b8c326e..fd99fba8b 100644
--- a/cmdline/apt-helper.cc
+++ b/cmdline/apt-helper.cc
@@ -39,7 +39,8 @@ static bool DoAutoDetectProxy(CommandLine &CmdL) /*{{{*/
if (CmdL.FileSize() != 2)
return _error->Error(_("Need one URL as argument"));
URI ServerURL(CmdL.FileList[1]);
- AutoDetectProxy(ServerURL);
+ if (AutoDetectProxy(ServerURL) == false)
+ return false;
std::string SpecificProxy = _config->Find("Acquire::"+ServerURL.Access+"::Proxy::" + ServerURL.Host);
ioprintf(std::cout, "Using proxy '%s' for URL '%s'\n",
SpecificProxy.c_str(), std::string(ServerURL).c_str());
diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in
index ede6be4c3..7c12c72a3 100644
--- a/cmdline/apt-key.in
+++ b/cmdline/apt-key.in
@@ -23,6 +23,7 @@ requires_root() {
}
command_available() {
+ if [ -x "$1" ]; then return 0; fi
# command -v "$1" >/dev/null 2>&1 # not required by policy, see #747320
# which "$1" >/dev/null 2>&1 # is in debianutils (essential) but not on non-debian systems
local OLDIFS="$IFS"
diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml
index 6aa0c9629..d71f99c0a 100644
--- a/doc/apt.conf.5.xml
+++ b/doc/apt.conf.5.xml
@@ -444,15 +444,20 @@ APT::Compressor::rev {
only if the client uses a known identifier.</para>
<para><literal>Acquire::http::Proxy-Auto-Detect</literal> can be used to
- specify an external command to discover the http proxy to use. Apt expects
- the command to output the proxy on stdout in the style
- <literal>http://proxy:port/</literal>. This will override the
- generic <literal>Acquire::http::Proxy</literal> but not any specific
- host proxy configuration set via
- <literal>Acquire::http::Proxy::$HOST</literal>.
+ specify an external command to discover the http proxy to use. The first
+ and only parameter is an URI denoting the host to be contacted to allow
+ for host-specific configuration. APT expects the command to output the
+ proxy on stdout as a single line in the style <literal>http://proxy:port/</literal>
+ or the word <literal>DIRECT</literal> if no proxy should be used. No output
+ indicates that the generic proxy settings should be used.
+
+ Note that auto-detection will not be used for a host if a host-specific proxy
+ configuration is already set via <literal>Acquire::http::Proxy::<replaceable>HOST</replaceable></literal>.
See the &squid-deb-proxy-client; package for an example implementation that
- uses avahi. This option takes precedence over the legacy option name
+ uses avahi.
+
+ This option takes precedence over the legacy option name
<literal>ProxyAutoDetect</literal>.
</para>
diff --git a/methods/http.cc b/methods/http.cc
index b861e61ee..fc54ece3a 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -441,12 +441,12 @@ bool HttpServerState::RunData(FileFd * const File)
{
/* Closes encoding is used when the server did not specify a size, the
loss of the connection means we are done */
- if (Persistent == false)
- In.Limit(-1);
- else if (JunkSize != 0)
+ if (JunkSize != 0)
In.Limit(JunkSize);
- else
+ else if (DownloadSize != 0)
In.Limit(DownloadSize);
+ else if (Persistent == false)
+ In.Limit(-1);
// Just transfer the whole block.
do
diff --git a/po/nb.po b/po/nb.po
index a82d15cab..364060bbd 100644
--- a/po/nb.po
+++ b/po/nb.po
@@ -7,20 +7,21 @@
# Klaus Ade Johnstad <klaus@skolelinux.no>, 2004.
# Bjorn Steensrud <bjornst@powertech.no>, 2004.
# Hans Fredrik Nordhaug <hans@nordhaug.priv.no>, 2003, 2005-2010.
+# Petter Reinholdtsen <pere@hungry.com>, 2016.
msgid ""
msgstr ""
"Project-Id-Version: apt 1.0.5\n"
"Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n"
-"POT-Creation-Date: 2016-06-11 17:24+0200\n"
-"PO-Revision-Date: 2010-09-01 21:10+0200\n"
-"Last-Translator: Hans Fredrik Nordhaug <hans@nordhaug.priv.no>\n"
-"Language-Team: Norwegian Bokmål <i18n-nb@lister.ping.uio.no>\n"
+"POT-Creation-Date: 2016-06-13 11:54+0200\n"
+"PO-Revision-Date: 2016-06-11 22:38+0200\n"
+"Last-Translator: Petter Reinholdtsen <pere@hungry.com>\n"
+"Language-Team: Norwegian Bokmål <i18n-no@lister.ping.uio.no>\n"
"Language: nb\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: Virtaal 0.6.1\n"
+"X-Generator: Lokalize 1.5\n"
#. TRANSLATOR: Very short word to be displayed before unchanged files in 'apt-get update'
#: apt-private/acqprogress.cc
@@ -99,7 +100,7 @@ msgstr "Uinnfridde avhengighetsforhold - Prøv «-f»."
#: apt-private/private-cacheset.cc apt-private/private-search.cc
msgid "Sorting"
-msgstr ""
+msgstr "Sorterer"
#: apt-private/private-cacheset.cc
#, c-format
@@ -122,7 +123,6 @@ msgid "Package %s is a virtual package provided by:\n"
msgstr "Pakken %s er en virtuell pakke, som oppfylt av:\n"
#: apt-private/private-cacheset.cc
-#, fuzzy
msgid " [Installed]"
msgstr " [Installert]"
@@ -161,9 +161,11 @@ msgstr "Virtuelle pakker som «%s» kan ikke fjernes\n"
#. TRANSLATORS: Note, this is not an interactive question
#: apt-private/private-cacheset.cc apt-private/private-install.cc
-#, fuzzy, c-format
+#, c-format
msgid "Package '%s' is not installed, so not removed. Did you mean '%s'?\n"
-msgstr "Pakken %s er ikke installert, og derfor heller ikke fjernet\n"
+msgstr ""
+"Pakken '%s' er ikke installert, og derfor heller ikke fjernet. Mente du "
+"'%s'?\n"
#: apt-private/private-cacheset.cc apt-private/private-install.cc
#, fuzzy, c-format
@@ -177,12 +179,12 @@ msgstr "Merk, velger «%s» istedenfor «%s»\n"
#: apt-private/private-cmndline.cc
msgid "Most used commands:"
-msgstr ""
+msgstr "Mest brukte kommandoer:"
#: apt-private/private-cmndline.cc
#, c-format
msgid "See %s for more information about the available commands."
-msgstr ""
+msgstr "Se %s for mer informasjon om de tilgjengelige kommandoene."
#: apt-private/private-cmndline.cc
msgid ""
@@ -191,6 +193,9 @@ msgid ""
"Package and version choices can be expressed via apt_preferences(5).\n"
"Security details are available in apt-secure(8).\n"
msgstr ""
+"Detaljer om oppsettvalg og syntaks finnes i apt.conf(5).\n"
+"Informasjon om hvordan en setter opp kilder finnes i sources.list(5).\n"
+"Sikkerhetsdetaljer er tilgjengelig i apt-secure(8).\n"
#: apt-private/private-cmndline.cc
msgid "This APT has Super Cow Powers."
@@ -226,6 +231,7 @@ msgid ""
"--force-yes is deprecated, use one of the options starting with --allow "
"instead."
msgstr ""
+"--force-yes er utdatert, bruk en av valgene som starter med --allow istedet."
#: apt-private/private-download.cc
#, fuzzy
@@ -308,6 +314,8 @@ msgid ""
"Held packages were changed and -y was used without --allow-change-held-"
"packages."
msgstr ""
+"Pakker som er holdt igjen ble endret og -y ble brukt uten --allow-change-"
+"held-packages."
#: apt-private/private-install.cc
msgid "Internal error, Ordering didn't finish"
@@ -462,7 +470,7 @@ msgstr[1] "%lu pakker ble automatisk installert og er ikke lenger påkrevet.\n"
#, fuzzy, c-format
msgid "Use '%s' to remove it."
msgid_plural "Use '%s' to remove them."
-msgstr[0] "Bruk «%s» for å fjerne dem."
+msgstr[0] "Bruk «%s» for å fjerne den."
msgstr[1] "Bruk «%s» for å fjerne dem."
#: apt-private/private-install.cc
@@ -478,9 +486,8 @@ msgstr ""
"angi en løsning)."
#: apt-private/private-install.cc
-#, fuzzy
msgid "The following additional packages will be installed:"
-msgstr "Følgende ekstra pakker vil bli installert."
+msgstr "Følgende ekstra pakker vil bli installert:"
#: apt-private/private-install.cc
msgid "Suggested packages:"
@@ -531,7 +538,7 @@ msgstr "Utvalgt versjon «%s» (%s) for «%s»\n"
#: apt-private/private-list.cc
msgid "Listing"
-msgstr ""
+msgstr "Lister opp"
#: apt-private/private-list.cc
#, c-format
@@ -539,7 +546,9 @@ msgid "There is %i additional version. Please use the '-a' switch to see it"
msgid_plural ""
"There are %i additional versions. Please use the '-a' switch to see them."
msgstr[0] ""
+"Det er %i ekstra versjon. Vær så snill å bruk '-a'-bryteren for å se den"
msgstr[1] ""
+"Det er %i ekstra versjoner. Vær så snill å bruk '-a'-bryteren for å se dem."
#: apt-private/private-main.cc
msgid ""
@@ -555,7 +564,7 @@ msgstr ""
#: apt-private/private-output.cc apt-private/private-show.cc
msgid "unknown"
-msgstr ""
+msgstr "ukjent"
#: apt-private/private-output.cc
#, fuzzy, c-format
@@ -569,7 +578,7 @@ msgstr " [Installert]"
#: apt-private/private-output.cc
msgid "[installed,auto-removable]"
-msgstr ""
+msgstr "[installert,auto-fjernbar]"
#: apt-private/private-output.cc
#, fuzzy
@@ -584,7 +593,7 @@ msgstr " [Installert]"
#: apt-private/private-output.cc
#, c-format
msgid "[upgradable from: %s]"
-msgstr ""
+msgstr "[oppgraderbar fra: %s]"
#: apt-private/private-output.cc
msgid "[residual-config]"
@@ -710,7 +719,7 @@ msgstr "J"
#. TRANSLATOR: "No" answer printed for a yes/no question if --assume-no is set
#: apt-private/private-output.cc
msgid "N"
-msgstr ""
+msgstr "N"
#: apt-private/private-output.cc apt-pkg/cachefilter.cc
#, c-format
@@ -723,7 +732,7 @@ msgstr "Du må oppgi minst ett søkemønster"
#: apt-private/private-search.cc
msgid "Full Text Search"
-msgstr ""
+msgstr "Fulltekstsøk"
#: apt-private/private-show.cc cmdline/apt-cache.cc
#, c-format
@@ -736,11 +745,14 @@ msgid "There is %i additional record. Please use the '-a' switch to see it"
msgid_plural ""
"There are %i additional records. Please use the '-a' switch to see them."
msgstr[0] ""
+"Det er %i ekstra oppføring. Vær så snill å bruk '-a'-bryteren for å se den"
msgstr[1] ""
+"Det er %i ekstra oppføringer. Vær så snill å bruk '-a'-bryteren for å se "
+"dem."
#: apt-private/private-show.cc
msgid "not a real package (virtual)"
-msgstr ""
+msgstr "ikke en virkelig pakke (virtuell)"
#: apt-private/private-show.cc apt-pkg/cacheset.cc
#, c-format
@@ -765,7 +777,7 @@ msgstr "Låste pakker:"
#: apt-private/private-show.cc
#, c-format
msgid "%s -> %s with priority %d\n"
-msgstr ""
+msgstr "%s -> %s med prioritet %d\n"
#: apt-private/private-show.cc
msgid " Installed: "
@@ -906,11 +918,13 @@ msgid ""
"No architecture information available for %s. See apt.conf(5) APT::"
"Architectures for setup"
msgstr ""
+"Ingen arkitekturinformasjon tilgjengelig for %s. Se apt.conf(5) APT::"
+"Architectures for oppsett."
#: apt-private/private-source.cc
#, c-format
msgid "Note, using directory '%s' to get the build dependencies\n"
-msgstr ""
+msgstr "Merk, bruker '%s'-katalogen for å få tak i byggavhengigheter\n"
#: apt-private/private-source.cc
#, fuzzy, c-format
@@ -929,7 +943,7 @@ msgstr "Klarte ikke å endre navnet på %s til %s"
#: apt-private/private-sources.cc
#, c-format
msgid "Your '%s' file changed, please run 'apt-get update'."
-msgstr ""
+msgstr "'%s'-filen din ble endret, vær så snill å kjør 'apt-get update'."
#: apt-private/private-unmet.cc
#, c-format
@@ -946,11 +960,13 @@ msgid "%i package can be upgraded. Run 'apt list --upgradable' to see it.\n"
msgid_plural ""
"%i packages can be upgraded. Run 'apt list --upgradable' to see them.\n"
msgstr[0] ""
+"%i pakke kan oppgraderes. Kjør 'apt list --upgradable' for å se den.\n"
msgstr[1] ""
+"%i pakker kan oppgraderes. Kjør 'apt list --upgradable' for å se dem.\n"
#: apt-private/private-update.cc
msgid "All packages are up to date."
-msgstr ""
+msgstr "Alle pakkene er oppdatert."
#: cmdline/apt-cache.cc
#, fuzzy
@@ -1024,6 +1040,8 @@ msgstr "Samlet mengde redegjort plass: "
#: cmdline/apt-cache.cc
msgid "This command is deprecated. Please use 'apt-mark showauto' instead."
msgstr ""
+"Denne kommandoen er utdatert. Vær så snill å bruke 'apt-mark showauto' "
+"istedet."
#: cmdline/apt-cache.cc
msgid ""
@@ -1140,6 +1158,8 @@ msgid ""
"This command is deprecated. Please use 'apt-mark auto' and 'apt-mark manual' "
"instead."
msgstr ""
+"Denne kommandoen er utdatert. Vær så snill å bruk 'apt-mark auto' og 'apt-"
+"mark manual' istedet."
#: cmdline/apt-get.cc
msgid "Internal error, problem resolver broke stuff"
@@ -1223,15 +1243,15 @@ msgstr "Last ned kildekode fra arkivene"
#: cmdline/apt-get.cc
msgid "Download the binary package into the current directory"
-msgstr ""
+msgstr "Last ned binærpakke til gjeldende katalog"
#: cmdline/apt-get.cc
msgid "Download and display the changelog for the given package"
-msgstr ""
+msgstr "Last ned og vis endringsloggen for den oppgitte pakken"
#: cmdline/apt-helper.cc
msgid "Need one URL as argument"
-msgstr ""
+msgstr "Trenger en URL som argument"
#: cmdline/apt-helper.cc
#, fuzzy
@@ -1240,12 +1260,12 @@ msgstr "Du må angi minst en pakke du vil ha kildekoden til"
#: cmdline/apt-helper.cc
msgid "Download Failed"
-msgstr ""
+msgstr "Nedlasting feilet"
#: cmdline/apt-helper.cc
#, c-format
msgid "GetSrvRec failed for %s"
-msgstr ""
+msgstr "GetSrvRec feilet for %s"
#: cmdline/apt-helper.cc
msgid ""
@@ -1263,11 +1283,11 @@ msgstr ""
#: cmdline/apt-helper.cc
msgid "lookup a SRV record (e.g. _http._tcp.ftp.debian.org)"
-msgstr ""
+msgstr "Slå opp en SRV-oppføring (f.eks. _http._tcp.ftp.debian.org)"
#: cmdline/apt-helper.cc
msgid "concatenate files, with automatic decompression"
-msgstr ""
+msgstr "slå sammen filer, med automatisk utpakking"
#: cmdline/apt-helper.cc
msgid "detect proxy using apt.conf"
@@ -1300,7 +1320,7 @@ msgstr "%s er allerede nyeste versjon.\n"
#: cmdline/apt-mark.cc
msgid "Executing dpkg failed. Are you root?"
-msgstr ""
+msgstr "Klarte ikke kjøre dpkg. Er du root?"
#: cmdline/apt-mark.cc
#, fuzzy, c-format
@@ -1320,12 +1340,12 @@ msgstr ""
#: cmdline/apt-mark.cc
#, c-format
msgid "Selected %s for removal.\n"
-msgstr ""
+msgstr "Valgte %s for fjerning.\n"
#: cmdline/apt-mark.cc
#, c-format
msgid "Selected %s for installation.\n"
-msgstr ""
+msgstr "Valgte %s for installering.\n"
#: cmdline/apt-mark.cc
msgid ""
@@ -1349,11 +1369,11 @@ msgstr "Sjekk om pakken «dpkg-dev» er installert.\n"
#: cmdline/apt-mark.cc
msgid "Mark a package as held back"
-msgstr ""
+msgstr "Marker en pakke som holdt tilbake"
#: cmdline/apt-mark.cc
msgid "Unset a package set as held back"
-msgstr ""
+msgstr "Fjern markering som holdt tilbake for en pakke"
#: cmdline/apt-mark.cc
#, fuzzy
@@ -1367,7 +1387,7 @@ msgstr "%s satt til manuell installasjon.\n"
#: cmdline/apt-mark.cc
msgid "Print the list of package on hold"
-msgstr ""
+msgstr "Skriv listen med pakker som holdes tilbake"
#: cmdline/apt.cc
msgid ""
@@ -1383,7 +1403,7 @@ msgstr ""
#. query
#: cmdline/apt.cc
msgid "list packages based on package names"
-msgstr ""
+msgstr "list pakker basert på pakkenavn"
#: cmdline/apt.cc
#, fuzzy
@@ -1392,7 +1412,7 @@ msgstr "Leser pakkelister"
#: cmdline/apt.cc
msgid "show package details"
-msgstr ""
+msgstr "vis pakkedetaljer"
#. package stuff
#: cmdline/apt.cc
@@ -1413,11 +1433,11 @@ msgstr "%s satt til manuell installasjon.\n"
#: cmdline/apt.cc
msgid "upgrade the system by installing/upgrading packages"
-msgstr ""
+msgstr "oppgrader systemet ved å installere/oppgradere pakker"
#: cmdline/apt.cc
msgid "upgrade the system by removing/installing/upgrading packages"
-msgstr ""
+msgstr "oppgrader systemet ved å fjerne/installere/oppgradere pakker"
#. misc
#: cmdline/apt.cc
@@ -1720,7 +1740,7 @@ msgstr "Ukjent feil ved kjøring av apt-key"
#: methods/gpgv.cc
#, c-format
msgid "Signature by key %s uses weak digest algorithm (%s)"
-msgstr ""
+msgstr "Signatur med nøkkel %s bruker svak oppsummeringsalgoritme (%s)"
#: methods/gpgv.cc
msgid "The following signatures were invalid:\n"
@@ -1864,7 +1884,7 @@ msgstr "Intern feil"
#: methods/store.cc
msgid "Empty files can't be valid archives"
-msgstr ""
+msgstr "Tomme filer kan ikke være gyldige arkiver"
#: dselect/install:33
msgid "Bad default setting!"
@@ -1880,9 +1900,9 @@ msgstr "Trykk «Enter» og fortsett"
msgid "Do you want to erase any previously downloaded .deb files?"
msgstr "Vil du slettet alle tidligere nedlastede .deb-filer?"
-# Note to translators: The following four messages belong together. It doesn't
-# matter where sentences start, but it has to fit in just these four lines, and
-# at only 80 characters per line, if possible.
+# Note to translators: The following four messages belong together. It doesn't
+# matter where sentences start, but it has to fit in just these four lines, and
+# at only 80 characters per line, if possible.
#: dselect/install:102
msgid "Some errors occurred while unpacking. Packages that were installed"
msgstr "Feil oppstod ved utpakkinga. Setter nå opp de installerte pakkene."
@@ -3012,7 +3032,7 @@ msgstr "Problem ved låsing av gzip-fila %s"
#: apt-pkg/contrib/fileutl.cc
msgid "Unexpected end of file"
-msgstr ""
+msgstr "Uventet slutt på fil"
#: apt-pkg/contrib/fileutl.cc
msgid "Failed to create subprocess IPC"
@@ -3061,9 +3081,9 @@ msgid "Can't mmap an empty file"
msgstr "Kan ikke utføre mmap på en tom fil"
#: apt-pkg/contrib/mmap.cc
-#, fuzzy, c-format
+#, c-format
msgid "Couldn't make mmap of %llu bytes"
-msgstr "Klarte ikke lage mmap av %lu bytes"
+msgstr "Klarte ikke lage mmap av %llu bytes"
#: apt-pkg/contrib/mmap.cc
#, c-format
@@ -3124,7 +3144,7 @@ msgstr "%c%s ... Ferdig"
#: apt-pkg/contrib/progress.cc
msgid "..."
-msgstr ""
+msgstr "..."
#. Print the spinner
#: apt-pkg/contrib/progress.cc
@@ -3332,13 +3352,13 @@ msgid "Completely removed %s"
msgstr "Fjernet %s fullstendig"
#: apt-pkg/deb/dpkgpm.cc
-#, fuzzy, c-format
+#, c-format
msgid "Can not write log (%s)"
-msgstr "Kan ikke skrive til %s"
+msgstr "Kan ikke skrive logg (%s)"
#: apt-pkg/deb/dpkgpm.cc
msgid "Is /dev/pts mounted?"
-msgstr ""
+msgstr "Er /dev/pts montert?"
#: apt-pkg/deb/dpkgpm.cc
msgid "Operation was interrupted before it could finish"
@@ -3378,13 +3398,12 @@ msgstr ""
"minne»-feil"
#: apt-pkg/deb/dpkgpm.cc
-#, fuzzy
msgid ""
"No apport report written because the error message indicates an issue on the "
"local system"
msgstr ""
-"Ingen apport-rapport skrevet fordi feilmeldingen indikerer en «full disk»-"
-"feil"
+"Ingen apport-rapport skrevet fordi feilmeldingen indikerer et problem på det "
+"lokale systemet."
#: apt-pkg/deb/dpkgpm.cc
msgid ""
@@ -3704,7 +3723,7 @@ msgstr ""
#: apt-pkg/tagfile.cc
#, c-format
msgid "Cannot convert %s to integer: out of range"
-msgstr ""
+msgstr "Kan ikke gjøre om %s til heltall: utenfor rekkevidde"
#: apt-pkg/update.cc
#, fuzzy
@@ -3719,12 +3738,18 @@ msgstr ""
msgid "Calculating upgrade"
msgstr "Beregner oppgradering"
+#~ msgid "Failed to fetch %s %s\n"
+#~ msgstr "Klarte ikke å skaffe %s %s\n"
+
#~ msgid "(not found)"
#~ msgstr "(ikke funnet)"
#~ msgid " Package pin: "
#~ msgstr " Pakke låst til: "
+#~ msgid "Invalid 'Valid-Until' entry in Release file %s"
+#~ msgstr "Ugyldig «Valid-Until»-oppføring i Release-fila %s"
+
#~ msgid "There is no public key available for the following key IDs:\n"
#~ msgstr ""
#~ "Det er ingen offentlig nøkkel tilgjengelig for de følgende nøkkel-ID-"
diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper
index 8a25859b8..1c163b3ae 100755
--- a/test/integration/test-apt-helper
+++ b/test/integration/test-apt-helper
@@ -71,38 +71,43 @@ E: Download Failed"
testfileequal './downloaded/foo10' 'bar'
}
+setupproxydetect() {
+ local METH="$1"
+ shift
+ {
+ echo '#!/bin/sh -e'
+ echo "$@"
+ } > "${TMPWORKINGDIRECTORY}/apt-proxy-detect"
+ chmod 755 "${TMPWORKINGDIRECTORY}/apt-proxy-detect"
+ echo "Acquire::${METH}::Proxy-Auto-Detect \"${TMPWORKINGDIRECTORY}/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
+}
+
test_apt_helper_detect_proxy() {
- # no proxy
+ msgmsg 'apt-helper auto-detect-proxy' 'no proxy'
testsuccessequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
-
-
- # http auto detect proxy script
- cat > apt-proxy-detect <<'EOF'
-#!/bin/sh -e
-echo "http://some-proxy"
-EOF
- chmod 755 apt-proxy-detect
- echo "Acquire::http::Proxy-Auto-Detect \"$(pwd)/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
-
+ setupproxydetect 'http' 'exit 0'
+ testsuccessequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
+ setupproxydetect 'http' 'exit 1'
+ testfailureequal 'E: Sub-process ProxyAutoDetect returned an error code (1)' apthelper auto-detect-proxy http://example.com/
+ setupproxydetect 'http' 'echo'
+ testwarningequal "Using proxy '' for URL 'http://example.com/'
+W: ProxyAutoDetect command returned an empty line" apthelper auto-detect-proxy http://example.com/
+ setupproxydetect 'http' 'echo DIRECT'
+ testsuccessequal "Using proxy 'DIRECT' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
+
+ msgmsg 'apt-helper auto-detect-proxy' 'http proxy'
+ setupproxydetect 'http' 'echo "http://some-proxy"'
testsuccessequal "Using proxy 'http://some-proxy' for URL 'http://www.example.com/'" apthelper auto-detect-proxy http://www.example.com
-
- # https auto detect proxy script
- cat > apt-proxy-detect <<'EOF'
-#!/bin/sh -e
-echo "https://https-proxy"
-EOF
- chmod 755 apt-proxy-detect
- echo "Acquire::https::Proxy-Auto-Detect \"$(pwd)/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
-
+ msgmsg 'apt-helper auto-detect-proxy' 'https proxy'
+ setupproxydetect 'https' 'echo "https://https-proxy"'
testsuccessequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com
}
test_apt_helper_download "http://localhost:${APTHTTPPORT}"
test_apt_helper_download "https://localhost:${APTHTTPSPORT}"
test_apt_helper_detect_proxy
-
-# test failure modes
+msgmsg 'test various failure modes'
testfailureequal 'E: Invalid operation download' apthelper download
testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file
testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file 'http://example.org/'
diff --git a/test/integration/test-different-methods-for-same-source b/test/integration/test-different-methods-for-same-source
new file mode 100755
index 000000000..7b78841c6
--- /dev/null
+++ b/test/integration/test-different-methods-for-same-source
@@ -0,0 +1,33 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'stable' 'foo' 'all' '1'
+insertsource 'stable' 'foo' 'all' '1'
+setupaptarchive --no-update
+
+# install a slowed down file: otherwise its to fast to reproduce combining
+NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
+OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
+rm "$NEWMETHODS"
+mkdir "$NEWMETHODS"
+backupIFS="$IFS"
+IFS="$(printf "\n\b")"
+for METH in $(find "$OLDMETHODS" ! -type d); do
+ ln -s "$OLDMETHODS/$(basename "$METH")" "$NEWMETHODS"
+done
+IFS="$backupIFS"
+ln -s "${OLDMETHODS}/http" "${NEWMETHODS}/http-ng"
+
+changetowebserver
+sed -i -e 's# http:# http-ng:#' $(find rootdir/etc/apt/sources.list.d -name '*-deb-src.list')
+
+testsuccess apt update
+cp rootdir/tmp/testsuccess.output update.log
+# all requests are folded into the first Release file
+testsuccess grep ' http-ng://' update.log
+testfailure grep ' http://' update.log
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index b7ba816ee..90a5817ad 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -255,6 +255,18 @@ TEST(StrUtilTest,RFC1123StrToTime)
EXPECT_EQ(784111777, t);
} {
time_t t;
+ EXPECT_TRUE(RFC1123StrToTime("Sun, 6 Nov 1994 08:49:37 UTC", t));
+ EXPECT_EQ(784111777, t);
+ } {
+ time_t t;
+ EXPECT_TRUE(RFC1123StrToTime("Sun, 6 Nov 1994 08:49:37 UTC", t));
+ EXPECT_EQ(784111777, t);
+ } {
+ time_t t;
+ EXPECT_TRUE(RFC1123StrToTime("Sun, 06 Nov 1994 8:49:37 UTC", t));
+ EXPECT_EQ(784111777, t);
+ } {
+ time_t t;
EXPECT_TRUE(RFC1123StrToTime("Sun, 06 Nov 1994 08:49:37 UTC", t));
EXPECT_EQ(784111777, t);
} {
@@ -271,14 +283,37 @@ TEST(StrUtilTest,RFC1123StrToTime)
EXPECT_EQ(784111777, t);
} {
time_t t;
+ EXPECT_TRUE(RFC1123StrToTime("Sunday, 6-Nov-94 08:49:37 GMT", t));
+ EXPECT_EQ(784111777, t);
+ } {
+ time_t t;
+ EXPECT_TRUE(RFC1123StrToTime("Sunday, 06-Nov-94 8:49:37 GMT", t));
+ EXPECT_EQ(784111777, t);
+ } {
+ time_t t;
EXPECT_TRUE(RFC1123StrToTime("Sun Nov 6 08:49:37 1994", t));
EXPECT_EQ(784111777, t);
+ } {
+ time_t t;
+ EXPECT_TRUE(RFC1123StrToTime("Sun Nov 06 08:49:37 1994", t));
+ EXPECT_EQ(784111777, t);
+ } {
+ time_t t;
+ EXPECT_TRUE(RFC1123StrToTime("Sun Nov 6 8:49:37 1994", t));
+ EXPECT_EQ(784111777, t);
}
time_t t;
+ EXPECT_FALSE(RFC1123StrToTime("So, 06 Nov 1994 08:49:37 UTC", t));
+ EXPECT_FALSE(RFC1123StrToTime(", 06 Nov 1994 08:49:37 UTC", t));
+ EXPECT_FALSE(RFC1123StrToTime("Son, 06 Nov 1994 08:49:37 UTC", t));
+ EXPECT_FALSE(RFC1123StrToTime("Sun: 06 Nov 1994 08:49:37 UTC", t));
EXPECT_FALSE(RFC1123StrToTime("Sun, 06 Nov 1994 08:49:37", t));
+ EXPECT_FALSE(RFC1123StrToTime("Sun, 06 Nov 1994 08:49:37 GMT+1", t));
EXPECT_FALSE(RFC1123StrToTime("Sun, 06 Nov 1994 GMT", t));
+ EXPECT_FALSE(RFC1123StrToTime("Sunday, 06 Nov 1994 GMT", t));
EXPECT_FALSE(RFC1123StrToTime("Sonntag, 06 Nov 1994 08:49:37 GMT", t));
EXPECT_FALSE(RFC1123StrToTime("domingo Nov 6 08:49:37 1994", t));
+ EXPECT_FALSE(RFC1123StrToTime("Sunday: 06-Nov-94 08:49:37 GMT", t));
EXPECT_FALSE(RFC1123StrToTime("Sunday, 06-Nov-94 08:49:37 GMT+1", t));
EXPECT_FALSE(RFC1123StrToTime("Sunday, 06-Nov-94 08:49:37 EDT", t));
EXPECT_FALSE(RFC1123StrToTime("Sunday, 06-Nov-94 08:49:37 -0100", t));