From e6cd40dc17722bbe6c9d734c3a58b39a18c34174 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 9 Jul 2012 17:38:40 +0200 Subject: start implementing an extremely simple webserver for testing APT --- test/integration/framework | 7 +- test/integration/skip-aptwebserver | 25 ++++ test/interactive-helper/aptwebserver.cc | 216 ++++++++++++++++++++++++++++++++ test/interactive-helper/makefile | 7 ++ 4 files changed, 254 insertions(+), 1 deletion(-) create mode 100755 test/integration/skip-aptwebserver create mode 100644 test/interactive-helper/aptwebserver.cc (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 2d6ada117..a514bef20 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -688,7 +688,12 @@ signreleasefiles() { } changetowebserver() { - if which weborf > /dev/null; then + if test -x ${BUILDDIRECTORY}/aptwebserver; then + cd aptarchive + LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver 2> /dev/null > /dev/null & + addtrap "kill $!;" + cd - > /dev/null + elif which weborf > /dev/null; then weborf -xb aptarchive/ 2>&1 > /dev/null & addtrap "kill $!;" elif which gatling > /dev/null; then diff --git a/test/integration/skip-aptwebserver b/test/integration/skip-aptwebserver new file mode 100755 index 000000000..0622941ce --- /dev/null +++ b/test/integration/skip-aptwebserver @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' + +setupaptarchive +changetowebserver + +rm -rf rootdir/var/lib/apt/lists +aptget update -qq +testequal 'Hit http://localhost stable InRelease +Hit http://localhost stable/main Sources +Hit http://localhost stable/main amd64 Packages +Hit http://localhost stable/main Translation-en +Reading package lists...' aptget update + +mv rootdir/var/lib/apt/lists/localhost* rootdir/var/lib/apt/lists/partial +aptget update + diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc new file mode 100644 index 000000000..7a3624b6e --- /dev/null +++ b/test/interactive-helper/aptwebserver.cc @@ -0,0 +1,216 @@ +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +char const * const httpcodeToStr(int httpcode) { /*{{{*/ + switch (httpcode) { + // Informational 1xx + case 100: return "100 Continue"; + case 101: return "101 Switching Protocols"; + // Successful 2xx + case 200: return "200 OK"; + case 201: return "201 Created"; + case 202: return "202 Accepted"; + case 203: return "203 Non-Authoritative Information"; + case 204: return "204 No Content"; + case 205: return "205 Reset Content"; + case 206: return "206 Partial Conent"; + // Redirections 3xx + case 300: return "300 Multiple Choices"; + case 301: return "301 Moved Permanently"; + case 302: return "302 Found"; + case 303: return "303 See Other"; + case 304: return "304 Not Modified"; + case 305: return "304 Use Proxy"; + case 307: return "307 Temporary Redirect"; + // Client errors 4xx + case 400: return "400 Bad Request"; + case 401: return "401 Unauthorized"; + case 402: return "402 Payment Required"; + case 403: return "403 Forbidden"; + case 404: return "404 Not Found"; + case 405: return "405 Method Not Allowed"; + case 406: return "406 Not Acceptable"; + case 407: return "Proxy Authentication Required"; + case 408: return "Request Time-out"; + case 409: return "Conflict"; + case 410: return "Gone"; + case 411: return "Length Required"; + case 412: return "Precondition Failed"; + case 413: return "Request Entity Too Large"; + case 414: return "Request-URI Too Large"; + case 415: return "Unsupported Media Type"; + case 416: return "Requested range not satisfiable"; + case 417: return "Expectation Failed"; + // Server error 5xx + case 500: return "Internal Server Error"; + case 501: return "Not Implemented"; + case 502: return "Bad Gateway"; + case 503: return "Service Unavailable"; + case 504: return "Gateway Time-out"; + case 505: return "HTTP Version not supported"; + } + return NULL; +} /*}}}*/ +void addFileHeaders(std::list &headers, FileFd &data) { /*{{{*/ + std::ostringstream contentlength; + contentlength << "Content-Length: " << data.FileSize(); + headers.push_back(contentlength.str()); + + std::string lastmodified("Last-Modified: "); + lastmodified.append(TimeRFC1123(data.ModificationTime())); + headers.push_back(lastmodified); +} /*}}}*/ +bool sendHead(int client, int httpcode, std::list &headers) { /*{{{*/ + string response("HTTP/1.1 "); + response.append(httpcodeToStr(httpcode)); + headers.push_front(response); + + headers.push_back("Server: APT webserver"); + + std::string date("Date: "); + date.append(TimeRFC1123(time(NULL))); + headers.push_back(date); + + std::clog << ">>> RESPONSE >>>" << std::endl; + bool Success = true; + for (std::list::const_iterator h = headers.begin(); + Success == true && h != headers.end(); ++h) { + Success &= FileFd::Write(client, h->c_str(), h->size()); + Success &= FileFd::Write(client, "\r\n", 2); + std::clog << *h << std::endl; + } + Success &= FileFd::Write(client, "\r\n", 2); + std::clog << "<<<<<<<<<<<<<<<<" << std::endl; + return Success; +} /*}}}*/ +bool sendFile(int client, FileFd &data) { /*{{{*/ + bool Success = true; + char buffer[500]; + unsigned long long actual = 0; + while ((Success &= data.Read(buffer, sizeof(buffer), &actual)) == true) { + if (actual == 0) + break; + Success &= FileFd::Write(client, buffer, actual); + } + Success &= FileFd::Write(client, "\r\n", 2); + return Success; +} /*}}}*/ +bool sendData(int client, std::string &data) { /*{{{*/ + bool Success = true; + Success &= FileFd::Write(client, data.c_str(), data.size()); + Success &= FileFd::Write(client, "\r\n", 2); + return Success; +} /*}}}*/ +void sendError(int client, int httpcode, string request, bool content) { /*{{{*/ + std::list headers; + sendHead(client, httpcode, headers); + if (content == false) + return; + string response(""); + response.append(httpcodeToStr(httpcode)).append(""); + response.append("

").append(httpcodeToStr(httpcode)).append(""); + response.append(request).append(""); + sendData(client, response); +} /*}}}*/ + +int main(int argc, const char *argv[]) +{ + // create socket, bind and listen to it {{{ + int sock = socket(AF_INET6, SOCK_STREAM, 0); + if(sock < 0 ) { + _error->Errno("aptwerbserver", "Couldn't create socket"); + _error->DumpErrors(std::cerr); + return 1; + } + + // ensure that we accept all connections: v4 or v6 + int const iponly = 0; + setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &iponly, sizeof(iponly)); + // to not linger to an address + int const enable = 1; + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)); + + struct sockaddr_in6 locAddr; + memset(&locAddr, 0, sizeof(locAddr)); + locAddr.sin6_family = AF_INET6; + locAddr.sin6_port = htons(8080); + locAddr.sin6_addr = in6addr_any; + + if (bind(sock, (struct sockaddr*) &locAddr, sizeof(locAddr)) < 0) { + _error->Errno("aptwerbserver", "Couldn't bind"); + _error->DumpErrors(std::cerr); + return 2; + } + + listen(sock, 1); + /*}}}*/ + + std::vector messages; + int client; + while ((client = accept(sock, NULL, NULL)) != -1) { + std::clog << "ACCEPT client " << client << " on socket " << sock << std::endl; + + while (ReadMessages(client, messages)) { + for (std::vector::const_iterator m = messages.begin(); + m != messages.end(); ++m) { + std::clog << ">>> REQUEST >>>>" << std::endl << *m << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; + std::list headers; + bool sendContent = true; + if (strncmp(m->c_str(), "HEAD ", 5) == 0) + sendContent = false; + if (strncmp(m->c_str(), "GET ", 4) != 0) + sendError(client, 501, *m, true); + + std::string host = LookupTag(*m, "Host", ""); + if (host.empty() == true) { + // RFC 2616 §14.23 Host + sendError(client, 400, *m, sendContent); + continue; + } + + size_t const filestart = m->find(' ', 5); + string filename = m->substr(5, filestart - 5); + + if (RealFileExists(filename) == false) + sendError(client, 404, *m, sendContent); + else { + FileFd data(filename, FileFd::ReadOnly); + std::string condition = LookupTag(*m, "If-Modified-Since", ""); + if (condition.empty() == false) { + time_t cache; + if (RFC1123StrToTime(condition.c_str(), cache) == true && cache >= data.ModificationTime()) { + sendError(client, 304, *m, false); + continue; + } + } + addFileHeaders(headers, data); + sendHead(client, 200, headers); + if (sendContent == true) + sendFile(client, data); + } + } + _error->DumpErrors(std::cerr); + messages.clear(); + } + + std::clog << "CLOSE client " << client << " on socket " << sock << std::endl; + close(client); + } + return 0; +} diff --git a/test/interactive-helper/makefile b/test/interactive-helper/makefile index 10d1e44ec..fee94cd77 100644 --- a/test/interactive-helper/makefile +++ b/test/interactive-helper/makefile @@ -37,3 +37,10 @@ include $(PROGRAM_H) #SLIBS = -lapt-pkg -lrpm #SOURCE = rpmver.cc #include $(PROGRAM_H) + +# very simple webserver for APT testing +PROGRAM=aptwebserver +SLIBS = -lapt-pkg +LIB_MAKES = apt-pkg/makefile +SOURCE = aptwebserver.cc +include $(PROGRAM_H) -- cgit v1.2.3 From 90d1d54ef2a68bd443815f26e9e2b578a1d7c419 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jul 2012 11:35:56 +0200 Subject: add commandline, add configurable port, add --simulate-paywall to simulate a broken webserver that intercepts connections and returns nonsese --- test/interactive-helper/aptwebserver.cc | 52 ++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 7a3624b6e..3c476ad05 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -2,6 +2,8 @@ #include #include #include +#include +#include #include #include @@ -66,6 +68,7 @@ char const * const httpcodeToStr(int httpcode) { /*{{{*/ } return NULL; } /*}}}*/ + void addFileHeaders(std::list &headers, FileFd &data) { /*{{{*/ std::ostringstream contentlength; contentlength << "Content-Length: " << data.FileSize(); @@ -98,6 +101,7 @@ bool sendHead(int client, int httpcode, std::list &headers) { /*{{{ std::clog << "<<<<<<<<<<<<<<<<" << std::endl; return Success; } /*}}}*/ + bool sendFile(int client, FileFd &data) { /*{{{*/ bool Success = true; char buffer[500]; @@ -110,12 +114,14 @@ bool sendFile(int client, FileFd &data) { /*{{{*/ Success &= FileFd::Write(client, "\r\n", 2); return Success; } /*}}}*/ + bool sendData(int client, std::string &data) { /*{{{*/ bool Success = true; Success &= FileFd::Write(client, data.c_str(), data.size()); Success &= FileFd::Write(client, "\r\n", 2); return Success; } /*}}}*/ + void sendError(int client, int httpcode, string request, bool content) { /*{{{*/ std::list headers; sendHead(client, httpcode, headers); @@ -131,6 +137,19 @@ void sendError(int client, int httpcode, string request, bool content) { /*{{{*/ int main(int argc, const char *argv[]) { + CommandLine::Args Args[] = { + {0, "simulate-paywall", "aptwebserver::Simulate-Paywall", + CommandLine::Boolean}, + {0, "port", "aptwebserver::port", CommandLine::HasArg}, + {0,0,0,0} + }; + + CommandLine CmdL(Args, _config); + if(pkgInitConfig(*_config) == false || CmdL.Parse(argc,argv) == false) { + _error->DumpErrors(); + exit(1); + } + // create socket, bind and listen to it {{{ int sock = socket(AF_INET6, SOCK_STREAM, 0); if(sock < 0 ) { @@ -139,6 +158,10 @@ int main(int argc, const char *argv[]) return 1; } + // get the port + int const port = _config->FindI("aptwebserver::port", 8080); + bool const simulate_broken_server = _config->FindB("aptwebserver::Simulate-Paywall", false); + // ensure that we accept all connections: v4 or v6 int const iponly = 0; setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &iponly, sizeof(iponly)); @@ -149,7 +172,7 @@ int main(int argc, const char *argv[]) struct sockaddr_in6 locAddr; memset(&locAddr, 0, sizeof(locAddr)); locAddr.sin6_family = AF_INET6; - locAddr.sin6_port = htons(8080); + locAddr.sin6_port = htons(port); locAddr.sin6_addr = in6addr_any; if (bind(sock, (struct sockaddr*) &locAddr, sizeof(locAddr)) < 0) { @@ -158,18 +181,26 @@ int main(int argc, const char *argv[]) return 2; } + if (simulate_broken_server) { + std::clog << "Simulating a broken web server that return nonsense " + "for all querries" << std::endl; + } else { + std::clog << "Serving ANY file on port: " << port << std::endl; + } + listen(sock, 1); - /*}}}*/ std::vector messages; int client; while ((client = accept(sock, NULL, NULL)) != -1) { - std::clog << "ACCEPT client " << client << " on socket " << sock << std::endl; + std::clog << "ACCEPT client " << client + << " on socket " << sock << std::endl; while (ReadMessages(client, messages)) { for (std::vector::const_iterator m = messages.begin(); m != messages.end(); ++m) { - std::clog << ">>> REQUEST >>>>" << std::endl << *m << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; + std::clog << ">>> REQUEST >>>>" << std::endl << *m + << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; std::list headers; bool sendContent = true; if (strncmp(m->c_str(), "HEAD ", 5) == 0) @@ -187,14 +218,20 @@ int main(int argc, const char *argv[]) size_t const filestart = m->find(' ', 5); string filename = m->substr(5, filestart - 5); - if (RealFileExists(filename) == false) + if (simulate_broken_server == true) { + sendHead(client, 200, headers); + string data("ni ni ni"); + sendData(client, data); + } + else if (RealFileExists(filename) == false) sendError(client, 404, *m, sendContent); else { FileFd data(filename, FileFd::ReadOnly); std::string condition = LookupTag(*m, "If-Modified-Since", ""); if (condition.empty() == false) { time_t cache; - if (RFC1123StrToTime(condition.c_str(), cache) == true && cache >= data.ModificationTime()) { + if (RFC1123StrToTime(condition.c_str(), cache) == true && + cache >= data.ModificationTime()) { sendError(client, 304, *m, false); continue; } @@ -209,7 +246,8 @@ int main(int argc, const char *argv[]) messages.clear(); } - std::clog << "CLOSE client " << client << " on socket " << sock << std::endl; + std::clog << "CLOSE client " << client + << " on socket " << sock << std::endl; close(client); } return 0; -- cgit v1.2.3 From da3ebfe79d570c3aeb5f0a407cfec7996f44420c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jul 2012 12:01:46 +0200 Subject: add failing regression test for bug #346386 --- test/integration/framework | 9 ++++++++- test/integration/test-ubuntu-bug346386 | 19 +++++++++++++++++++ test/interactive-helper/aptwebserver.cc | 8 ++++---- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100755 test/integration/test-ubuntu-bug346386 (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index a514bef20..bf46ae0c5 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -687,10 +687,17 @@ signreleasefiles() { msgdone "info" } +simulatebrokenwebserver() { + if ! test -x ${BUILDDIRECTORY}/aptwebserver; then + msgdie 'Need the aptwebserver to simulate broken connections' + fi + changetowebserver '--simulate-paywall' +} + changetowebserver() { if test -x ${BUILDDIRECTORY}/aptwebserver; then cd aptarchive - LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver 2> /dev/null > /dev/null & + LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> /dev/null > /dev/null & addtrap "kill $!;" cd - > /dev/null elif which weborf > /dev/null; then diff --git a/test/integration/test-ubuntu-bug346386 b/test/integration/test-ubuntu-bug346386 new file mode 100755 index 000000000..57004f343 --- /dev/null +++ b/test/integration/test-ubuntu-bug346386 @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' + +setupaptarchive +simulatebrokenwebserver + +rm -rf rootdir/var/lib/apt/lists +aptget update +testequal 'partial' "$(ls rootdir/var/lib/apt/lists/)" + + diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 3c476ad05..c7b815925 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -244,11 +244,11 @@ int main(int argc, const char *argv[]) } _error->DumpErrors(std::cerr); messages.clear(); - } - std::clog << "CLOSE client " << client - << " on socket " << sock << std::endl; - close(client); + std::clog << "CLOSE client " << client + << " on socket " << sock << std::endl; + close(client); + } } return 0; } -- cgit v1.2.3 From a38a00b981de3031a51e76c8a2e220b59557c469 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jul 2012 12:26:15 +0200 Subject: always send content-length via the new addDataHeaders() to ensure w3m/curl are happy too for 404 pages and to comply with the http 1.1 spec --- test/interactive-helper/aptwebserver.cc | 34 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index c7b815925..ebe04d2a3 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -78,6 +78,13 @@ void addFileHeaders(std::list &headers, FileFd &data) { /*{{{*/ lastmodified.append(TimeRFC1123(data.ModificationTime())); headers.push_back(lastmodified); } /*}}}*/ + +void addDataHeaders(std::list &headers, std::string &data) {/*{{{*/ + std::ostringstream contentlength; + contentlength << "Content-Length: " << data.size(); + headers.push_back(contentlength.str()); +} /*}}}*/ + bool sendHead(int client, int httpcode, std::list &headers) { /*{{{*/ string response("HTTP/1.1 "); response.append(httpcodeToStr(httpcode)); @@ -124,14 +131,16 @@ bool sendData(int client, std::string &data) { /*{{{*/ void sendError(int client, int httpcode, string request, bool content) { /*{{{*/ std::list headers; + string response; + if (content == true) { + response.append(""); + response.append(httpcodeToStr(httpcode)).append(""); + response.append("

").append(httpcodeToStr(httpcode)).append(""); + response.append(request).append(""); + addDataHeaders(headers, response); + } sendHead(client, httpcode, headers); - if (content == false) - return; - string response(""); - response.append(httpcodeToStr(httpcode)).append(""); - response.append("

").append(httpcodeToStr(httpcode)).append(""); - response.append(request).append(""); sendData(client, response); } /*}}}*/ @@ -219,8 +228,9 @@ int main(int argc, const char *argv[]) string filename = m->substr(5, filestart - 5); if (simulate_broken_server == true) { + string data("ni ni ni\n"); + addDataHeaders(headers, data); sendHead(client, 200, headers); - string data("ni ni ni"); sendData(client, data); } else if (RealFileExists(filename) == false) @@ -244,11 +254,11 @@ int main(int argc, const char *argv[]) } _error->DumpErrors(std::cerr); messages.clear(); - - std::clog << "CLOSE client " << client - << " on socket " << sock << std::endl; - close(client); } + + std::clog << "CLOSE client " << client + << " on socket " << sock << std::endl; + close(client); } return 0; } -- cgit v1.2.3 From 3ce22d4f714414d6deb8b044c5b08a8fe7a78967 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jul 2012 13:19:54 +0200 Subject: cleanup, thanks to donkult for his feedback --- test/integration/framework | 9 +++------ test/integration/test-ubuntu-bug346386 | 2 +- test/interactive-helper/aptwebserver.cc | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index bf46ae0c5..8f37d4a03 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -687,14 +687,11 @@ signreleasefiles() { msgdone "info" } -simulatebrokenwebserver() { - if ! test -x ${BUILDDIRECTORY}/aptwebserver; then - msgdie 'Need the aptwebserver to simulate broken connections' +changetowebserver() { + if [ -n "$1" ] && ! test -x ${BUILDDIRECTORY}/aptwebserver; then + msgdie 'Need the aptwebserver when passing arguments' fi - changetowebserver '--simulate-paywall' -} -changetowebserver() { if test -x ${BUILDDIRECTORY}/aptwebserver; then cd aptarchive LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> /dev/null > /dev/null & diff --git a/test/integration/test-ubuntu-bug346386 b/test/integration/test-ubuntu-bug346386 index 57004f343..a5f502853 100755 --- a/test/integration/test-ubuntu-bug346386 +++ b/test/integration/test-ubuntu-bug346386 @@ -10,7 +10,7 @@ configarchitecture 'amd64' buildsimplenativepackage 'apt' 'all' '1.0' 'stable' setupaptarchive -simulatebrokenwebserver +changetowebserver --simulate-paywall rm -rf rootdir/var/lib/apt/lists aptget update diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index ebe04d2a3..8fbb9eab9 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -154,7 +154,7 @@ int main(int argc, const char *argv[]) }; CommandLine CmdL(Args, _config); - if(pkgInitConfig(*_config) == false || CmdL.Parse(argc,argv) == false) { + if(CmdL.Parse(argc,argv) == false) { _error->DumpErrors(); exit(1); } -- cgit v1.2.3 From 549b49394848d051dc116600571df55d7160eeaa Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jul 2012 14:10:19 +0200 Subject: improve test some more --- test/integration/framework | 1 + test/integration/test-ubuntu-bug346386 | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 8f37d4a03..d15fd0e01 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -688,6 +688,7 @@ signreleasefiles() { } changetowebserver() { + if [ -n "$1" ] && ! test -x ${BUILDDIRECTORY}/aptwebserver; then msgdie 'Need the aptwebserver when passing arguments' fi diff --git a/test/integration/test-ubuntu-bug346386 b/test/integration/test-ubuntu-bug346386 index a5f502853..1fbfb5ca4 100755 --- a/test/integration/test-ubuntu-bug346386 +++ b/test/integration/test-ubuntu-bug346386 @@ -1,6 +1,24 @@ #!/bin/sh set -e +ensure_n_canary_strings_in_dir() { + DIR=$1 + CANARY_STRING=$2 + EXPECTED_N=$3 + + msgtest "Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in $DIR" + + + N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l ) + if [ "$N" = "$EXPECTED_N" ]; then + msgpass + return 0 + else + msgfail "Expected $EXPECTED_N canaries, got $N" + return 1 + fi +} + TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework @@ -13,7 +31,17 @@ setupaptarchive changetowebserver --simulate-paywall rm -rf rootdir/var/lib/apt/lists -aptget update -testequal 'partial' "$(ls rootdir/var/lib/apt/lists/)" +if aptget update -qq 2>/dev/null; then + msgfail "excpected apt-get update failure" +fi +ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ "ni ni ni" 0 +testequal 'partial' ls rootdir/var/lib/apt/lists/ +# again, this time with pre-existing files valid data +for f in Release Release.gpg main_binary-amd64_Packages stable_main_source_Sources; do + echo "canary" > rootdir/var/lib/apt/lists/localhost:8080_dists_stable_${f} +done +# this will fail, the important part is that the canaries remain +aptget update -qq 2>/dev/null || true +ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ "canary" 4 -- cgit v1.2.3 From 721b05b8501b3ffffcaef4d90b4f24e2a72b0fef Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Jul 2012 15:28:28 +0200 Subject: rename the paywall testcase and reformat it a bit --- .../test-ubuntu-bug-346386-apt-get-update-paywall | 47 ++++++++++++++++++++++ test/integration/test-ubuntu-bug346386 | 47 ---------------------- 2 files changed, 47 insertions(+), 47 deletions(-) create mode 100755 test/integration/test-ubuntu-bug-346386-apt-get-update-paywall delete mode 100755 test/integration/test-ubuntu-bug346386 (limited to 'test') diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall new file mode 100755 index 000000000..25cccf067 --- /dev/null +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +ensure_n_canary_strings_in_dir() { + DIR=$1 + CANARY_STRING=$2 + EXPECTED_N=$3 + + msgtest "Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in" "$DIR" + + N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l ) + if [ "$N" = "$EXPECTED_N" ]; then + msgpass + return 0 + else + msgfail "Expected $EXPECTED_N canaries, got $N" + return 1 + fi +} + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'native' + +insertpackage 'unstable' 'unrelated' 'all' '1.0' 'stable' + +setupaptarchive +changetowebserver --simulate-paywall + +rm -rf rootdir/var/lib/apt/lists +msgtest 'excpected failure of' 'apt-get update' +aptget update -qq 2>/dev/null && msgfail || msgpass + +ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ 'ni ni ni' 0 +testequal 'partial' ls rootdir/var/lib/apt/lists/ + +# again, this time with pre-existing files valid data +for f in Release Release.gpg main_binary-amd64_Packages stable_main_source_Sources; do + echo "canary" > rootdir/var/lib/apt/lists/localhost:8080_dists_stable_${f} +done + +# this will fail, the important part is that the canaries remain +msgtest 'excpected failure of' 'apt-get update' +aptget update -qq 2>/dev/null && msgfail || msgpass +ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ 'canary' 4 diff --git a/test/integration/test-ubuntu-bug346386 b/test/integration/test-ubuntu-bug346386 deleted file mode 100755 index 1fbfb5ca4..000000000 --- a/test/integration/test-ubuntu-bug346386 +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -set -e - -ensure_n_canary_strings_in_dir() { - DIR=$1 - CANARY_STRING=$2 - EXPECTED_N=$3 - - msgtest "Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in $DIR" - - - N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l ) - if [ "$N" = "$EXPECTED_N" ]; then - msgpass - return 0 - else - msgfail "Expected $EXPECTED_N canaries, got $N" - return 1 - fi -} - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework - -setupenvironment -configarchitecture 'amd64' - -buildsimplenativepackage 'apt' 'all' '1.0' 'stable' - -setupaptarchive -changetowebserver --simulate-paywall - -rm -rf rootdir/var/lib/apt/lists -if aptget update -qq 2>/dev/null; then - msgfail "excpected apt-get update failure" -fi -ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ "ni ni ni" 0 -testequal 'partial' ls rootdir/var/lib/apt/lists/ - -# again, this time with pre-existing files valid data -for f in Release Release.gpg main_binary-amd64_Packages stable_main_source_Sources; do - echo "canary" > rootdir/var/lib/apt/lists/localhost:8080_dists_stable_${f} -done -# this will fail, the important part is that the canaries remain -aptget update -qq 2>/dev/null || true -ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ "canary" 4 - -- cgit v1.2.3 From dc57a59b1e7a904ad7263245fa2b1d6a5a55655e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Jul 2012 18:00:11 +0200 Subject: reformat the aptwebserver code to look more like the rest of APT --- test/interactive-helper/aptwebserver.cc | 89 ++++++++++++++++----------------- 1 file changed, 44 insertions(+), 45 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 8fbb9eab9..97a298c70 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -18,7 +18,7 @@ #include #include -char const * const httpcodeToStr(int httpcode) { /*{{{*/ +char const * const httpcodeToStr(int const httpcode) { /*{{{*/ switch (httpcode) { // Informational 1xx case 100: return "100 Continue"; @@ -67,9 +67,9 @@ char const * const httpcodeToStr(int httpcode) { /*{{{*/ case 505: return "HTTP Version not supported"; } return NULL; -} /*}}}*/ - -void addFileHeaders(std::list &headers, FileFd &data) { /*{{{*/ +} + /*}}}*/ +void addFileHeaders(std::list &headers, FileFd &data) { /*{{{*/ std::ostringstream contentlength; contentlength << "Content-Length: " << data.FileSize(); headers.push_back(contentlength.str()); @@ -77,15 +77,15 @@ void addFileHeaders(std::list &headers, FileFd &data) { /*{{{*/ std::string lastmodified("Last-Modified: "); lastmodified.append(TimeRFC1123(data.ModificationTime())); headers.push_back(lastmodified); -} /*}}}*/ - +} + /*}}}*/ void addDataHeaders(std::list &headers, std::string &data) {/*{{{*/ std::ostringstream contentlength; contentlength << "Content-Length: " << data.size(); headers.push_back(contentlength.str()); -} /*}}}*/ - -bool sendHead(int client, int httpcode, std::list &headers) { /*{{{*/ +} + /*}}}*/ +bool sendHead(int const client, int const httpcode, std::list &headers) { /*{{{*/ string response("HTTP/1.1 "); response.append(httpcodeToStr(httpcode)); headers.push_front(response); @@ -107,9 +107,9 @@ bool sendHead(int client, int httpcode, std::list &headers) { /*{{{ Success &= FileFd::Write(client, "\r\n", 2); std::clog << "<<<<<<<<<<<<<<<<" << std::endl; return Success; -} /*}}}*/ - -bool sendFile(int client, FileFd &data) { /*{{{*/ +} + /*}}}*/ +bool sendFile(int const client, FileFd &data) { /*{{{*/ bool Success = true; char buffer[500]; unsigned long long actual = 0; @@ -120,34 +120,32 @@ bool sendFile(int client, FileFd &data) { /*{{{*/ } Success &= FileFd::Write(client, "\r\n", 2); return Success; -} /*}}}*/ - -bool sendData(int client, std::string &data) { /*{{{*/ +} + /*}}}*/ +bool sendData(int const client, std::string const &data) { /*{{{*/ bool Success = true; Success &= FileFd::Write(client, data.c_str(), data.size()); Success &= FileFd::Write(client, "\r\n", 2); return Success; -} /*}}}*/ - -void sendError(int client, int httpcode, string request, bool content) { /*{{{*/ +} + /*}}}*/ +void sendError(int const client, int const httpcode, string const &request, bool content) { /*{{{*/ std::list headers; - string response; - if (content == true) { - response.append(""); - response.append(httpcodeToStr(httpcode)).append(""); - response.append("

").append(httpcodeToStr(httpcode)).append(""); - response.append(request).append(""); - addDataHeaders(headers, response); - } + string response(""); + response.append(httpcodeToStr(httpcode)).append(""); + response.append("

").append(httpcodeToStr(httpcode)).append(""); + response.append(request).append(""); + addDataHeaders(headers, response); sendHead(client, httpcode, headers); - sendData(client, response); -} /*}}}*/ - -int main(int argc, const char *argv[]) + if (content == true) + sendData(client, response); +} + /*}}}*/ +int main(int const argc, const char * argv[]) { CommandLine::Args Args[] = { - {0, "simulate-paywall", "aptwebserver::Simulate-Paywall", + {0, "simulate-paywall", "aptwebserver::Simulate-Paywall", CommandLine::Boolean}, {0, "port", "aptwebserver::port", CommandLine::HasArg}, {0,0,0,0} @@ -198,18 +196,19 @@ int main(int argc, const char *argv[]) } listen(sock, 1); + /*}}}*/ std::vector messages; int client; while ((client = accept(sock, NULL, NULL)) != -1) { std::clog << "ACCEPT client " << client - << " on socket " << sock << std::endl; + << " on socket " << sock << std::endl; while (ReadMessages(client, messages)) { for (std::vector::const_iterator m = messages.begin(); m != messages.end(); ++m) { - std::clog << ">>> REQUEST >>>>" << std::endl << *m - << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; + std::clog << ">>> REQUEST >>>>" << std::endl << *m + << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; std::list headers; bool sendContent = true; if (strncmp(m->c_str(), "HEAD ", 5) == 0) @@ -227,12 +226,12 @@ int main(int argc, const char *argv[]) size_t const filestart = m->find(' ', 5); string filename = m->substr(5, filestart - 5); - if (simulate_broken_server == true) { - string data("ni ni ni\n"); - addDataHeaders(headers, data); - sendHead(client, 200, headers); - sendData(client, data); - } + if (simulate_broken_server == true) { + string data("ni ni ni\n"); + addDataHeaders(headers, data); + sendHead(client, 200, headers); + sendData(client, data); + } else if (RealFileExists(filename) == false) sendError(client, 404, *m, sendContent); else { @@ -240,8 +239,8 @@ int main(int argc, const char *argv[]) std::string condition = LookupTag(*m, "If-Modified-Since", ""); if (condition.empty() == false) { time_t cache; - if (RFC1123StrToTime(condition.c_str(), cache) == true && - cache >= data.ModificationTime()) { + if (RFC1123StrToTime(condition.c_str(), cache) == true && + cache >= data.ModificationTime()) { sendError(client, 304, *m, false); continue; } @@ -256,8 +255,8 @@ int main(int argc, const char *argv[]) messages.clear(); } - std::clog << "CLOSE client " << client - << " on socket " << sock << std::endl; + std::clog << "CLOSE client " << client + << " on socket " << sock << std::endl; close(client); } return 0; -- cgit v1.2.3 From d64053295c5544c62d7743c13bd415e42cf8f84d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Jul 2012 20:03:00 +0200 Subject: implement directory listing in your webserver --- test/interactive-helper/aptwebserver.cc | 95 +++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 97a298c70..0b2720dad 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -12,11 +12,13 @@ #include #include +#include #include #include #include #include #include +#include char const * const httpcodeToStr(int const httpcode) { /*{{{*/ switch (httpcode) { @@ -142,6 +144,86 @@ void sendError(int const client, int const httpcode, string const &request, bool sendData(client, response); } /*}}}*/ +// sendDirectoryLisiting /*{{{*/ +int filter_hidden_files(const struct dirent *a) { + if (a->d_name[0] == '.') + return 0; +#ifdef _DIRENT_HAVE_D_TYPE + // if we have the d_type check that only files and dirs will be included + if (a->d_type != DT_UNKNOWN && + a->d_type != DT_REG && + a->d_type != DT_LNK && // this includes links to regular files + a->d_type != DT_DIR) + return 0; +#endif + return 1; +} +int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { +#ifdef _DIRENT_HAVE_D_TYPE + if ((*a)->d_type == DT_DIR && (*b)->d_type == DT_DIR); + else if ((*a)->d_type == DT_DIR && (*b)->d_type == DT_REG) + return -1; + else if ((*b)->d_type == DT_DIR && (*a)->d_type == DT_REG) + return 1; + else +#endif + { + struct stat f_prop; //File's property + stat((*a)->d_name, &f_prop); + int const amode = f_prop.st_mode; + stat((*b)->d_name, &f_prop); + int const bmode = f_prop.st_mode; + if (S_ISDIR(amode) && S_ISDIR(bmode)); + else if (S_ISDIR(amode)) + return -1; + else if (S_ISDIR(bmode)) + return 1; + } + return strcasecmp((*a)->d_name, (*b)->d_name); +} +void sendDirectoryListing(int const client, string const &dir, string const &request, bool content) { + std::list headers; + std::ostringstream listing; + + struct dirent **namelist; + int const counter = scandir(dir.c_str(), &namelist, filter_hidden_files, grouped_alpha_case_sort); + if (counter == -1) { + sendError(client, 500, request, content); + return; + } + + listing << "Index of " << dir << "" + << "" + << "" << std::endl + << "

Index of " << dir << "

" << std::endl + << "" << std::endl; + if (dir != ".") + listing << ""; + for (int i = 0; i < counter; ++i) { + struct stat fs; + std::string filename(dir); + filename.append("/").append(namelist[i]->d_name); + stat(filename.c_str(), &fs); + listing << "" + << ""; + if (S_ISDIR(fs.st_mode)) + listing << ""; + else + listing << ""; + listing << "" << std::endl; + } + listing << "
#NameSizeLast-Modified
dParent Directory--
" << ((S_ISDIR(fs.st_mode)) ? 'd' : 'f') << "d_name << "\">" << namelist[i]->d_name << "-" << SizeToStr(fs.st_size) << "B" << TimeRFC1123(fs.st_mtime) << "
" << std::endl; + + std::string response(listing.str()); + addDataHeaders(headers, response); + sendHead(client, 200, headers); + if (content == true) + sendData(client, response); +} + /*}}}*/ int main(int const argc, const char * argv[]) { CommandLine::Args Args[] = { @@ -225,6 +307,8 @@ int main(int const argc, const char * argv[]) size_t const filestart = m->find(' ', 5); string filename = m->substr(5, filestart - 5); + if (filename.empty() == true) + filename = "."; if (simulate_broken_server == true) { string data("ni ni ni\n"); @@ -232,16 +316,14 @@ int main(int const argc, const char * argv[]) sendHead(client, 200, headers); sendData(client, data); } - else if (RealFileExists(filename) == false) - sendError(client, 404, *m, sendContent); - else { + else if (RealFileExists(filename) == true) { FileFd data(filename, FileFd::ReadOnly); std::string condition = LookupTag(*m, "If-Modified-Since", ""); if (condition.empty() == false) { time_t cache; if (RFC1123StrToTime(condition.c_str(), cache) == true && cache >= data.ModificationTime()) { - sendError(client, 304, *m, false); + sendHead(client, 304, headers); continue; } } @@ -250,6 +332,11 @@ int main(int const argc, const char * argv[]) if (sendContent == true) sendFile(client, data); } + else if (DirectoryExists(filename) == true) { + sendDirectoryListing(client, filename, *m, sendContent); + } + else + sendError(client, 404, *m, false); } _error->DumpErrors(std::cerr); messages.clear(); -- cgit v1.2.3 From 4958ba98e66af264e1f03f5dbacc713e51cd437d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Jul 2012 20:05:05 +0200 Subject: include our usual config.h in the webserver --- test/interactive-helper/aptwebserver.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 0b2720dad..0780288a4 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -88,7 +90,7 @@ void addDataHeaders(std::list &headers, std::string &data) {/*{{{*/ } /*}}}*/ bool sendHead(int const client, int const httpcode, std::list &headers) { /*{{{*/ - string response("HTTP/1.1 "); + std::string response("HTTP/1.1 "); response.append(httpcodeToStr(httpcode)); headers.push_front(response); @@ -131,9 +133,9 @@ bool sendData(int const client, std::string const &data) { /*{{{*/ return Success; } /*}}}*/ -void sendError(int const client, int const httpcode, string const &request, bool content) { /*{{{*/ +void sendError(int const client, int const httpcode, std::string const &request, bool content) { /*{{{*/ std::list headers; - string response(""); + std::string response("<html><head><title>"); response.append(httpcodeToStr(httpcode)).append(""); response.append("

").append(httpcodeToStr(httpcode)).append(""); @@ -181,7 +183,7 @@ int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { } return strcasecmp((*a)->d_name, (*b)->d_name); } -void sendDirectoryListing(int const client, string const &dir, string const &request, bool content) { +void sendDirectoryListing(int const client, std::string const &dir, std::string const &request, bool content) { std::list headers; std::ostringstream listing; @@ -306,12 +308,12 @@ int main(int const argc, const char * argv[]) } size_t const filestart = m->find(' ', 5); - string filename = m->substr(5, filestart - 5); + std::string filename = m->substr(5, filestart - 5); if (filename.empty() == true) filename = "."; if (simulate_broken_server == true) { - string data("ni ni ni\n"); + std::string data("ni ni ni\n"); addDataHeaders(headers, data); sendHead(client, 200, headers); sendData(client, data); -- cgit v1.2.3 From 59fe94ea0135b1f8bc3d66e97460bd481054b061 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Jul 2012 20:08:58 +0200 Subject: http get requests need to be dequoted --- test/interactive-helper/aptwebserver.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 0780288a4..920ab3bcc 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -311,6 +311,8 @@ int main(int const argc, const char * argv[]) std::string filename = m->substr(5, filestart - 5); if (filename.empty() == true) filename = "."; + else + filename = DeQuoteString(filename); if (simulate_broken_server == true) { std::string data("ni ni ni\n"); -- cgit v1.2.3 From 64a28515923aa67a1d109a82aba1892cd227bb15 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 Jul 2012 00:46:27 +0200 Subject: ensure that directories are accessed with a slash at the end of the url --- test/interactive-helper/aptwebserver.cc | 40 +++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 920ab3bcc..2052fe6d8 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -146,6 +146,26 @@ void sendError(int const client, int const httpcode, std::string const &request, sendData(client, response); } /*}}}*/ +void sendRedirect(int const client, int const httpcode, std::string const &uri, std::string const &request, bool content) { /*{{{*/ + std::list headers; + std::string response(""); + response.append(httpcodeToStr(httpcode)).append(""); + response.append("

").append(httpcodeToStr(httpcode)).append("You should be redirected to ").append(uri).append("

"); + response.append("This page is a result of the request:
");
+   response.append(request).append("
"); + addDataHeaders(headers, response); + std::string location("Location: "); + if (strncmp(uri.c_str(), "http://", 7) != 0) + location.append("http://").append(LookupTag(request, "Host")).append("/").append(uri); + else + location.append(uri); + headers.push_back(location); + sendHead(client, httpcode, headers); + if (content == true) + sendData(client, response); +} + /*}}}*/ // sendDirectoryLisiting /*{{{*/ int filter_hidden_files(const struct dirent *a) { if (a->d_name[0] == '.') @@ -209,12 +229,15 @@ void sendDirectoryListing(int const client, std::string const &dir, std::string std::string filename(dir); filename.append("/").append(namelist[i]->d_name); stat(filename.c_str(), &fs); - listing << "" << ((S_ISDIR(fs.st_mode)) ? 'd' : 'f') << "" - << "d_name << "\">" << namelist[i]->d_name << ""; - if (S_ISDIR(fs.st_mode)) - listing << "-"; - else - listing << "" << SizeToStr(fs.st_size) << "B"; + if (S_ISDIR(fs.st_mode)) { + listing << "d" + << "d_name << "/\">" << namelist[i]->d_name << "" + << "-"; + } else { + listing << "f" + << "d_name << "\">" << namelist[i]->d_name << "" + << "" << SizeToStr(fs.st_size) << "B"; + } listing << "" << TimeRFC1123(fs.st_mtime) << "" << std::endl; } listing << "" << std::endl; @@ -337,7 +360,10 @@ int main(int const argc, const char * argv[]) sendFile(client, data); } else if (DirectoryExists(filename) == true) { - sendDirectoryListing(client, filename, *m, sendContent); + if (filename == "." || filename[filename.length()-1] == '/') + sendDirectoryListing(client, filename, *m, sendContent); + else + sendRedirect(client, 301, filename.append("/"), *m, sendContent); } else sendError(client, 404, *m, false); -- cgit v1.2.3 From 3522b1a8f16f45cf9c0c45b8b86cc886f1368df4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 Jul 2012 10:39:51 +0200 Subject: do not hardcode /dev/null in changetowebserver so it can be changed for debugging easily --- test/integration/framework | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index d15fd0e01..965f984ca 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -688,30 +688,30 @@ signreleasefiles() { } changetowebserver() { + if [ -n "$1" ] && ! test -x ${BUILDDIRECTORY}/aptwebserver; then + msgdie 'Need the aptwebserver when passing arguments' + fi - if [ -n "$1" ] && ! test -x ${BUILDDIRECTORY}/aptwebserver; then - msgdie 'Need the aptwebserver when passing arguments' - fi - + local LOG='/dev/null' if test -x ${BUILDDIRECTORY}/aptwebserver; then cd aptarchive - LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> /dev/null > /dev/null & + LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> $LOG > $LOG & addtrap "kill $!;" cd - > /dev/null elif which weborf > /dev/null; then - weborf -xb aptarchive/ 2>&1 > /dev/null & + weborf -xb aptarchive/ 2> $LOG > $LOG & addtrap "kill $!;" elif which gatling > /dev/null; then cd aptarchive - gatling -p 8080 -F -S 2>&1 > /dev/null & + gatling -p 8080 -F -S 2> $LOG > $LOG & addtrap "kill $!;" cd - > /dev/null elif which lighttpd > /dev/null; then echo "server.document-root = \"$(readlink -f ./aptarchive)\" server.port = 8080 server.stat-cache-engine = \"disable\"" > lighttpd.conf - lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid' - lighttpd -D -f lighttpd.conf 2>/dev/null >/dev/null & + lighttpd -t -f lighttpd.conf 2> $LOG > $LOG || msgdie 'Can not change to webserver: our lighttpd config is invalid' + lighttpd -D -f lighttpd.conf 2> $LOG > $LOG & addtrap "kill $!;" else msgdie 'You have to install weborf or lighttpd first' -- cgit v1.2.3 From d37911acee3eb34368e6d9e6a0046c9150d2bce6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 Jul 2012 11:07:54 +0200 Subject: add simple url rewriting to the webserver --- test/integration/skip-bug-602412-dequote-redirect | 38 ----------------------- test/integration/test-bug-602412-dequote-redirect | 29 +++++++++++++++++ test/interactive-helper/aptwebserver.cc | 19 ++++++++++-- 3 files changed, 46 insertions(+), 40 deletions(-) delete mode 100755 test/integration/skip-bug-602412-dequote-redirect create mode 100755 test/integration/test-bug-602412-dequote-redirect (limited to 'test') diff --git a/test/integration/skip-bug-602412-dequote-redirect b/test/integration/skip-bug-602412-dequote-redirect deleted file mode 100755 index 689b671ce..000000000 --- a/test/integration/skip-bug-602412-dequote-redirect +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework -setupenvironment -configarchitecture 'i386' - -if ! which lighttpd > /dev/null; then - msgdie 'You need lighttpd for this testcase, sorry…' - exit 1 -fi - -buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' - -setupaptarchive - -echo "server.modules = ( \"mod_redirect\" ) -server.document-root = \"$(readlink -f ./aptarchive)\" -server.port = 8080 -server.stat-cache-engine = \"disable\" -url.redirect = ( \"^/pool/(.*)$\" => \"/newpool/\$1\", - \"^/dists/(.*)$\" => \"/newdists/\$1\" )" > lighttpd.conf - -mv aptarchive/pool aptarchive/newpool -mv aptarchive/dists aptarchive/newdists - -lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid' -lighttpd -D -f lighttpd.conf 2>/dev/null >/dev/null & -addtrap "kill $!;" - -APTARCHIVE="file://$(readlink -f ./aptarchive)" -for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do - sed -i $LIST -e "s#$APTARCHIVE#http://localhost:8080/#" -done - -aptget update || msgdie 'apt-get update failed' -aptget install unrelated --download-only || msgdie 'downloading package failed' diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect new file mode 100755 index 000000000..f1e67c6d8 --- /dev/null +++ b/test/integration/test-bug-602412-dequote-redirect @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' + +setupaptarchive +changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \ + -o aptwebserver::redirect::replace::/dists/=/newdists/ + +mv aptarchive/pool aptarchive/newpool +mv aptarchive/dists aptarchive/newdists + +msgtest 'Test redirection works in' 'apt-get update' +aptget update -qq && msgpass || msgfail + +# check that I-M-S header is kept in redirections +testequal 'Hit http://localhost unstable InRelease +Hit http://localhost unstable/main Sources +Hit http://localhost unstable/main amd64 Packages +Hit http://localhost unstable/main Translation-en +Reading package lists...' aptget update + +msgtest 'Test redirection works in' 'package download' +aptget install unrelated --download-only -qq && msgpass || msgfail diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 2052fe6d8..7fa322ea9 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -137,7 +137,7 @@ void sendError(int const client, int const httpcode, std::string const &request, std::list headers; std::string response(""); response.append(httpcodeToStr(httpcode)).append(""); - response.append("

").append(httpcodeToStr(httpcode)).append("

").append(httpcodeToStr(httpcode)).append("

"); response.append("This error is a result of the request:
");
    response.append(request).append("
"); addDataHeaders(headers, response); @@ -255,6 +255,8 @@ int main(int const argc, const char * argv[]) {0, "simulate-paywall", "aptwebserver::Simulate-Paywall", CommandLine::Boolean}, {0, "port", "aptwebserver::port", CommandLine::HasArg}, + {'c',"config-file",0,CommandLine::ConfigFile}, + {'o',"option",0,CommandLine::ArbItem}, {0,0,0,0} }; @@ -366,7 +368,20 @@ int main(int const argc, const char * argv[]) sendRedirect(client, 301, filename.append("/"), *m, sendContent); } else - sendError(client, 404, *m, false); + { + ::Configuration::Item const *Replaces = _config->Tree("aptwebserver::redirect::replace"); + if (Replaces != NULL) { + std::string redirect = "/" + filename; + for (::Configuration::Item *I = Replaces->Child; I != NULL; I = I->Next) + redirect = SubstVar(redirect, I->Tag, I->Value); + redirect.erase(0,1); + if (redirect != filename) { + sendRedirect(client, 301, redirect, *m, sendContent); + continue; + } + } + sendError(client, 404, *m, sendContent); + } } _error->DumpErrors(std::cerr); messages.clear(); -- cgit v1.2.3 From 7a1bed9d453379fcd22489bdb9f81f377abcaae2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 Jul 2012 17:11:26 +0200 Subject: rework parsing of the first request-line to be more robust --- test/interactive-helper/aptwebserver.cc | 106 ++++++++++++++++++++++---------- 1 file changed, 75 insertions(+), 31 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 7fa322ea9..4746aed96 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -51,24 +51,24 @@ char const * const httpcodeToStr(int const httpcode) { /*{{{*/ case 404: return "404 Not Found"; case 405: return "405 Method Not Allowed"; case 406: return "406 Not Acceptable"; - case 407: return "Proxy Authentication Required"; - case 408: return "Request Time-out"; - case 409: return "Conflict"; - case 410: return "Gone"; - case 411: return "Length Required"; - case 412: return "Precondition Failed"; - case 413: return "Request Entity Too Large"; - case 414: return "Request-URI Too Large"; - case 415: return "Unsupported Media Type"; - case 416: return "Requested range not satisfiable"; - case 417: return "Expectation Failed"; + case 407: return "407 Proxy Authentication Required"; + case 408: return "408 Request Time-out"; + case 409: return "409 Conflict"; + case 410: return "410 Gone"; + case 411: return "411 Length Required"; + case 412: return "412 Precondition Failed"; + case 413: return "413 Request Entity Too Large"; + case 414: return "414 Request-URI Too Large"; + case 415: return "415 Unsupported Media Type"; + case 416: return "416 Requested range not satisfiable"; + case 417: return "417 Expectation Failed"; // Server error 5xx - case 500: return "Internal Server Error"; - case 501: return "Not Implemented"; - case 502: return "Bad Gateway"; - case 503: return "Service Unavailable"; - case 504: return "Gateway Time-out"; - case 505: return "HTTP Version not supported"; + case 500: return "500 Internal Server Error"; + case 501: return "501 Not Implemented"; + case 502: return "502 Bad Gateway"; + case 503: return "503 Service Unavailable"; + case 504: return "504 Gateway Time-out"; + case 505: return "505 HTTP Version not supported"; } return NULL; } @@ -133,11 +133,13 @@ bool sendData(int const client, std::string const &data) { /*{{{*/ return Success; } /*}}}*/ -void sendError(int const client, int const httpcode, std::string const &request, bool content) { /*{{{*/ +void sendError(int const client, int const httpcode, std::string const &request, bool content, std::string const &error = "") { /*{{{*/ std::list headers; std::string response(""); response.append(httpcodeToStr(httpcode)).append(""); response.append("

").append(httpcodeToStr(httpcode)).append("

"); + if (error.empty() == false) + response.append("

Error: ").append(error).append("

"); response.append("This error is a result of the request:
");
    response.append(request).append("
"); addDataHeaders(headers, response); @@ -249,6 +251,55 @@ void sendDirectoryListing(int const client, std::string const &dir, std::string sendData(client, response); } /*}}}*/ +bool parseFirstLine(int const client, std::string const &request, std::string &filename, bool &sendContent) { /*{{{*/ + if (strncmp(request.c_str(), "HEAD ", 5) == 0) + sendContent = false; + if (strncmp(request.c_str(), "GET ", 4) != 0) + { + sendError(client, 501, request, true); + return false; + } + + size_t const lineend = request.find('\n'); + size_t filestart = request.find(' '); + for (; request[filestart] == ' '; ++filestart); + size_t fileend = request.rfind(' ', lineend); + if (lineend == std::string::npos || filestart == std::string::npos || + fileend == std::string::npos || filestart == fileend) { + sendError(client, 500, request, sendContent, "Filename can't be extracted"); + return false; + } + + size_t httpstart = fileend; + for (; request[httpstart] == ' '; ++httpstart); + if (strncmp(request.c_str() + httpstart, "HTTP/1.1\r", 9) != 0) { + sendError(client, 500, request, sendContent, "Not an HTTP/1.1 request"); + return false; + } + + filename = request.substr(filestart, fileend - filestart); + if (filename.find(' ') != std::string::npos) { + sendError(client, 500, request, sendContent, "Filename contains an unencoded space"); + return false; + } + filename = DeQuoteString(filename); + + // this is not a secure server, but at least prevent the obvious … + if (filename.empty() == true || filename[0] != '/' || + strncmp(filename.c_str(), "//", 2) == 0 || + filename.find_first_of("\r\n\t\f\v") != std::string::npos || + filename.find("/../") != std::string::npos) { + sendError(client, 400, request, sendContent, "Filename contains illegal character (sequence)"); + return false; + } + + // nuke the first character which is a / as we assured above + filename.erase(0, 1); + if (filename.empty() == true) + filename = "."; + return true; +} + /*}}}*/ int main(int const argc, const char * argv[]) { CommandLine::Args Args[] = { @@ -318,27 +369,20 @@ int main(int const argc, const char * argv[]) m != messages.end(); ++m) { std::clog << ">>> REQUEST >>>>" << std::endl << *m << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; + std::list headers; + std::string filename; bool sendContent = true; - if (strncmp(m->c_str(), "HEAD ", 5) == 0) - sendContent = false; - if (strncmp(m->c_str(), "GET ", 4) != 0) - sendError(client, 501, *m, true); + if (parseFirstLine(client, *m, filename, sendContent) == false) + continue; std::string host = LookupTag(*m, "Host", ""); if (host.empty() == true) { - // RFC 2616 §14.23 Host - sendError(client, 400, *m, sendContent); + // RFC 2616 §14.23 requires Host + sendError(client, 400, *m, sendContent, "Host header is required"); continue; } - size_t const filestart = m->find(' ', 5); - std::string filename = m->substr(5, filestart - 5); - if (filename.empty() == true) - filename = "."; - else - filename = DeQuoteString(filename); - if (simulate_broken_server == true) { std::string data("ni ni ni\n"); addDataHeaders(headers, data); -- cgit v1.2.3 From 57d13de2fb64a97d1a43d493c253ad2132ffd566 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 Jul 2012 18:43:53 +0200 Subject: make the server a little more robust against write errors (e.g. broken pipe) --- test/interactive-helper/aptwebserver.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 4746aed96..dbc4a19e0 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -21,6 +21,7 @@ #include #include #include +#include char const * const httpcodeToStr(int const httpcode) { /*{{{*/ switch (httpcode) { @@ -105,10 +106,12 @@ bool sendHead(int const client, int const httpcode, std::list &head for (std::list::const_iterator h = headers.begin(); Success == true && h != headers.end(); ++h) { Success &= FileFd::Write(client, h->c_str(), h->size()); - Success &= FileFd::Write(client, "\r\n", 2); + if (Success == true) + Success &= FileFd::Write(client, "\r\n", 2); std::clog << *h << std::endl; } - Success &= FileFd::Write(client, "\r\n", 2); + if (Success == true) + Success &= FileFd::Write(client, "\r\n", 2); std::clog << "<<<<<<<<<<<<<<<<" << std::endl; return Success; } @@ -122,14 +125,16 @@ bool sendFile(int const client, FileFd &data) { /*{{{*/ break; Success &= FileFd::Write(client, buffer, actual); } - Success &= FileFd::Write(client, "\r\n", 2); + if (Success == true) + Success &= FileFd::Write(client, "\r\n", 2); return Success; } /*}}}*/ bool sendData(int const client, std::string const &data) { /*{{{*/ bool Success = true; Success &= FileFd::Write(client, data.c_str(), data.size()); - Success &= FileFd::Write(client, "\r\n", 2); + if (Success == true) + Success &= FileFd::Write(client, "\r\n", 2); return Success; } /*}}}*/ @@ -318,6 +323,8 @@ int main(int const argc, const char * argv[]) } // create socket, bind and listen to it {{{ + // ignore SIGPIPE, this can happen on write() if the socket closes connection + signal(SIGPIPE, SIG_IGN); int sock = socket(AF_INET6, SOCK_STREAM, 0); if(sock < 0 ) { _error->Errno("aptwerbserver", "Couldn't create socket"); -- cgit v1.2.3 From 06b3095f81d9a730e8cb95274c8208cb0604cdfe Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 Jul 2012 19:11:24 +0200 Subject: add option to send Content-Type based on file extension --- test/interactive-helper/aptwebserver.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index dbc4a19e0..4ef9631b8 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -82,6 +82,18 @@ void addFileHeaders(std::list &headers, FileFd &data) { /*{{{*/ std::string lastmodified("Last-Modified: "); lastmodified.append(TimeRFC1123(data.ModificationTime())); headers.push_back(lastmodified); + + std::string const fileext = flExtension(data.Name()); + if (fileext.empty() == false && fileext != data.Name()) { + std::string confcontenttype("aptwebserver::ContentType::"); + confcontenttype.append(fileext); + std::string const contenttype = _config->Find(confcontenttype); + if (contenttype.empty() == false) { + std::string header("Content-Type: "); + header.append(contenttype); + headers.push_back(header); + } + } } /*}}}*/ void addDataHeaders(std::list &headers, std::string &data) {/*{{{*/ -- cgit v1.2.3 From 056c36565706cad136df288db777c01555f4ecd9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 12 Jul 2012 12:04:36 +0200 Subject: add (partial) partial request support for the webserver --- test/interactive-helper/aptwebserver.cc | 71 +++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 4ef9631b8..ff60d64a3 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -35,7 +35,7 @@ char const * const httpcodeToStr(int const httpcode) { /*{{{*/ case 203: return "203 Non-Authoritative Information"; case 204: return "204 No Content"; case 205: return "205 Reset Content"; - case 206: return "206 Partial Conent"; + case 206: return "206 Partial Content"; // Redirections 3xx case 300: return "300 Multiple Choices"; case 301: return "301 Moved Permanently"; @@ -113,6 +113,8 @@ bool sendHead(int const client, int const httpcode, std::list &head date.append(TimeRFC1123(time(NULL))); headers.push_back(date); + headers.push_back("Accept-Ranges: bytes"); + std::clog << ">>> RESPONSE >>>" << std::endl; bool Success = true; for (std::list::const_iterator h = headers.begin(); @@ -135,7 +137,8 @@ bool sendFile(int const client, FileFd &data) { /*{{{*/ while ((Success &= data.Read(buffer, sizeof(buffer), &actual)) == true) { if (actual == 0) break; - Success &= FileFd::Write(client, buffer, actual); + if (Success == true) + Success &= FileFd::Write(client, buffer, actual); } if (Success == true) Success &= FileFd::Write(client, "\r\n", 2); @@ -268,7 +271,7 @@ void sendDirectoryListing(int const client, std::string const &dir, std::string sendData(client, response); } /*}}}*/ -bool parseFirstLine(int const client, std::string const &request, std::string &filename, bool &sendContent) { /*{{{*/ +bool parseFirstLine(int const client, std::string const &request, std::string &filename, bool &sendContent, bool &closeConnection) { /*{{{*/ if (strncmp(request.c_str(), "HEAD ", 5) == 0) sendContent = false; if (strncmp(request.c_str(), "GET ", 4) != 0) @@ -289,8 +292,12 @@ bool parseFirstLine(int const client, std::string const &request, std::string &f size_t httpstart = fileend; for (; request[httpstart] == ' '; ++httpstart); - if (strncmp(request.c_str() + httpstart, "HTTP/1.1\r", 9) != 0) { - sendError(client, 500, request, sendContent, "Not an HTTP/1.1 request"); + if (strncmp(request.c_str() + httpstart, "HTTP/1.1\r", 9) == 0) + closeConnection = strcasecmp(LookupTag(request, "Connection", "Keep-Alive").c_str(), "Keep-Alive") != 0; + else if (strncmp(request.c_str() + httpstart, "HTTP/1.0\r", 9) == 0) + closeConnection = strcasecmp(LookupTag(request, "Connection", "Keep-Alive").c_str(), "close") == 0; + else { + sendError(client, 500, request, sendContent, "Not an HTTP/1.{0,1} request"); return false; } @@ -384,15 +391,15 @@ int main(int const argc, const char * argv[]) << " on socket " << sock << std::endl; while (ReadMessages(client, messages)) { + bool closeConnection = false; for (std::vector::const_iterator m = messages.begin(); - m != messages.end(); ++m) { + m != messages.end() && closeConnection == false; ++m) { std::clog << ">>> REQUEST >>>>" << std::endl << *m << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; - std::list headers; std::string filename; bool sendContent = true; - if (parseFirstLine(client, *m, filename, sendContent) == false) + if (parseFirstLine(client, *m, filename, sendContent, closeConnection) == false) continue; std::string host = LookupTag(*m, "Host", ""); @@ -419,6 +426,52 @@ int main(int const argc, const char * argv[]) continue; } } + condition = LookupTag(*m, "If-Range", ""); + bool ignoreRange = false; + if (condition.empty() == false) { + time_t cache; + if (RFC1123StrToTime(condition.c_str(), cache) == false || + cache < data.ModificationTime()) + ignoreRange = true; + } + condition = LookupTag(*m, "Range", ""); + if (ignoreRange == false && condition.empty() == false && + strncmp(condition.c_str(), "bytes=", 6) == 0) { + size_t end = condition.find(','); + // FIXME: support multiple byte-ranges + if (end == std::string::npos) { + size_t start = 6; + unsigned long long filestart = strtoull(condition.c_str() + start, NULL, 10); + // FIXME: no fileend support + size_t dash = condition.find('-') + 1; + unsigned long long fileend = strtoull(condition.c_str() + dash, NULL, 10); + unsigned long long filesize = data.FileSize(); + if (fileend == 0 || fileend == filesize) { + if (filesize > filestart) { + data.Skip(filestart); + std::ostringstream contentlength; + contentlength << "Content-Length: " << (filesize - filestart); + headers.push_back(contentlength.str()); + std::ostringstream contentrange; + contentrange << "Content-Range: bytes " << filestart << "-" + << filesize - 1 << "/" << filesize; + headers.push_back(contentrange.str()); + sendHead(client, 206, headers); + if (sendContent == true) + sendFile(client, data); + continue; + } else { + headers.push_back("Content-Length: 0"); + std::ostringstream contentrange; + contentrange << "Content-Range: bytes 0-0/" << filesize; + headers.push_back(contentrange.str()); + sendHead(client, 416, headers); + continue; + } + } + } + } + addFileHeaders(headers, data); sendHead(client, 200, headers); if (sendContent == true) @@ -448,6 +501,8 @@ int main(int const argc, const char * argv[]) } _error->DumpErrors(std::cerr); messages.clear(); + if (closeConnection == true) + break; } std::clog << "CLOSE client " << client -- cgit v1.2.3 From 8d01b9d692f49309235e710b79937baf605fda3d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 4 Sep 2012 12:21:29 +0200 Subject: add "Glob()" to fileutl --- test/libapt/fileutl_test.cc | 42 ++++++++++++++++++++++++++++++++++++++++++ test/libapt/makefile | 6 ++++++ 2 files changed, 48 insertions(+) create mode 100644 test/libapt/fileutl_test.cc (limited to 'test') diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc new file mode 100644 index 000000000..b6b8ac579 --- /dev/null +++ b/test/libapt/fileutl_test.cc @@ -0,0 +1,42 @@ +#include +#include + +#include "assert.h" +#include +#include + +#include +#include +#include + + +int main(int argc,char *argv[]) +{ + std::vector files; + + // normal match + files = Glob("*.lst"); + if (files.size() != 1) + { + _error->DumpErrors(); + return 1; + } + + // not there + files = Glob("xxxyyyzzz"); + if (files.size() != 0 || _error->PendingError()) + { + _error->DumpErrors(); + return 1; + } + + // many matches (number is a bit random) + files = Glob("*.cc"); + if (files.size() < 10) + { + _error->DumpErrors(); + return 1; + } + + return 0; +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 1952051e2..1e3652e00 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -80,3 +80,9 @@ PROGRAM = CdromFindPackages${BASENAME} SLIBS = -lapt-pkg SOURCE = cdromfindpackages_test.cc include $(PROGRAM_H) + +# test fileutls +PROGRAM = FileUtl${BASENAME} +SLIBS = -lapt-pkg +SOURCE = fileutl_test.cc +include $(PROGRAM_H) -- cgit v1.2.3 From d016834e39f668449385b1668240bdf905d62ade Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 28 Sep 2012 14:43:39 +0200 Subject: add new ClearAll --- test/libapt/configuration_test.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 9a3e2c118..5ec48834a 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -80,6 +80,10 @@ int main(int argc,const char *argv[]) { equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt"); equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude"); + Cnf.Set("Moo::Bar", "1"); + Cnf.ClearAll(); + equals(Cnf.Find("Moo::Bar"), ""); + //FIXME: Test for configuration file parsing; // currently only integration/ tests test them implicitly -- cgit v1.2.3 From 62b66f2593293aea5b42185fd2a2eb9d6e4d0cf2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 1 Oct 2012 15:05:43 +0200 Subject: rename CleaAll() -> Clear() --- test/libapt/configuration_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 5ec48834a..5120e86c9 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -81,7 +81,7 @@ int main(int argc,const char *argv[]) { equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude"); Cnf.Set("Moo::Bar", "1"); - Cnf.ClearAll(); + Cnf.Clear(); equals(Cnf.Find("Moo::Bar"), ""); //FIXME: Test for configuration file parsing; -- cgit v1.2.3 From 30c54ac89ce01b93b42a9a37d3edd9837d0f34bb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 31 Jan 2013 06:27:20 +0100 Subject: test/integration/test-debsrc-hashes: add integration test, thanks to Daniel Hartwig --- test/integration/test-debsrc-hashes | 77 +++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 test/integration/test-debsrc-hashes (limited to 'test') diff --git a/test/integration/test-debsrc-hashes b/test/integration/test-debsrc-hashes new file mode 100755 index 000000000..5e917232b --- /dev/null +++ b/test/integration/test-debsrc-hashes @@ -0,0 +1,77 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# pkg-sha256-bad has a bad SHA sum, but good MD5 sum. If apt is +# checking the best available hash (as it should), this will trigger +# a hash mismatch. + +cat > aptarchive/Sources < +Architecture: i386 +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.tar.gz + +Package: pkg-sha256-ok +Binary: pkg-sha256-ok +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: i386 +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.tar.gz + +Package: pkg-sha256-bad +Binary: pkg-sha256-bad +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: i386 +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.tar.gz +Checksums-Sha256: + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.dsc + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.tar.gz +EOF + +# create fetchable files +for x in "pkg-md5-ok" "pkg-sha256-ok" "pkg-sha256-bad"; do + touch aptarchive/${x}_1.0.dsc + touch aptarchive/${x}_1.0.tar.gz +done + +testok() { + msgtest "Test for hash ok of" "$*" + $* 2>&1 | grep "Download complete" > /dev/null && msgpass || msgfail +} + +testmismatch() { + msgtest "Test for hash mismatch of" "$*" + $* 2>&1 | grep "Hash Sum mismatch" > /dev/null && msgpass || msgfail +} + +setupaptarchive +changetowebserver +aptget update -qq + +testok aptget source -d pkg-md5-ok +testok aptget source -d pkg-sha256-ok +testmismatch aptget source -d pkg-sha256-bad -- cgit v1.2.3 From ce928105d7279c5604f034740b04dc6a745fb859 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Apr 2014 14:30:17 +0200 Subject: Implement CacheDB for source packages in apt-ftparchive --- test/integration/framework | 5 +- test/integration/test-apt-ftparchive | 164 +++++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+), 1 deletion(-) create mode 100755 test/integration/test-apt-ftparchive (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 1c6f041b0..fae21eac4 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -128,7 +128,10 @@ dpkgcheckbuilddeps() { } gdb() { echo "gdb: run »$*«" - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$1 --args "$@" + CMD="$1" + shift + + APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$CMD --args ${BUILDDIRECTORY}/$CMD "$@" } gpg() { # see apt-key for the whole trickery. Setup is done in setupenvironment diff --git a/test/integration/test-apt-ftparchive b/test/integration/test-apt-ftparchive new file mode 100755 index 000000000..b05c15c47 --- /dev/null +++ b/test/integration/test-apt-ftparchive @@ -0,0 +1,164 @@ +#!/bin/sh +set -e + +assert_correct_sources_file() { + testequal "Package: bar +Binary: bar +Version: 1.0 +Architecture: all +Format: 3.0 (native) +Directory: pool/main +Files: + 7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz +Package-List: + bar deb admin extra +Checksums-Sha1: + 17a40b76715f393ab7fd6485c9392a02f1adf903 406 bar_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 bar_1.0.tar.gz +Checksums-Sha256: + d9d7507f66a89258b6920aca47747d7a30e0e64b09ecabbf02b2efbdabf840a9 406 bar_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 bar_1.0.tar.gz +Checksums-Sha512: + ee0a9bfb6614159b45203fc29487d4f37387993ca0e6d6f27b80010498f3731d75753188ece307508ae9af0259bd11a6af15a1a38f0b87dbd5ea1273b7a7d53e 406 bar_1.0.dsc + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz + +Package: foo +Binary: foo +Version: 1.0 +Architecture: all +Format: 3.0 (native) +Directory: pool/main +Files: + d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz +Package-List: + foo deb admin extra +Checksums-Sha1: + 979306aa3ccff3d61bba062bb6977e2493c6f907 171 foo_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 foo_1.0.tar.gz +Checksums-Sha256: + 8c780af8b5a6d5b3c2e2f9518940beebea52ac6d6ad7b52c082dc925cfe5b532 171 foo_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 foo_1.0.tar.gz +Checksums-Sha512: + 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz +" cat ./aptarchive/dists/test/main/source/Sources +} + +create_source_files() { + NAME="$1" + REQUEST_CLEARSIGN="$2" + + TARFILE="aptarchive/pool/main/${NAME}_1.0.tar.gz" + DSC_FILE="aptarchive/pool/main/${NAME}_1.0.dsc" + touch $TARFILE + if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then + printf -- "-----BEGIN PGP SIGNED MESSAGE-----\n\n" > $DSC_FILE + fi + cat >> $DSC_FILE << EOF +Format: 3.0 (native) +Source: $NAME +Binary: $NAME +Architecture: all +Version: 1.0 +Package-List: + $NAME deb admin extra +Files: + $(md5sum $TARFILE|cut -f1 -d' ') $(stat --print="%s" $TARFILE) ${NAME}_1.0.tar.gz +EOF + if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then + cat >> $DSC_FILE < apt-ftparchive.conf <<"EOF" +Dir { + ArchiveDir "./aptarchive"; + OverrideDir "./aptarchive-overrides"; + CacheDir "./aptarchive-cache"; +}; + +Default { + Packages::Compress ". gzip bzip2"; + Contents::Compress ". gzip bzip2"; + LongDescription "false"; +}; + +TreeDefault { + BinCacheDB "packages-$(SECTION)-$(ARCH).db"; + SrcCacheDB "sources-$(SECTION).db"; + + Directory "pool/$(SECTION)"; + SrcDirectory "pool/$(SECTION)"; + + Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages"; + Sources "$(DIST)/$(SECTION)/source/Sources"; + Contents "$(DIST)/Contents-$(ARCH)"; +}; + +Tree "dists/test" { + Sections "main"; + Architectures "source"; + +}; +EOF + + +# generate (no cachedb) +aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testequal " Misses in Cache: 2" grep Misses stats-out.txt +assert_correct_sources_file + + +# generate again out of the cache +rm -f ./aptarchive/dists/test/main/source/Sources +aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testequal " Misses in Cache: 0" grep Misses stats-out.txt +assert_correct_sources_file + +# generate invalid files +mkdir aptarchive/pool/invalid +printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc +testequal " +E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid +rm -f aptarchive/pool/invalid/invalid_1.0.dsc + +dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null +testequal " +E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid + + -- cgit v1.2.3 From 0a3b93fc3da95c5cbeb18b2d92738cbd50e95d83 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Apr 2014 15:36:42 +0200 Subject: add test for binary cachedb and contents generation --- test/integration/test-apt-ftparchive | 164 ----------------------- test/integration/test-apt-ftparchive-cachedb | 93 +++++++++++++ test/integration/test-apt-ftparchive-src-cachedb | 162 ++++++++++++++++++++++ 3 files changed, 255 insertions(+), 164 deletions(-) delete mode 100755 test/integration/test-apt-ftparchive create mode 100755 test/integration/test-apt-ftparchive-cachedb create mode 100755 test/integration/test-apt-ftparchive-src-cachedb (limited to 'test') diff --git a/test/integration/test-apt-ftparchive b/test/integration/test-apt-ftparchive deleted file mode 100755 index b05c15c47..000000000 --- a/test/integration/test-apt-ftparchive +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -set -e - -assert_correct_sources_file() { - testequal "Package: bar -Binary: bar -Version: 1.0 -Architecture: all -Format: 3.0 (native) -Directory: pool/main -Files: - 7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz -Package-List: - bar deb admin extra -Checksums-Sha1: - 17a40b76715f393ab7fd6485c9392a02f1adf903 406 bar_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 bar_1.0.tar.gz -Checksums-Sha256: - d9d7507f66a89258b6920aca47747d7a30e0e64b09ecabbf02b2efbdabf840a9 406 bar_1.0.dsc - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 bar_1.0.tar.gz -Checksums-Sha512: - ee0a9bfb6614159b45203fc29487d4f37387993ca0e6d6f27b80010498f3731d75753188ece307508ae9af0259bd11a6af15a1a38f0b87dbd5ea1273b7a7d53e 406 bar_1.0.dsc - cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz - -Package: foo -Binary: foo -Version: 1.0 -Architecture: all -Format: 3.0 (native) -Directory: pool/main -Files: - d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz -Package-List: - foo deb admin extra -Checksums-Sha1: - 979306aa3ccff3d61bba062bb6977e2493c6f907 171 foo_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 foo_1.0.tar.gz -Checksums-Sha256: - 8c780af8b5a6d5b3c2e2f9518940beebea52ac6d6ad7b52c082dc925cfe5b532 171 foo_1.0.dsc - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 foo_1.0.tar.gz -Checksums-Sha512: - 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc - cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz -" cat ./aptarchive/dists/test/main/source/Sources -} - -create_source_files() { - NAME="$1" - REQUEST_CLEARSIGN="$2" - - TARFILE="aptarchive/pool/main/${NAME}_1.0.tar.gz" - DSC_FILE="aptarchive/pool/main/${NAME}_1.0.dsc" - touch $TARFILE - if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then - printf -- "-----BEGIN PGP SIGNED MESSAGE-----\n\n" > $DSC_FILE - fi - cat >> $DSC_FILE << EOF -Format: 3.0 (native) -Source: $NAME -Binary: $NAME -Architecture: all -Version: 1.0 -Package-List: - $NAME deb admin extra -Files: - $(md5sum $TARFILE|cut -f1 -d' ') $(stat --print="%s" $TARFILE) ${NAME}_1.0.tar.gz -EOF - if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then - cat >> $DSC_FILE < apt-ftparchive.conf <<"EOF" -Dir { - ArchiveDir "./aptarchive"; - OverrideDir "./aptarchive-overrides"; - CacheDir "./aptarchive-cache"; -}; - -Default { - Packages::Compress ". gzip bzip2"; - Contents::Compress ". gzip bzip2"; - LongDescription "false"; -}; - -TreeDefault { - BinCacheDB "packages-$(SECTION)-$(ARCH).db"; - SrcCacheDB "sources-$(SECTION).db"; - - Directory "pool/$(SECTION)"; - SrcDirectory "pool/$(SECTION)"; - - Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages"; - Sources "$(DIST)/$(SECTION)/source/Sources"; - Contents "$(DIST)/Contents-$(ARCH)"; -}; - -Tree "dists/test" { - Sections "main"; - Architectures "source"; - -}; -EOF - - -# generate (no cachedb) -aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt -testequal " Misses in Cache: 2" grep Misses stats-out.txt -assert_correct_sources_file - - -# generate again out of the cache -rm -f ./aptarchive/dists/test/main/source/Sources -aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt -testequal " Misses in Cache: 0" grep Misses stats-out.txt -assert_correct_sources_file - -# generate invalid files -mkdir aptarchive/pool/invalid -printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc -testequal " -E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid -rm -f aptarchive/pool/invalid/invalid_1.0.dsc - -dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null -testequal " -E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid - - diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb new file mode 100755 index 000000000..2a3bfce99 --- /dev/null +++ b/test/integration/test-apt-ftparchive-cachedb @@ -0,0 +1,93 @@ +#!/bin/sh +set -e + +ensure_correct_packages_file() { + testequal "Package: foo +Priority: optional +Section: others +Installed-Size: 29 +Maintainer: Joe Sixpack +Architecture: i386 +Version: 1 +Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages +} + +ensure_correct_contents_file() { + testequal "usr/bin/foo-i386 others/foo +usr/share/doc/foo/FEATURES others/foo +usr/share/doc/foo/changelog others/foo +usr/share/doc/foo/copyright others/foo" cat ./aptarchive/dists/test/Contents-i386 +} + +# +# main() +# +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +mkdir -p aptarchive/dists/test/main/i18n/ +mkdir -p aptarchive/dists/test/main/source/ +mkdir -p aptarchive/dists/test/main/binary-i386 +mkdir -p aptarchive/pool/main + +mkdir aptarchive-overrides +mkdir aptarchive-cache +cat > ftparchive.conf <<"EOF" +Dir { + ArchiveDir "./aptarchive"; + OverrideDir "./aptarchive-overrides"; + CacheDir "./aptarchive-cache"; +}; + +Default { + Packages::Compress ". gzip bzip2"; + Contents::Compress ". gzip bzip2"; + LongDescription "false"; +}; + +TreeDefault { + BinCacheDB "packages-$(SECTION)-$(ARCH).db"; + + Directory "pool/$(SECTION)"; + SrcDirectory "pool/$(SECTION)"; + + Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages"; + Contents "$(DIST)/Contents-$(ARCH)"; +}; + +Tree "dists/test" { + Sections "main"; + Architectures "i386"; + +}; +EOF + +# build one pacakge +buildsimplenativepackage 'foo' 'i386' '1' 'test' +mv incoming/* aptarchive/pool/main/ + +# generate (empty cachedb) +aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testequal " Misses in Cache: 2 + dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt + +# generate again +aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testequal " Misses in Cache: 0 + dists/test/Contents-i386: Misses in Cache: 0" grep Misses stats-out.txt + +# and again (with removing the Packages file) +rm -f ./aptarchive/dists/test/main/binary-i386/* +rm -f ./aptarchive/dists/test/Contents-i386 +aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +ensure_correct_packages_file +ensure_correct_contents_file +testequal " Misses in Cache: 0 + dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt + diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb new file mode 100755 index 000000000..3a5507c21 --- /dev/null +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -0,0 +1,162 @@ +#!/bin/sh +set -e + +assert_correct_sources_file() { + testequal "Package: bar +Binary: bar +Version: 1.0 +Architecture: all +Format: 3.0 (native) +Directory: pool/main +Files: + 7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz +Package-List: + bar deb admin extra +Checksums-Sha1: + 17a40b76715f393ab7fd6485c9392a02f1adf903 406 bar_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 bar_1.0.tar.gz +Checksums-Sha256: + d9d7507f66a89258b6920aca47747d7a30e0e64b09ecabbf02b2efbdabf840a9 406 bar_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 bar_1.0.tar.gz +Checksums-Sha512: + ee0a9bfb6614159b45203fc29487d4f37387993ca0e6d6f27b80010498f3731d75753188ece307508ae9af0259bd11a6af15a1a38f0b87dbd5ea1273b7a7d53e 406 bar_1.0.dsc + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz + +Package: foo +Binary: foo +Version: 1.0 +Architecture: all +Format: 3.0 (native) +Directory: pool/main +Files: + d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz +Package-List: + foo deb admin extra +Checksums-Sha1: + 979306aa3ccff3d61bba062bb6977e2493c6f907 171 foo_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 foo_1.0.tar.gz +Checksums-Sha256: + 8c780af8b5a6d5b3c2e2f9518940beebea52ac6d6ad7b52c082dc925cfe5b532 171 foo_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 foo_1.0.tar.gz +Checksums-Sha512: + 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz +" cat ./aptarchive/dists/test/main/source/Sources +} + +create_source_files() { + NAME="$1" + REQUEST_CLEARSIGN="$2" + + TARFILE="aptarchive/pool/main/${NAME}_1.0.tar.gz" + DSC_FILE="aptarchive/pool/main/${NAME}_1.0.dsc" + touch $TARFILE + if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then + printf -- "-----BEGIN PGP SIGNED MESSAGE-----\n\n" > $DSC_FILE + fi + cat >> $DSC_FILE << EOF +Format: 3.0 (native) +Source: $NAME +Binary: $NAME +Architecture: all +Version: 1.0 +Package-List: + $NAME deb admin extra +Files: + $(md5sum $TARFILE|cut -f1 -d' ') $(stat --print="%s" $TARFILE) ${NAME}_1.0.tar.gz +EOF + if [ "$REQUEST_CLEARSIGN" = "CLEARSIGN" ]; then + cat >> $DSC_FILE < apt-ftparchive.conf <<"EOF" +Dir { + ArchiveDir "./aptarchive"; + OverrideDir "./aptarchive-overrides"; + CacheDir "./aptarchive-cache"; +}; + +Default { + Packages::Compress ". gzip bzip2"; + Contents::Compress ". gzip bzip2"; + LongDescription "false"; +}; + +TreeDefault { + BinCacheDB "packages-$(SECTION)-$(ARCH).db"; + SrcCacheDB "sources-$(SECTION).db"; + + Directory "pool/$(SECTION)"; + SrcDirectory "pool/$(SECTION)"; + + Sources "$(DIST)/$(SECTION)/source/Sources"; +}; + +Tree "dists/test" { + Sections "main"; + Architectures "source"; + +}; +EOF + + +# generate (empty cachedb) +aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testequal " Misses in Cache: 2" grep Misses stats-out.txt +assert_correct_sources_file + + +# generate again out of the cache +rm -f ./aptarchive/dists/test/main/source/Sources +aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testequal " Misses in Cache: 0" grep Misses stats-out.txt +assert_correct_sources_file + +# generate invalid files +mkdir aptarchive/pool/invalid +printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc +testequal " +E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid +rm -f aptarchive/pool/invalid/invalid_1.0.dsc + +dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null +testequal " +E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid + + -- cgit v1.2.3 From 53ba4e2c2dd29758be0a911489ca5c23e5107513 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Apr 2014 17:09:43 +0200 Subject: ensure clean works --- test/integration/test-apt-ftparchive-cachedb | 7 +++++++ test/integration/test-apt-ftparchive-src-cachedb | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index 2a3bfce99..147272a2c 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -91,3 +91,10 @@ ensure_correct_contents_file testequal " Misses in Cache: 0 dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt +# and clean +rm -rf aptarchive/pool/main/* +testequal "packages-main-i386.db" aptftparchive clean ftparchive.conf +aptftparchive clean ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1 +testequal "0 Number of unique keys in the tree" grep unique clean-out.txt +testequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt + diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 3a5507c21..9cc0a98de 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -159,4 +159,10 @@ dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/d testequal " E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid +# ensure clean works +rm -f aptarchive/pool/main/* +aptftparchive clean apt-ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1 +testequal "0 Number of unique keys in the tree" grep unique clean-out.txt +testequal "sources-main.db" grep sources-main.db clean-out.txt + -- cgit v1.2.3 From cf6bbca0a93b21ab7d3378f26dd9b57951a1d987 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 7 Apr 2014 09:41:20 +0200 Subject: ensure "--db" also works with the new srcpkgdb --- test/integration/test-apt-ftparchive-src-cachedb | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 9cc0a98de..1af193632 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -105,6 +105,30 @@ mkdir -p aptarchive/dists/test/main/source/ mkdir aptarchive-overrides mkdir aptarchive-cache + + + +# generate with --db option +(cd aptarchive && aptftparchive --db ./test.db sources pool/main/ \ + -o APT::FTPArchive::ShowCacheMisses=1 \ + > dists/test/main/source/Sources \ + 2> stats-out.txt + testequal " Misses in Cache: 2" grep Misses stats-out.txt +) +assert_correct_sources_file + +# generate with --db option (again to ensure its in the cache) +(cd aptarchive && aptftparchive --db ./test.db sources pool/main/ \ + -o APT::FTPArchive::ShowCacheMisses=1 \ + > dists/test/main/source/Sources \ + 2> stats-out.txt + testequal " Misses in Cache: 0" grep Misses stats-out.txt +) +assert_correct_sources_file + + + +# get ready for the "apt-ftparchive generate" command cat > apt-ftparchive.conf <<"EOF" Dir { ArchiveDir "./aptarchive"; @@ -135,7 +159,6 @@ Tree "dists/test" { }; EOF - # generate (empty cachedb) aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt testequal " Misses in Cache: 2" grep Misses stats-out.txt @@ -148,6 +171,8 @@ aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 testequal " Misses in Cache: 0" grep Misses stats-out.txt assert_correct_sources_file + + # generate invalid files mkdir aptarchive/pool/invalid printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc -- cgit v1.2.3 From feab34c5216941ca95aae1a389238a77b662d1de Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 22 Apr 2014 17:59:09 +0200 Subject: add support for apt-get build-dep foo.dsc --- test/integration/test-apt-get-build-dep | 85 +++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 test/integration/test-apt-get-build-dep (limited to 'test') diff --git a/test/integration/test-apt-get-build-dep b/test/integration/test-apt-get-build-dep new file mode 100755 index 000000000..6516aa705 --- /dev/null +++ b/test/integration/test-apt-get-build-dep @@ -0,0 +1,85 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage 'debhelper' 'i386' '7' 'stable' +buildsimplenativepackage 'build-essential' 'i386' '1' 'stable' + +setupaptarchive +cat > 2vcard_0.5-3.dsc < +Uploaders: Marcela Tiznado +Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 5.0.37) +Checksums-Sha1: + b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz + 5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz +Checksums-Sha256: + efdc22859ac2f8f030d038dc4faa9020082ebae34212498c288968ffd45c9764 9398 2vcard_0.5.orig.tar.gz + 82673ff3456af571094066c89bcea87b25c23c87cf1d0050b731e5222563626b 2036 2vcard_0.5-3.diff.gz +Files: + f73a69c170f772f3f6e75f2d11bbb792 9398 2vcard_0.5.orig.tar.gz + 1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz +EOF + +testequal "Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + build-essential debhelper +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst build-essential (1 stable [i386]) +Inst debhelper (7 stable [i386]) +Conf build-essential (1 stable [i386]) +Conf debhelper (7 stable [i386])" aptget build-dep -s 2vcard_0.5-3.dsc + +cat > 2vcard_0.5-3.dsc < +Uploaders: Marcela Tiznado +Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 5.0.37) +Checksums-Sha1: + b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz + 5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz +Checksums-Sha256: + efdc22859ac2f8f030d038dc4faa9020082ebae34212498c288968ffd45c9764 9398 2vcard_0.5.orig.tar.gz + 82673ff3456af571094066c89bcea87b25c23c87cf1d0050b731e5222563626b 2036 2vcard_0.5-3.diff.gz +Files: + f73a69c170f772f3f6e75f2d11bbb792 9398 2vcard_0.5.orig.tar.gz + 1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iEYEARECAAYFAkijKhsACgkQsrBfRdYmq7aA2gCfaOW9riTYVQMx5ajKQVAcctlC +z2UAn1oXgTai6opwhVfkxrlmJ+iRxzuc +=4eRd +-----END PGP SIGNATURE----- +EOF + +testequal "Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + build-essential debhelper +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst build-essential (1 stable [i386]) +Inst debhelper (7 stable [i386]) +Conf build-essential (1 stable [i386]) +Conf debhelper (7 stable [i386])" aptget build-dep --simulate 2vcard_0.5-3.dsc -- cgit v1.2.3 From 77da39b95870498431fc21df65900acc5ce2f7ea Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 25 Apr 2014 09:47:50 +0200 Subject: add support for apt-get build-dep unpacked-source-dir --- test/integration/test-apt-get-build-dep | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-get-build-dep b/test/integration/test-apt-get-build-dep index 6516aa705..f71beae9c 100755 --- a/test/integration/test-apt-get-build-dep +++ b/test/integration/test-apt-get-build-dep @@ -83,3 +83,44 @@ Inst build-essential (1 stable [i386]) Inst debhelper (7 stable [i386]) Conf build-essential (1 stable [i386]) Conf debhelper (7 stable [i386])" aptget build-dep --simulate 2vcard_0.5-3.dsc + + +# unpacked source dir +mkdir -p foo-1.0/debian +cat > foo-1.0/debian/control <<'EOF' +Source: apturl +Section: admin +Priority: optional +Maintainer: Michael Vogt +Build-Depends: debhelper (>= 7) +X-Python3-Version: >= 3.2 +Standards-Version: 3.9.3 + +Package: apturl-common +Architecture: any +Depends: ${python3:Depends}, + ${shlibs:Depends}, + ${misc:Depends}, + python3-apt, + python3-update-manager +Replaces: apturl (<< 0.3.6ubuntu2) +Description: install packages using the apt protocol - common data + AptUrl is a simple graphical application that takes an URL (which follows the + apt-protocol) as a command line option, parses it and carries out the + operations that the URL describes (that is, it asks the user if he wants the + indicated packages to be installed and if the answer is positive does so for + him). + . + This package contains the common data shared between the frontends. + +EOF + +testequal "Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + build-essential debhelper +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst build-essential (1 stable [i386]) +Inst debhelper (7 stable [i386]) +Conf build-essential (1 stable [i386]) +Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./foo-1.0 -- cgit v1.2.3 From 7ad2a3477f39e2eac221c53e5f94954f481eb1b4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 28 Apr 2014 16:43:58 +0200 Subject: Implement Popen() execv helper to avoid popen() --- test/libapt/fileutl_test.cc | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test') diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 643c02297..c2a43eda7 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -224,3 +224,51 @@ TEST(FileUtlTest, GetTempDir) if (old_tmpdir.empty() == false) setenv("TMPDIR", old_tmpdir.c_str(), 1); } + +TEST(FileUtlTest, Popen) +{ + FileFd Fd; + pid_t Child; + char buf[1024]; + std::string s; + unsigned long long n = 0; + std::vector OpenFds; + + // count Fds to ensure we don't have a resource leak + if(FileExists("/proc/self/fd")) + OpenFds = Glob("/proc/self/fd/*"); + + // output something + const char* Args[10] = {"/bin/echo", "meepmeep", NULL}; + bool res = Popen(Args, Fd, Child, FileFd::ReadOnly); + Fd.Read(buf, sizeof(buf)-1, &n); + buf[n] = 0; + EXPECT_NE(n, 0); + EXPECT_EQ(res, true); + EXPECT_STREQ(buf, "meepmeep\n"); + + // wait for the child to exit and cleanup + ExecWait(Child, "PopenRead"); + Fd.Close(); + + // ensure that after a close all is good again + if(FileExists("/proc/self/fd")) + EXPECT_EQ(Glob("/proc/self/fd/*").size(), OpenFds.size()); + + + // ReadWrite is not supported + res = Popen(Args, Fd, Child, FileFd::ReadWrite); + EXPECT_EQ(res, false); + _error->Discard(); + + // write something + Args[0] = "/bin/bash"; + Args[1] = "-c"; + Args[2] = "read"; + Args[3] = NULL; + res = Popen(Args, Fd, Child, FileFd::WriteOnly); + s = "\n"; + Fd.Write(s.c_str(), s.size()); + Fd.Close(); + ExecWait(Child, "PopenWrite"); +} -- cgit v1.2.3 From 53ac87ac9c27af39df062516aab5dce880af107a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 28 Apr 2014 17:24:35 +0200 Subject: add flAbsPath() as a wrapper to realpath() --- test/libapt/fileutl_test.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 643c02297..9c7e1630a 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -224,3 +224,10 @@ TEST(FileUtlTest, GetTempDir) if (old_tmpdir.empty() == false) setenv("TMPDIR", old_tmpdir.c_str(), 1); } +TEST(FileUtlTest, flAbsPath) +{ + int res = chdir("/bin/"); + EXPECT_EQ(res, 0); + std::string p = flAbsPath("ls"); + EXPECT_EQ(p, "/bin/ls"); +} -- cgit v1.2.3 From a111a024a30b805fc3f2b8a5b4db8d0c26c10fb8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 28 Apr 2014 17:44:34 +0200 Subject: fix tests --- test/libapt/fileutl_test.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 9c7e1630a..15b57983b 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -226,8 +226,12 @@ TEST(FileUtlTest, GetTempDir) } TEST(FileUtlTest, flAbsPath) { + std::string cwd = SafeGetCWD(); int res = chdir("/bin/"); EXPECT_EQ(res, 0); std::string p = flAbsPath("ls"); EXPECT_EQ(p, "/bin/ls"); + + res = chdir(cwd.c_str()); + EXPECT_EQ(res, 0); } -- cgit v1.2.3 From 773642528b6d9858c2c68ada42705ea71c8db37e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 May 2014 20:55:41 +0200 Subject: fix test-bug-602412-dequote-redirect by removing the aptget update size information --- test/integration/test-bug-602412-dequote-redirect | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index 6393f0c27..4901a32d7 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -20,11 +20,14 @@ testrun() { testsuccess --nomsg aptget update # check that I-M-S header is kept in redirections + local LOG='update.log' + # strip away the [ 304 B ] info + aptget update 2>&1 | sed -e 's/\ \[.*//' > $LOG testequal "Hit $1 unstable InRelease Hit $1 unstable/main Sources Hit $1 unstable/main amd64 Packages Hit $1 unstable/main Translation-en -Reading package lists..." aptget update +Reading package lists..." cat $LOG msgtest 'Test redirection works in' 'package download' testsuccess --nomsg aptget install unrelated --download-only -y -- cgit v1.2.3 From b41713efc8f37d62f078bea850ef0a74e0af0103 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 May 2014 21:03:45 +0200 Subject: show progress in run-tests --- test/integration/run-tests | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/run-tests b/test/integration/run-tests index 79d5d1a29..d700cc3fc 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -36,11 +36,12 @@ else CRESET='' fi +TOTAL="$(run-parts --list $DIR | grep '/test-' | wc -l)" for testcase in $(run-parts --list $DIR | grep '/test-'); do if [ "$MSGLEVEL" -le 2 ]; then echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " else - echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}" + echo "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}" fi if ! ${testcase}; then FAIL=$((FAIL+1)) -- cgit v1.2.3 From 8c617819b179beef02a87daa2777115b4e3b3b48 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 May 2014 22:05:26 +0200 Subject: add BUILDDIRECTORY to PATH in the tests --- test/integration/framework | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 3b900a960..7c5da3694 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -241,7 +241,8 @@ setupenvironment() { gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1 # cleanup the environment a bit - export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" + # prefer our apt binaries over the system apt binaries + export PATH="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin" export LC_ALL=C.UTF-8 unset LANGUAGE APT_CONFIG unset GREP_OPTIONS DEB_BUILD_PROFILES -- cgit v1.2.3 From 34de054cffeb8e64c09efd452a78271bb85d4831 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 May 2014 22:34:34 +0200 Subject: fix tests --- test/integration/test-bug-683786-build-dep-on-virtual-packages | 4 ++-- test/integration/test-ubuntu-bug-346386-apt-get-update-paywall | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-683786-build-dep-on-virtual-packages b/test/integration/test-bug-683786-build-dep-on-virtual-packages index 879d6a3bc..65862c572 100755 --- a/test/integration/test-bug-683786-build-dep-on-virtual-packages +++ b/test/integration/test-bug-683786-build-dep-on-virtual-packages @@ -38,8 +38,8 @@ Building dependency tree... The following NEW packages will be installed: po-debconf 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -Inst po-debconf (1 unstable, unstable [all]) -Conf po-debconf (1 unstable, unstable [all])' aptget build-dep dash -s +Inst po-debconf (1 unstable [all]) +Conf po-debconf (1 unstable [all])' aptget build-dep dash -s testequal 'Reading package lists... Building dependency tree... diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall index 7112d2b45..1a7db0adc 100755 --- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -22,7 +22,7 @@ Config-Item: Acquire::http::DependOnSTDIN=0 600 Acquire URI URI: http://localhost:8080/holygrail Filename: knights-talking -' | ${METHODSDIR}/http >/dev/null 2>&1 && msgpass || msgfail +' | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${METHODSDIR}/http >/dev/null 2>&1 && msgpass || msgfail testfileequal knights-talking 'ni ni ni' ensure_n_canary_strings_in_dir() { -- cgit v1.2.3 From f7bf262e7bf35c19e14aad753a239ec94672d3da Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 8 May 2014 13:43:18 +0200 Subject: update test-apt-progress-fd --- test/integration/test-apt-progress-fd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd index 9d250e949..7ddf355f3 100755 --- a/test/integration/test-apt-progress-fd +++ b/test/integration/test-apt-progress-fd @@ -16,7 +16,7 @@ setupaptarchive exec 3> apt-progress.log testsuccess aptget install testing=0.1 -y -o APT::Status-Fd=3 testequal "dlstatus:1:0:Retrieving file 1 of 1 -dlstatus:1:0:Retrieving file 1 of 1 +dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) pmstatus:testing:20:Preparing testing (amd64) @@ -31,7 +31,7 @@ pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log exec 3> apt-progress.log testsuccess aptget install testing=0.8.15 -y -o APT::Status-Fd=3 testequal "dlstatus:1:0:Retrieving file 1 of 1 -dlstatus:1:0:Retrieving file 1 of 1 +dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:20:Preparing testing (amd64) pmstatus:testing:40:Unpacking testing (amd64) @@ -56,7 +56,7 @@ testsuccess aptget install testing2:i386 -y -o APT::Status-Fd=3 # and compare testequal "dlstatus:1:0:Retrieving file 1 of 1 -dlstatus:1:0:Retrieving file 1 of 1 +dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing2:0:Installing testing2 (i386) pmstatus:testing2:20:Preparing testing2 (i386) -- cgit v1.2.3 From 4bcb5f4b531ccab5540e9a0554ce59b3724f7660 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 8 May 2014 14:30:18 +0200 Subject: Revert "fix test-bug-602412-dequote-redirect by removing the aptget update size information" This reverts commit 773642528b6d9858c2c68ada42705ea71c8db37e. --- test/integration/test-bug-602412-dequote-redirect | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index 4901a32d7..6393f0c27 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -20,14 +20,11 @@ testrun() { testsuccess --nomsg aptget update # check that I-M-S header is kept in redirections - local LOG='update.log' - # strip away the [ 304 B ] info - aptget update 2>&1 | sed -e 's/\ \[.*//' > $LOG testequal "Hit $1 unstable InRelease Hit $1 unstable/main Sources Hit $1 unstable/main amd64 Packages Hit $1 unstable/main Translation-en -Reading package lists..." cat $LOG +Reading package lists..." aptget update msgtest 'Test redirection works in' 'package download' testsuccess --nomsg aptget install unrelated --download-only -y -- cgit v1.2.3 From c7cea1068fc639e65578dd8e0ad9478bb419cc0f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 8 May 2014 18:51:24 +0200 Subject: fix apt-config test now that PATH changed in 8c617819 Git-Dch: Ignore --- test/integration/test-kernel-helper-autoremove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index c51caa758..22c36890b 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -9,7 +9,7 @@ configarchitecture 'amd64' # the executed script would use the installed apt-config, # which is outside of our control msgtest 'Check that the installed apt-config supports' '--no-empty' -if apt-config dump --no-empty >/dev/null 2>&1; then +if /usr/bin/apt-config dump --no-empty >/dev/null 2>&1; then msgpass else msgskip -- cgit v1.2.3 From 2a64259c7305f55f0014f399b9bd0e62b469c32b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 8 May 2014 18:52:51 +0200 Subject: make test independent from the actual Install-Size Git-Dch: Ignore --- test/integration/test-apt-ftparchive-cachedb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index 147272a2c..0e1986bcd 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -5,7 +5,7 @@ ensure_correct_packages_file() { testequal "Package: foo Priority: optional Section: others -Installed-Size: 29 +$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##') Maintainer: Joe Sixpack Architecture: i386 Version: 1 @@ -25,7 +25,7 @@ usr/share/doc/foo/copyright others/foo" cat ./aptarchive/dists/test/Conte TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' mkdir -p aptarchive/dists/test/main/i18n/ mkdir -p aptarchive/dists/test/main/source/ -- cgit v1.2.3 From 0c8171d7c52a46a719382ee7ed67451213f608ec Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 9 May 2014 01:22:50 +0200 Subject: =?UTF-8?q?tests:=20be=20able=20to=20disable=20"Fetched=20?= =?UTF-8?q?=E2=80=A6"=20statistics=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The line contains everchanging execution statistics which is harmful for testcases as they need to filter out such lines, but this is hard so we can just add an option to disable them instead and be done. Git-Dch: Ignore --- test/integration/framework | 1 + test/integration/test-bug-595691-empty-and-broken-archive-files | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index ab1274d9c..9cdc31e23 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -226,6 +226,7 @@ setupenvironment() { fi echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf echo 'quiet::NoUpdate "true";' >> aptconfig.conf + echo 'quiet::NoStatistic "true";' >> aptconfig.conf echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary configcompression '.' 'gz' #'bz2' 'lzma' 'xz' diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files index a05ed5fa6..8da0a52d2 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -13,7 +13,7 @@ setupflataptarchive testaptgetupdate() { rm -rf rootdir/var/lib/apt aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true - sed -i -e '/^Fetched / d' -e '/Ign / d' -e '/Release/ d' -e 's#Get:[0-9]\+ #Get: #' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff + sed -i -e '/Ign / d' -e '/Release/ d' -e 's#Get:[0-9]\+ #Get: #' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff GIVEN="$1" shift msgtest "Test for correctness of" "apt-get update with $*" -- cgit v1.2.3 From f4c3850ea335545e297504941dc8c7a8f1c83358 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 18 Aug 2013 23:17:05 +0200 Subject: add a simple container for HashStrings APT supports more than just one HashString and even allows to enforce the usage of a specific hash. This class is intended to help with storage and passing around of the HashStrings. Git-Dch: Ignore --- test/libapt/hashsums_test.cc | 64 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index c06d85e03..ac7d41582 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -207,16 +207,56 @@ TEST(HashSumsTest, FileBased) } fd.Close(); - { - HashString sha2("SHA256", sha256.Value()); - EXPECT_TRUE(sha2.VerifyFile(__FILE__)); - } - { - HashString sha2("SHA512", sha512.Value()); - EXPECT_TRUE(sha2.VerifyFile(__FILE__)); - } - { - HashString sha2("SHA256:" + sha256.Value()); - EXPECT_TRUE(sha2.VerifyFile(__FILE__)); - } + HashString sha2file("SHA512", sha512.Value()); + EXPECT_TRUE(sha2file.VerifyFile(__FILE__)); + HashString sha2wrong("SHA512", "00000000000"); + EXPECT_FALSE(sha2wrong.VerifyFile(__FILE__)); + EXPECT_EQ(sha2file, sha2file); + EXPECT_TRUE(sha2file == sha2file); + EXPECT_NE(sha2file, sha2wrong); + EXPECT_TRUE(sha2file != sha2wrong); + + HashString sha2big("SHA256", sha256.Value()); + EXPECT_TRUE(sha2big.VerifyFile(__FILE__)); + HashString sha2small("sha256:" + sha256.Value()); + EXPECT_TRUE(sha2small.VerifyFile(__FILE__)); + EXPECT_EQ(sha2big, sha2small); + EXPECT_TRUE(sha2big == sha2small); + EXPECT_FALSE(sha2big != sha2small); + + HashStringList hashes; + EXPECT_TRUE(hashes.empty()); + EXPECT_TRUE(hashes.push_back(sha2file)); + EXPECT_FALSE(hashes.empty()); + EXPECT_EQ(1, hashes.size()); + + HashStringList wrong; + EXPECT_TRUE(wrong.push_back(sha2wrong)); + EXPECT_NE(wrong, hashes); + EXPECT_FALSE(wrong == hashes); + EXPECT_TRUE(wrong != hashes); + + HashStringList similar; + EXPECT_TRUE(similar.push_back(sha2big)); + EXPECT_NE(similar, hashes); + EXPECT_FALSE(similar == hashes); + EXPECT_TRUE(similar != hashes); + + EXPECT_TRUE(hashes.push_back(sha2big)); + EXPECT_EQ(2, hashes.size()); + EXPECT_TRUE(hashes.push_back(sha2small)); + EXPECT_EQ(2, hashes.size()); + EXPECT_FALSE(hashes.push_back(sha2wrong)); + EXPECT_EQ(2, hashes.size()); + EXPECT_TRUE(hashes.VerifyFile(__FILE__)); + + EXPECT_EQ(similar, hashes); + EXPECT_TRUE(similar == hashes); + EXPECT_FALSE(similar != hashes); + similar.clear(); + EXPECT_TRUE(similar.empty()); + EXPECT_EQ(0, similar.size()); + EXPECT_NE(similar, hashes); + EXPECT_FALSE(similar == hashes); + EXPECT_TRUE(similar != hashes); } -- cgit v1.2.3 From 1262d35895c930f3fa49d7b4182cdd7a4a841f74 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 18 Aug 2013 23:27:24 +0200 Subject: use 'best' hash for source authentication Collect all hashes we can get from the source record and put them into a HashStringList so that 'apt-get source' can use it instead of using always the MD5sum. We therefore also deprecate the MD5 struct member in favor of the list. While at it, the parsing of the Files is enhanced so that records which miss "Files" (aka MD5 checksums) are still searched for other checksums as they include just as much data, just not with a nice and catchy name. LP: 1098738 --- test/integration/test-debsrc-hashes | 77 ------ .../test-ubuntu-bug-1098738-apt-get-source-md5sum | 260 +++++++++++++++++++++ 2 files changed, 260 insertions(+), 77 deletions(-) delete mode 100755 test/integration/test-debsrc-hashes create mode 100755 test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum (limited to 'test') diff --git a/test/integration/test-debsrc-hashes b/test/integration/test-debsrc-hashes deleted file mode 100755 index 5e917232b..000000000 --- a/test/integration/test-debsrc-hashes +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework - -setupenvironment -configarchitecture "i386" - -# pkg-sha256-bad has a bad SHA sum, but good MD5 sum. If apt is -# checking the best available hash (as it should), this will trigger -# a hash mismatch. - -cat > aptarchive/Sources < -Architecture: i386 -Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.tar.gz - -Package: pkg-sha256-ok -Binary: pkg-sha256-ok -Version: 1.0 -Maintainer: Joe Sixpack -Architecture: i386 -Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.tar.gz -Checksums-Sha1: - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.tar.gz -Checksums-Sha256: - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.dsc - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.tar.gz - -Package: pkg-sha256-bad -Binary: pkg-sha256-bad -Version: 1.0 -Maintainer: Joe Sixpack -Architecture: i386 -Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.tar.gz -Checksums-Sha1: - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.tar.gz -Checksums-Sha256: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.dsc - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.tar.gz -EOF - -# create fetchable files -for x in "pkg-md5-ok" "pkg-sha256-ok" "pkg-sha256-bad"; do - touch aptarchive/${x}_1.0.dsc - touch aptarchive/${x}_1.0.tar.gz -done - -testok() { - msgtest "Test for hash ok of" "$*" - $* 2>&1 | grep "Download complete" > /dev/null && msgpass || msgfail -} - -testmismatch() { - msgtest "Test for hash mismatch of" "$*" - $* 2>&1 | grep "Hash Sum mismatch" > /dev/null && msgpass || msgfail -} - -setupaptarchive -changetowebserver -aptget update -qq - -testok aptget source -d pkg-md5-ok -testok aptget source -d pkg-sha256-ok -testmismatch aptget source -d pkg-sha256-bad diff --git a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum new file mode 100755 index 000000000..9bdc81264 --- /dev/null +++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum @@ -0,0 +1,260 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'native' + +cat > aptarchive/Sources < +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.tar.gz + +Package: pkg-sha256-ok +Binary: pkg-sha256-ok +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.tar.gz + +Package: pkg-sha256-bad +Binary: pkg-sha256-bad +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.tar.gz +Checksums-Sha256: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-sha256-bad_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-sha256-bad_1.0.tar.gz + +Package: pkg-no-md5 +Binary: pkg-no-md5 +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-no-md5_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-no-md5_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-no-md5_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-no-md5_1.0.tar.gz + +Package: pkg-mixed-ok +Binary: pkg-mixed-ok +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-mixed-ok_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-mixed-ok_1.0.dsc + +Package: pkg-mixed-sha1-bad +Binary: pkg-mixed-sha1-bad +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Checksums-Sha1: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-mixed-sha1-bad_1.0.dsc +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-mixed-sha1-bad_1.0.tar.gz + +Package: pkg-mixed-sha2-bad +Binary: pkg-mixed-sha2-bad +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-mixed-sha2-bad_1.0.dsc +Checksums-Sha256: + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-mixed-sha2-bad_1.0.tar.gz + +Package: pkg-md5-disagree +Binary: pkg-md5-disagree +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-disagree_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-disagree_1.0.tar.gz + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-md5-disagree_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-md5-disagree_1.0.tar.gz + +Package: pkg-md5-agree +Binary: pkg-md5-agree +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.tar.gz + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.tar.gz + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.dsc + +Package: pkg-sha256-disagree +Binary: pkg-sha256-disagree +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-disagree_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-disagree_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-disagree_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-disagree_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-disagree_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-disagree_1.0.tar.gz + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-sha256-disagree_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-sha256-disagree_1.0.tar.gz +EOF + +# create fetchable files +for x in 'pkg-md5-ok' 'pkg-sha256-ok' 'pkg-sha256-bad' 'pkg-no-md5' \ + 'pkg-mixed-ok' 'pkg-mixed-sha1-bad' 'pkg-mixed-sha2-bad' \ + 'pkg-md5-agree' 'pkg-md5-disagree' 'pkg-sha256-disagree'; do + touch aptarchive/${x}_1.0.dsc aptarchive/${x}_1.0.tar.gz +done + +setupaptarchive +changetowebserver +testsuccess aptget update + +testok() { + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) +Get:2 http://localhost:8080/ $1 1.0 (tar) +Download complete and in download only mode" aptget source -d "$@" + msgtest 'Files were successfully downloaded for' "$1" + testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz +} + +testkeep() { + touch ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Skipping already downloaded file '${1}_1.0.dsc' +Skipping already downloaded file '${1}_1.0.tar.gz' +Need to get 0 B of source archives. +Download complete and in download only mode" aptget source -d "$@" + msgtest 'Files already downloaded are kept for' "$1" + testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz +} + +testmismatch() { + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) +Get:2 http://localhost:8080/ $1 1.0 (tar) +E: Failed to fetch http://localhost:8080/${1}_1.0.dsc Hash Sum mismatch + +E: Failed to fetch http://localhost:8080/${1}_1.0.tar.gz Hash Sum mismatch + +E: Failed to fetch some archives." aptget source -d "$@" + msgtest 'Files were not download as they have hashsum mismatches for' "$1" + testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz + + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Skipping download of file 'pkg-sha256-bad_1.0.dsc' as requested hashsum is not available for authentication +Skipping download of file 'pkg-sha256-bad_1.0.tar.gz' as requested hashsum is not available for authentication +Need to get 0 B of source archives. +Download complete and in download only mode" aptget source -d "$@" -o Acquire::ForceHash=ROT26 + msgtest 'Files were not download as hash is unavailable for' "$1" + testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz + + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) +Get:2 http://localhost:8080/ $1 1.0 (tar) +Download complete and in download only mode" aptget source --allow-unauthenticated -d "$@" -o Acquire::ForceHash=ROT26 + msgtest 'Files were downloaded unauthenticated as user allowed it' "$1" + testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz +} + +testok pkg-md5-ok +testkeep pkg-md5-ok +testok pkg-sha256-ok +testkeep pkg-sha256-ok + +# pkg-sha256-bad has a bad SHA sum, but good MD5 sum. If apt is +# checking the best available hash (as it should), this will trigger +# a hash mismatch. +testmismatch pkg-sha256-bad +testmismatch pkg-sha256-bad +testok pkg-sha256-bad -o Acquire::ForceHash=MD5Sum + +# not having MD5 sum doesn't mean the file doesn't exist at all … +testok pkg-no-md5 +testok pkg-no-md5 -o Acquire::ForceHash=SHA256 +testequal "Reading package lists... +Building dependency tree... +Skipping download of file 'pkg-no-md5_1.0.dsc' as requested hashsum is not available for authentication +Skipping download of file 'pkg-no-md5_1.0.tar.gz' as requested hashsum is not available for authentication +Need to get 0 B of source archives. +Download complete and in download only mode" aptget source -d pkg-no-md5 -o Acquire::ForceHash=MD5Sum +msgtest 'Files were not download as MD5 is not available for this package' 'pkg-no-md5' +testfailure --nomsg test -e pkg-no-md5_1.0.dsc -a -e pkg-no-md5_1.0.tar.gz + +# deal with cases in which we haven't for all files the same checksum type +# mostly pathologic as this shouldn't happen, but just to be sure +testok pkg-mixed-ok +testequal 'Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (tar) +Get:2 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (dsc) +E: Failed to fetch http://localhost:8080/pkg-mixed-sha1-bad_1.0.dsc Hash Sum mismatch + +E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha1-bad +msgtest 'Only tar file is downloaded as the dsc has hashsum mismatch' 'pkg-mixed-sha1-bad' +testsuccess --nomsg test ! -e pkg-mixed-sha1-bad_1.0.dsc -a -e pkg-mixed-sha1-bad_1.0.tar.gz +testequal 'Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (tar) +Get:2 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (dsc) +E: Failed to fetch http://localhost:8080/pkg-mixed-sha2-bad_1.0.tar.gz Hash Sum mismatch + +E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha2-bad +msgtest 'Only dsc file is downloaded as the tar has hashsum mismatch' 'pkg-mixed-sha2-bad' +testsuccess --nomsg test -e pkg-mixed-sha2-bad_1.0.dsc -a ! -e pkg-mixed-sha2-bad_1.0.tar.gz + +# it gets even more pathologic: multiple entries for one file, some even disagreeing! +testok pkg-md5-agree +testequal 'Reading package lists... +Building dependency tree... +E: Error parsing checksum in Files of source package pkg-md5-disagree' aptget source -d pkg-md5-disagree +testequal 'Reading package lists... +Building dependency tree... +E: Error parsing checksum in Checksums-SHA256 of source package pkg-sha256-disagree' aptget source -d pkg-sha256-disagree -- cgit v1.2.3 From b3501edb7091ca3aa6c2d6d96dc667b8161dd2b9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 19 Aug 2013 00:00:23 +0200 Subject: use HashStringList in the acquire system It is not very extensible to have the supported Hashes hardcoded everywhere and especially if it is part of virtual method names. It is also possible that a method does not support the 'best' hash (yet), so we might end up not being able to verify a file even though we have a common subset of supported hashes. And those are just two of the cases in which it is handy to have a more dynamic selection. The downside is that this is a MAJOR API break, but the HashStringList has a string constructor for compatibility, so with a bit of luck the few frontends playing with the acquire system directly are okay. --- test/integration/test-apt-sources-deb822 | 48 ++++++------ .../test-bug-722207-print-uris-even-if-very-quiet | 8 +- test/integration/test-pdiff-usage | 6 -- .../test-ubuntu-bug-346386-apt-get-update-paywall | 2 +- test/libapt/hashsums_test.cc | 85 ++++++++++++++++++++-- 5 files changed, 106 insertions(+), 43 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 5f54b7531..d8b2334ad 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -23,14 +23,14 @@ Description: summay msgtest 'Test sources.list' 'old style' echo "deb http://ftp.debian.org/debian stable main" > $SOURCES -testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris msgtest 'Test sources.list' 'simple deb822' echo "$BASE" > $SOURCES -testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris @@ -39,29 +39,29 @@ msgtest 'Test deb822 with' 'two entries' echo "$BASE" > $SOURCES echo "" >> $SOURCES echo "$BASE" | sed s/stable/unstable/ >> $SOURCES -testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 -'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 +'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris # two suite entries msgtest 'Test deb822 with' 'two Suite entries' echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES -testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 -'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 +'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris msgtest 'Test deb822' 'architecture option' echo "$BASE" > $SOURCES echo "Architectures: amd64 armel" >> $SOURCES -testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris @@ -85,19 +85,19 @@ testempty aptget update --print-uris # multiple URIs msgtest 'Test deb822 sources.list file which has' 'Multiple URIs work' echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES -testequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.de.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +testequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0 +'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.de.debian.org_debian_dists_stable_main_i18n_Translation-en 0 'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0 -'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris # multiple Type in one field msgtest 'Test deb822 sources.list file which has' 'Multiple Types work' echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES -testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/source/Sources.bz2' ftp.debian.org_debian_dists_stable_main_source_Sources 0 : -'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 : -'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 : +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/source/Sources.bz2' ftp.debian.org_debian_dists_stable_main_source_Sources 0 +'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris # a Suite @@ -107,6 +107,6 @@ Types: deb URIs: http://emacs.naquadah.org Suites: stable/ EOF -testequal --nomsg "'http://emacs.naquadah.org/stable/Packages.bz2' emacs.naquadah.org_stable_Packages 0 : -'http://emacs.naquadah.org/stable/en.bz2' emacs.naquadah.org_stable_en 0 : +testequal --nomsg "'http://emacs.naquadah.org/stable/Packages.bz2' emacs.naquadah.org_stable_Packages 0 +'http://emacs.naquadah.org/stable/en.bz2' emacs.naquadah.org_stable_en 0 'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0 " aptget update --print-uris diff --git a/test/integration/test-bug-722207-print-uris-even-if-very-quiet b/test/integration/test-bug-722207-print-uris-even-if-very-quiet index f2d95da19..9a5685703 100755 --- a/test/integration/test-bug-722207-print-uris-even-if-very-quiet +++ b/test/integration/test-bug-722207-print-uris-even-if-very-quiet @@ -16,10 +16,10 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) -testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 MD5Sum:" aptget upgrade -qq --print-uris -testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 MD5Sum:" aptget dist-upgrade -qq --print-uris -testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 MD5Sum:" aptget install apt -qq --print-uris -testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 MD5Sum:" aptget download apt -qq --print-uris +testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget upgrade -qq --print-uris +testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget dist-upgrade -qq --print-uris +testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget install apt -qq --print-uris +testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget download apt -qq --print-uris testequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt -qq --print-uris testequal "'http://packages.debian.org/changelogs/pool/main/apt/apt_2/changelog'" aptget changelog apt -qq --print-uris diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index afe1ad443..74749d6ab 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -13,12 +13,6 @@ changetowebserver PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')" -echo '#!/bin/sh -touch merge-was-used -/usr/bin/diffindex-rred "$@"' > extrred -chmod +x extrred -echo 'Dir::Bin::rred "./extrred";' > rootdir/etc/apt/apt.conf.d/99rred - wasmergeused() { msgtest 'Test for successful execution of' "$*" local OUTPUT=$(mktemp) diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall index 1a7db0adc..8e50843f3 100755 --- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -22,7 +22,7 @@ Config-Item: Acquire::http::DependOnSTDIN=0 600 Acquire URI URI: http://localhost:8080/holygrail Filename: knights-talking -' | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${METHODSDIR}/http >/dev/null 2>&1 && msgpass || msgfail +' | runapt ${METHODSDIR}/http >/dev/null 2>&1 && msgpass || msgfail testfileequal knights-talking 'ni ni ni' ensure_n_canary_strings_in_dir() { diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index ac7d41582..2159996ff 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -1,5 +1,6 @@ #include +#include #include #include #include @@ -166,20 +167,26 @@ TEST(HashSumsTest, FileBased) { Hashes hashes; hashes.AddFD(fd.Fd()); - EXPECT_EQ(md5.Value(), hashes.MD5.Result().Value()); - EXPECT_EQ(sha1.Value(), hashes.SHA1.Result().Value()); - EXPECT_EQ(sha256.Value(), hashes.SHA256.Result().Value()); - EXPECT_EQ(sha512.Value(), hashes.SHA512.Result().Value()); + HashStringList list = hashes.GetHashStringList(); + EXPECT_FALSE(list.empty()); + EXPECT_EQ(4, list.size()); + EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue()); + EXPECT_EQ(sha1.Value(), list.find("SHA1")->HashValue()); + EXPECT_EQ(sha256.Value(), list.find("SHA256")->HashValue()); + EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue()); } unsigned long sz = fd.FileSize(); fd.Seek(0); { Hashes hashes; hashes.AddFD(fd.Fd(), sz); - EXPECT_EQ(md5.Value(), hashes.MD5.Result().Value()); - EXPECT_EQ(sha1.Value(), hashes.SHA1.Result().Value()); - EXPECT_EQ(sha256.Value(), hashes.SHA256.Result().Value()); - EXPECT_EQ(sha512.Value(), hashes.SHA512.Result().Value()); + HashStringList list = hashes.GetHashStringList(); + EXPECT_FALSE(list.empty()); + EXPECT_EQ(4, list.size()); + EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue()); + EXPECT_EQ(sha1.Value(), list.find("SHA1")->HashValue()); + EXPECT_EQ(sha256.Value(), list.find("SHA256")->HashValue()); + EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue()); } fd.Seek(0); { @@ -260,3 +267,65 @@ TEST(HashSumsTest, FileBased) EXPECT_FALSE(similar == hashes); EXPECT_TRUE(similar != hashes); } +TEST(HashSumsTest, HashStringList) +{ + _config->Clear("Acquire::ForceHash"); + + HashStringList list; + EXPECT_TRUE(list.empty()); + EXPECT_FALSE(list.usable()); + EXPECT_EQ(0, list.size()); + EXPECT_EQ(NULL, list.find(NULL)); + EXPECT_EQ(NULL, list.find("")); + EXPECT_EQ(NULL, list.find("MD5Sum")); + + HashStringList list2; + EXPECT_FALSE(list == list2); + EXPECT_TRUE(list != list2); + + Hashes hashes; + hashes.Add("The quick brown fox jumps over the lazy dog"); + list = hashes.GetHashStringList(); + EXPECT_FALSE(list.empty()); + EXPECT_TRUE(list.usable()); + EXPECT_EQ(4, list.size()); + EXPECT_TRUE(NULL != list.find(NULL)); + EXPECT_TRUE(NULL != list.find("")); + EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL == list.find("ROT26")); + + _config->Set("Acquire::ForceHash", "MD5Sum"); + EXPECT_FALSE(list.empty()); + EXPECT_TRUE(list.usable()); + EXPECT_EQ(4, list.size()); + EXPECT_TRUE(NULL != list.find(NULL)); + EXPECT_TRUE(NULL != list.find("")); + EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL == list.find("ROT26")); + + _config->Set("Acquire::ForceHash", "ROT26"); + EXPECT_FALSE(list.empty()); + EXPECT_FALSE(list.usable()); + EXPECT_EQ(4, list.size()); + EXPECT_TRUE(NULL == list.find(NULL)); + EXPECT_TRUE(NULL == list.find("")); + EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL == list.find("ROT26")); + + _config->Clear("Acquire::ForceHash"); + + list2.push_back(*list.find("MD5Sum")); + EXPECT_TRUE(list == list2); + EXPECT_FALSE(list != list2); + + // introduce a mismatch to the list + list2.push_back(HashString("SHA1", "cacecbd74968bc90ea3342767e6b94f46ddbcafc")); + EXPECT_FALSE(list == list2); + EXPECT_TRUE(list != list2); + + _config->Set("Acquire::ForceHash", "MD5Sum"); + EXPECT_TRUE(list == list2); + EXPECT_FALSE(list != list2); + + _config->Clear("Acquire::ForceHash"); +} -- cgit v1.2.3 From a311fb96b84757ef8628e6a754232614a53b7891 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Apr 2014 18:23:20 +0200 Subject: deal with hashes in ftparchive more dynamic as well Now that libapts acquire system happily passes around hashes and can be made to support new ones without an ABI break in the future, we can free ftparchive from all the deprecation warnings the last commit introduced for it. The goal here isn't to preserve ABI as we have none to keep here, but to help avoiding introduction problems of 'new' hashes later as bugs creep into the copy&paste parts, so short/less of them is good. --- test/integration/framework | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 9cdc31e23..4d0d07cc2 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -102,10 +102,10 @@ runapt() { local CMD="$1" shift case $CMD in - sh|aptitude|*/*) ;; + sh|aptitude|*/*|command) ;; *) CMD="${BUILDDIRECTORY}/$CMD";; esac - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@" + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${LIBRARYPATH} $CMD "$@" } aptconfig() { runapt apt-config "$@"; } aptcache() { runapt apt-cache "$@"; } @@ -127,11 +127,9 @@ dpkgcheckbuilddeps() { command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@" } gdb() { - echo "gdb: run »$*«" - CMD="$1" + local CMD="$1" shift - - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$CMD --args ${BUILDDIRECTORY}/$CMD "$@" + runapt command gdb --quiet -ex run "${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@" } gpg() { # see apt-key for the whole trickery. Setup is done in setupenvironment -- cgit v1.2.3 From 895417ef99bb1371d8970da1afe87c6d64382f67 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 28 Apr 2014 10:02:27 +0200 Subject: reenable pipelining via hashsum reordering support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that methods have the expected hashes available they can check if the response from the server is what they expected. Pipelining is one of those areas in which servers can mess up by not supporting it properly, which forced us to disable it for the time being. Now, we check if we got a response out of order, which we can not only use to disable pipelining automatically for the next requests, but we can fix it up just like the server responded in proper order for the current requests. To ensure that this little trick works pipelining is only attempt if we have hashsums for all the files in the chain which in theory reduces the use of pipelining usage even on the many servers which work properly, but in practice only the InRelease file (or similar such) will be requested without a hashsum – and as it is the only file requested in that stage it can't be pipelined even if we wanted to. Some minor annoyances remain: The display of the progress we have doesn't reflect this change, so it looks like the same package gets downloaded multiple times while others aren't at all. Further more, partial files are not supported in this recovery as the received data was appended to the wrong file, so the hashsum doesn't match. Both seem to be minor enough to reenable pipelining by default until further notice through to test if it really solves the problem. This therefore reverts commit 8221431757c775ee875a061b184b5f6f2330f928. --- test/integration/test-http-pipeline-messup | 43 ++++++++ .../test-ubuntu-bug-1098738-apt-get-source-md5sum | 116 +++++++++++---------- 2 files changed, 102 insertions(+), 57 deletions(-) create mode 100755 test/integration/test-http-pipeline-messup (limited to 'test') diff --git a/test/integration/test-http-pipeline-messup b/test/integration/test-http-pipeline-messup new file mode 100755 index 000000000..9c59e1825 --- /dev/null +++ b/test/integration/test-http-pipeline-messup @@ -0,0 +1,43 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage 'pkga' 'all' '1.0' 'stable' +buildsimplenativepackage 'pkgb' 'all' '1.0' 'stable' +buildsimplenativepackage 'pkgc' 'all' '1.0' 'stable' +buildsimplenativepackage 'pkgd' 'all' '1.0' 'stable' + +setupaptarchive --no-update + +# simulate (and be a predictable) pipeline mess-up by the server/proxy +changetowebserver \ + -o 'aptwebserver::overwrite::.*pkga.*::filename=/pool/pkgd_1.0_all.deb' \ + -o 'aptwebserver::overwrite::.*pkgc.*::filename=/pool/pkgb_1.0_all.deb' \ + -o 'aptwebserver::overwrite::.*pkgb.*::filename=/pool/pkgc_1.0_all.deb' \ + -o 'aptwebserver::overwrite::.*pkgd.*::filename=/pool/pkga_1.0_all.deb' + +testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::pkgAcquire::Worker=1 + +# messup is bigger than pipeline: checks if fixup isn't trying to hard +testfailure aptget download pkga pkgb pkgc pkgd "$@" -o Acquire::http::Pipeline-Depth=2 +testfailure test -f pkga_1.0_all.deb + +# ensure that pipeling is enabled for rest of this test +echo 'Acquire::http::Pipeline-Depth 10;' > rootdir/etc/apt/apt.conf.d/99enable-pipeline + +# the output is a bit strange: it looks like it has downloaded pkga 4 times +testsuccess aptget download pkga pkgb pkgc pkgd -o Debug::Acquire::http=1 -o Debug::pkgAcquire::Worker=1 +for pkg in 'pkga' 'pkgb' 'pkgc' 'pkgd'; do + testsuccess test -f ${pkg}_1.0_all.deb + testsuccess cmp incoming/${pkg}_1.0_all.deb ${pkg}_1.0_all.deb + rm -f ${pkg}_1.0_all.deb +done + +# while hashes will pass (as none are available), sizes will not match, so failure +# checks that no hashes means that pipeline depth is ignored as we can't fixup +testfailure aptget download pkga pkgb pkgc pkgd "$@" --allow-unauthenticated -o Acquire::ForceHash=ROT26 diff --git a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum index 9bdc81264..8c9c9c767 100755 --- a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum +++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum @@ -14,8 +14,8 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.tar.gz + 9604ba9427a280db542279d9ed78400b 3 pkg-md5-ok_1.0.dsc + db5570bf61464b46e2bde31ed61a7dc6 3 pkg-md5-ok_1.0.tar.gz Package: pkg-sha256-ok Binary: pkg-sha256-ok @@ -23,14 +23,14 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.tar.gz + 9604ba9427a280db542279d9ed78400b 3 pkg-sha256-ok_1.0.dsc + db5570bf61464b46e2bde31ed61a7dc6 3 pkg-sha256-ok_1.0.tar.gz Checksums-Sha1: - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.tar.gz + 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-sha256-ok_1.0.dsc + 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-sha256-ok_1.0.tar.gz Checksums-Sha256: - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.dsc - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.tar.gz + 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 3 pkg-sha256-ok_1.0.dsc + 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 3 pkg-sha256-ok_1.0.tar.gz Package: pkg-sha256-bad Binary: pkg-sha256-bad @@ -38,14 +38,14 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.tar.gz + 9604ba9427a280db542279d9ed78400b 3 pkg-sha256-bad_1.0.dsc + db5570bf61464b46e2bde31ed61a7dc6 3 pkg-sha256-bad_1.0.tar.gz Checksums-Sha1: - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.tar.gz + 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-sha256-bad_1.0.dsc + 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-sha256-bad_1.0.tar.gz Checksums-Sha256: - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-sha256-bad_1.0.dsc - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-sha256-bad_1.0.tar.gz + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-sha256-bad_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-sha256-bad_1.0.tar.gz Package: pkg-no-md5 Binary: pkg-no-md5 @@ -53,11 +53,11 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Checksums-Sha1: - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-no-md5_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-no-md5_1.0.tar.gz + 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-no-md5_1.0.dsc + 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-no-md5_1.0.tar.gz Checksums-Sha256: - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-no-md5_1.0.dsc - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-no-md5_1.0.tar.gz + 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 3 pkg-no-md5_1.0.dsc + 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 3 pkg-no-md5_1.0.tar.gz Package: pkg-mixed-ok Binary: pkg-mixed-ok @@ -65,9 +65,9 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Checksums-Sha1: - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-mixed-ok_1.0.tar.gz + 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-mixed-ok_1.0.tar.gz Checksums-Sha256: - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-mixed-ok_1.0.dsc + 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 3 pkg-mixed-ok_1.0.dsc Package: pkg-mixed-sha1-bad Binary: pkg-mixed-sha1-bad @@ -75,9 +75,9 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Checksums-Sha1: - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-mixed-sha1-bad_1.0.dsc + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-mixed-sha1-bad_1.0.dsc Checksums-Sha256: - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-mixed-sha1-bad_1.0.tar.gz + 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 3 pkg-mixed-sha1-bad_1.0.tar.gz Package: pkg-mixed-sha2-bad Binary: pkg-mixed-sha2-bad @@ -85,9 +85,9 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Checksums-Sha1: - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-mixed-sha2-bad_1.0.dsc + 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-mixed-sha2-bad_1.0.dsc Checksums-Sha256: - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-mixed-sha2-bad_1.0.tar.gz + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-mixed-sha2-bad_1.0.tar.gz Package: pkg-md5-disagree Binary: pkg-md5-disagree @@ -95,10 +95,10 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-disagree_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-disagree_1.0.tar.gz - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-md5-disagree_1.0.dsc - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-md5-disagree_1.0.tar.gz + 9604ba9427a280db542279d9ed78400b 3 pkg-md5-disagree_1.0.dsc + db5570bf61464b46e2bde31ed61a7dc6 3 pkg-md5-disagree_1.0.tar.gz + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-md5-disagree_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-md5-disagree_1.0.tar.gz Package: pkg-md5-agree Binary: pkg-md5-agree @@ -106,10 +106,10 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.tar.gz - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.tar.gz - d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.dsc + 9604ba9427a280db542279d9ed78400b 3 pkg-md5-agree_1.0.dsc + db5570bf61464b46e2bde31ed61a7dc6 3 pkg-md5-agree_1.0.tar.gz + db5570bf61464b46e2bde31ed61a7dc6 3 pkg-md5-agree_1.0.tar.gz + 9604ba9427a280db542279d9ed78400b 3 pkg-md5-agree_1.0.dsc Package: pkg-sha256-disagree Binary: pkg-sha256-disagree @@ -117,23 +117,24 @@ Version: 1.0 Maintainer: Joe Sixpack Architecture: all Files: - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-disagree_1.0.dsc - d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-disagree_1.0.tar.gz + 9604ba9427a280db542279d9ed78400b 3 pkg-sha256-disagree_1.0.dsc + db5570bf61464b46e2bde31ed61a7dc6 3 pkg-sha256-disagree_1.0.tar.gz Checksums-Sha1: - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-disagree_1.0.dsc - da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-disagree_1.0.tar.gz + 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-sha256-disagree_1.0.dsc + 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-sha256-disagree_1.0.tar.gz Checksums-Sha256: - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-disagree_1.0.dsc - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-disagree_1.0.tar.gz - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-sha256-disagree_1.0.dsc - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-sha256-disagree_1.0.tar.gz + 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 3 pkg-sha256-disagree_1.0.dsc + 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 3 pkg-sha256-disagree_1.0.tar.gz + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-sha256-disagree_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-sha256-disagree_1.0.tar.gz EOF # create fetchable files for x in 'pkg-md5-ok' 'pkg-sha256-ok' 'pkg-sha256-bad' 'pkg-no-md5' \ 'pkg-mixed-ok' 'pkg-mixed-sha1-bad' 'pkg-mixed-sha2-bad' \ 'pkg-md5-agree' 'pkg-md5-disagree' 'pkg-sha256-disagree'; do - touch aptarchive/${x}_1.0.dsc aptarchive/${x}_1.0.tar.gz + echo -n 'dsc' > aptarchive/${x}_1.0.dsc + echo -n 'tar' > aptarchive/${x}_1.0.tar.gz done setupaptarchive @@ -144,9 +145,9 @@ testok() { rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz testequal "Reading package lists... Building dependency tree... -Need to get 0 B of source archives. -Get:1 http://localhost:8080/ $1 1.0 (dsc) -Get:2 http://localhost:8080/ $1 1.0 (tar) +Need to get 6 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] +Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B] Download complete and in download only mode" aptget source -d "$@" msgtest 'Files were successfully downloaded for' "$1" testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz @@ -154,7 +155,8 @@ Download complete and in download only mode" aptget source -d "$@" } testkeep() { - touch ${1}_1.0.dsc ${1}_1.0.tar.gz + echo -n 'dsc' > ${1}_1.0.dsc + echo -n 'tar' > ${1}_1.0.tar.gz testequal "Reading package lists... Building dependency tree... Skipping already downloaded file '${1}_1.0.dsc' @@ -170,9 +172,9 @@ testmismatch() { rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz testequal "Reading package lists... Building dependency tree... -Need to get 0 B of source archives. -Get:1 http://localhost:8080/ $1 1.0 (dsc) -Get:2 http://localhost:8080/ $1 1.0 (tar) +Need to get 6 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] +Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B] E: Failed to fetch http://localhost:8080/${1}_1.0.dsc Hash Sum mismatch E: Failed to fetch http://localhost:8080/${1}_1.0.tar.gz Hash Sum mismatch @@ -194,9 +196,9 @@ Download complete and in download only mode" aptget source -d "$@" -o Acquire::F rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz testequal "Reading package lists... Building dependency tree... -Need to get 0 B of source archives. -Get:1 http://localhost:8080/ $1 1.0 (dsc) -Get:2 http://localhost:8080/ $1 1.0 (tar) +Need to get 6 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] +Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B] Download complete and in download only mode" aptget source --allow-unauthenticated -d "$@" -o Acquire::ForceHash=ROT26 msgtest 'Files were downloaded unauthenticated as user allowed it' "$1" testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz @@ -231,9 +233,9 @@ testfailure --nomsg test -e pkg-no-md5_1.0.dsc -a -e pkg-no-md5_1.0.tar.gz testok pkg-mixed-ok testequal 'Reading package lists... Building dependency tree... -Need to get 0 B of source archives. -Get:1 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (tar) -Get:2 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (dsc) +Need to get 6 B of source archives. +Get:1 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (tar) [3 B] +Get:2 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (dsc) [3 B] E: Failed to fetch http://localhost:8080/pkg-mixed-sha1-bad_1.0.dsc Hash Sum mismatch E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha1-bad @@ -241,9 +243,9 @@ msgtest 'Only tar file is downloaded as the dsc has hashsum mismatch' 'pkg-mixed testsuccess --nomsg test ! -e pkg-mixed-sha1-bad_1.0.dsc -a -e pkg-mixed-sha1-bad_1.0.tar.gz testequal 'Reading package lists... Building dependency tree... -Need to get 0 B of source archives. -Get:1 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (tar) -Get:2 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (dsc) +Need to get 6 B of source archives. +Get:1 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (tar) [3 B] +Get:2 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (dsc) [3 B] E: Failed to fetch http://localhost:8080/pkg-mixed-sha2-bad_1.0.tar.gz Hash Sum mismatch E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha2-bad -- cgit v1.2.3 From ffe3c68e494efc1c2c4d748fa9d69e150867e5c2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 18 Aug 2013 22:20:25 +0200 Subject: parse and retrieve multiple Descriptions in one record It seems unlikely for now that proper archives will carry multiple Description-* stanzas in the Packages (or Translation-*) file, but sometimes apt eats its own output as shown by the usage of the CD team and it would be interesting to let apt output multiple translations e.g. in 'apt-cache show'. --- test/integration/test-bug-712435-missing-descriptions | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-712435-missing-descriptions b/test/integration/test-bug-712435-missing-descriptions index 53ecbbeb3..7a3518745 100755 --- a/test/integration/test-bug-712435-missing-descriptions +++ b/test/integration/test-bug-712435-missing-descriptions @@ -87,13 +87,10 @@ $DESCRIPTION Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " aptcache show apt-normal -# displaying the translated Description would be equally valid, -# but we assume only one description is in a Packages file and -# so we prefer "Description" over "Description-*" currently. for variant in 'below' 'middle' 'top'; do testequal "Package: apt-both-$variant $PACKAGESTANZA -$DESCRIPTION +$TRANSDESCRIPTION Description-md5: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb " aptcache show apt-both-$variant done @@ -122,7 +119,7 @@ X-Some-Flag: yes testequal "Package: apt-intermixed2 $PACKAGESTANZA -$DESCRIPTION +$TRANSDESCRIPTION Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa X-Some-Flag: yes X-Foo-Flag: Something with a Description @@ -131,7 +128,7 @@ X-Bar-Flag: no testequal "Package: apt-intermixed3 $PACKAGESTANZA -$DESCRIPTION +$TRANSDESCRIPTION Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa X-Some-Flag: yes X-Foo-Flag: Something with a Description -- cgit v1.2.3 From 8710a36a01c0cb1648926792c2ad05185535558e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 10 May 2014 11:24:44 +0200 Subject: improve pkgTagSection scanning and parsing Removes the 256 fields limit, deals consistently with spaces littered all over the place and is even a tiny bit faster than before. Even comes with a bunch of new tests to validate these claims. --- test/integration/test-apt-ftparchive-src-cachedb | 5 + test/libapt/tagfile_test.cc | 179 +++++++++++++++++++++++ 2 files changed, 184 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 1af193632..c850c739f 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -177,6 +177,11 @@ assert_correct_sources_file mkdir aptarchive/pool/invalid printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc testequal " +E: Could not find a record in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid +rm -f aptarchive/pool/invalid/invalid_1.0.dsc + +printf "meep: yes" > aptarchive/pool/invalid/invalid_1.0.dsc +testequal " E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid rm -f aptarchive/pool/invalid/invalid_1.0.dsc diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc index 1bac75b55..df618ea16 100644 --- a/test/libapt/tagfile_test.cc +++ b/test/libapt/tagfile_test.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -34,3 +35,181 @@ TEST(TagFileTest,SingleField) // There is only one section in this tag file EXPECT_FALSE(tfile.Step(section)); } + +TEST(TagFileTest,MultipleSections) +{ + FileFd fd; + createTemporaryFile("bigsection", fd, NULL, "Package: pkgA\n" + "Version: 1\n" + "Size: 100\n" + "Description: aaa\n" + " aaa\n" + "\n" + "Package: pkgB\n" + "Version: 1\n" + "Flag: no\n" + "Description: bbb\n" + "\n" + "Package: pkgC\n" + "Version: 2\n" + "Flag: yes\n" + "Description:\n" + " ccc\n" + ); + + pkgTagFile tfile(&fd); + pkgTagSection section; + EXPECT_FALSE(section.Exists("Version")); + + EXPECT_TRUE(tfile.Step(section)); + EXPECT_EQ(4, section.Count()); + EXPECT_TRUE(section.Exists("Version")); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("Size")); + EXPECT_FALSE(section.Exists("Flag")); + EXPECT_TRUE(section.Exists("Description")); + EXPECT_EQ("pkgA", section.FindS("Package")); + EXPECT_EQ("1", section.FindS("Version")); + EXPECT_EQ(1, section.FindULL("Version")); + EXPECT_EQ(100, section.FindULL("Size")); + unsigned long Flags = 1; + EXPECT_TRUE(section.FindFlag("Flag", Flags, 1)); + EXPECT_EQ(1, Flags); + Flags = 0; + EXPECT_TRUE(section.FindFlag("Flag", Flags, 1)); + EXPECT_EQ(0, Flags); + EXPECT_EQ("aaa\n aaa", section.FindS("Description")); + + + EXPECT_TRUE(tfile.Step(section)); + EXPECT_EQ(4, section.Count()); + EXPECT_TRUE(section.Exists("Version")); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_FALSE(section.Exists("Size")); + EXPECT_TRUE(section.Exists("Flag")); + EXPECT_TRUE(section.Exists("Description")); + EXPECT_EQ("pkgB", section.FindS("Package")); + EXPECT_EQ("1", section.FindS("Version")); + EXPECT_EQ(1, section.FindULL("Version")); + EXPECT_EQ(0, section.FindULL("Size")); + Flags = 1; + EXPECT_TRUE(section.FindFlag("Flag", Flags, 1)); + EXPECT_EQ(0, Flags); + Flags = 0; + EXPECT_TRUE(section.FindFlag("Flag", Flags, 1)); + EXPECT_EQ(0, Flags); + EXPECT_EQ("bbb", section.FindS("Description")); + + EXPECT_TRUE(tfile.Step(section)); + EXPECT_EQ(4, section.Count()); + EXPECT_TRUE(section.Exists("Version")); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_FALSE(section.Exists("Size")); + EXPECT_TRUE(section.Exists("Flag")); + EXPECT_TRUE(section.Exists("Description")); + EXPECT_EQ("pkgC", section.FindS("Package")); + EXPECT_EQ("2", section.FindS("Version")); + EXPECT_EQ(2, section.FindULL("Version")); + Flags = 0; + EXPECT_TRUE(section.FindFlag("Flag", Flags, 1)); + EXPECT_EQ(1, Flags); + Flags = 1; + EXPECT_TRUE(section.FindFlag("Flag", Flags, 1)); + EXPECT_EQ(1, Flags); + EXPECT_EQ("ccc", section.FindS("Description")); + + // There is no section left in this tag file + EXPECT_FALSE(tfile.Step(section)); +} + +TEST(TagFileTest,BigSection) +{ + size_t const count = 500; + std::stringstream content; + for (size_t i = 0; i < count; ++i) + content << "Field-" << i << ": " << (2000 + i) << std::endl; + + FileFd fd; + createTemporaryFile("bigsection", fd, NULL, content.str().c_str()); + + pkgTagFile tfile(&fd); + pkgTagSection section; + EXPECT_TRUE(tfile.Step(section)); + + EXPECT_EQ(count, section.Count()); + for (size_t i = 0; i < count; ++i) + { + std::stringstream name; + name << "Field-" << i; + EXPECT_TRUE(section.Exists(name.str().c_str())) << name.str() << " does not exist"; + EXPECT_EQ((2000 + i), section.FindULL(name.str().c_str())); + } + + // There is only one section in this tag file + EXPECT_FALSE(tfile.Step(section)); +} + +TEST(TagFileTest, PickedUpFromPreviousCall) +{ + size_t const count = 500; + std::stringstream contentstream; + for (size_t i = 0; i < count; ++i) + contentstream << "Field-" << i << ": " << (2000 + i) << std::endl; + contentstream << std::endl << std::endl; + std::string content = contentstream.str(); + + pkgTagSection section; + EXPECT_FALSE(section.Scan(content.c_str(), content.size()/2)); + EXPECT_NE(0, section.Count()); + EXPECT_NE(count, section.Count()); + EXPECT_TRUE(section.Scan(content.c_str(), content.size(), false)); + EXPECT_EQ(count, section.Count()); + + for (size_t i = 0; i < count; ++i) + { + std::stringstream name; + name << "Field-" << i; + EXPECT_TRUE(section.Exists(name.str().c_str())) << name.str() << " does not exist"; + EXPECT_EQ((2000 + i), section.FindULL(name.str().c_str())); + } +} + +TEST(TagFileTest, SpacesEverywhere) +{ + std::string content = + "Package: pkgA\n" + "Package: pkgB\n" + "NoSpaces:yes\n" + "TagSpaces\t :yes\n" + "ValueSpaces: \tyes\n" + "BothSpaces \t:\t yes\n" + "TrailingSpaces: yes\t \n" + "Naming Space: yes\n" + "Naming Spaces: yes\n" + "Package : pkgC \n" + "Multi-Colon::yes:\n" + "\n\n"; + + pkgTagSection section; + EXPECT_TRUE(section.Scan(content.c_str(), content.size())); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("NoSpaces")); + EXPECT_TRUE(section.Exists("TagSpaces")); + EXPECT_TRUE(section.Exists("ValueSpaces")); + EXPECT_TRUE(section.Exists("BothSpaces")); + EXPECT_TRUE(section.Exists("TrailingSpaces")); + EXPECT_TRUE(section.Exists("Naming Space")); + EXPECT_TRUE(section.Exists("Naming Spaces")); + EXPECT_TRUE(section.Exists("Multi-Colon")); + EXPECT_EQ("pkgC", section.FindS("Package")); + EXPECT_EQ("yes", section.FindS("NoSpaces")); + EXPECT_EQ("yes", section.FindS("TagSpaces")); + EXPECT_EQ("yes", section.FindS("ValueSpaces")); + EXPECT_EQ("yes", section.FindS("BothSpaces")); + EXPECT_EQ("yes", section.FindS("TrailingSpaces")); + EXPECT_EQ("yes", section.FindS("Naming Space")); + EXPECT_EQ("yes", section.FindS("Naming Spaces")); + EXPECT_EQ(":yes:", section.FindS("Multi-Colon")); + // overridden values are still present, but not really accessible + EXPECT_EQ(11, section.Count()); +} -- cgit v1.2.3 From 7a223b933cab0447438ca2e964576da39078eaf4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 10 May 2014 12:50:00 +0200 Subject: invalid cache if architecture set doesn't match The cache heavily depends on the architecture(s) it is build for, especially if you move from single- to multiarch. Adding a new architecture to dpkg therefore has to be detected and must invalidate the cache so that we don't operate on incorrect data. The incorrect data will prevent us from doing otherwise sensible actions (it doesn't allow bad things to happen) and the recovery is simple and automatic in most cases, so this hides pretty well and is also not as serious as it might sound at first. Closes: 745036 --- .../test-bug-745036-new-foreign-invalidates-cache | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 test/integration/test-bug-745036-new-foreign-invalidates-cache (limited to 'test') diff --git a/test/integration/test-bug-745036-new-foreign-invalidates-cache b/test/integration/test-bug-745036-new-foreign-invalidates-cache new file mode 100755 index 000000000..490cbecdd --- /dev/null +++ b/test/integration/test-bug-745036-new-foreign-invalidates-cache @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertpackage 'unstable' 'cool-foo' 'amd64' '1.0' 'Depends: foo' +insertpackage 'unstable' 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' +insertinstalledpackage 'cool-foo' 'amd64' '1.0' 'Depends: foo' +insertinstalledpackage 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' + +setupaptarchive + +testsuccess aptget check -s + +configarchitecture 'amd64' 'i386' +testequal 'E: The package cache was built for different architectures: amd64 vs amd64,i386' aptget check -s -o pkgCacheFile::Generate=false + +testsuccess aptget check -s + +insertinstalledpackage 'awesome-foo' 'i386' '1.0' 'Depends: foo' + +testsuccess aptget check -s + +testsuccess aptget update --no-download + +testsuccess aptget check -s -- cgit v1.2.3 From b2db070b7b633e03674c0ae8765025c29a4d4490 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 10 May 2014 14:21:10 +0200 Subject: add an additional test for arch specific conflicts In bugreport #747261 I confirmed with this testcase that apt actually supports the requested architecture-specific conflicts already since 2012 with commit cef094c2ec8214b2783a2ac3aa70cf835381eae1. The old test only does simulations which are handy to check apt, this one builds 'real' packages to see if dpkg agrees with us. Git-Dch: Ignore --- .../test-bug-747261-arch-specific-conflicts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 test/integration/test-bug-747261-arch-specific-conflicts (limited to 'test') diff --git a/test/integration/test-bug-747261-arch-specific-conflicts b/test/integration/test-bug-747261-arch-specific-conflicts new file mode 100755 index 000000000..bfb2d089f --- /dev/null +++ b/test/integration/test-bug-747261-arch-specific-conflicts @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'sparc' 'armel' + +buildsimplenativepackage 'libc6' 'amd64,sparc,armel' '1' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libc6-i386' 'amd64' '1' 'stable' 'Conflicts: libc6:sparc' + +setupaptarchive + +testsuccess aptget install 'libc6:amd64' 'libc6:sparc' -y +testdpkginstalled 'libc6:amd64' 'libc6:sparc' +testdpkgnotinstalled 'libc6-i386' 'libc6:armel' + +testsuccess aptget install libc6-i386 -y +testdpkginstalled 'libc6:amd64' 'libc6-i386' +testdpkgnotinstalled 'libc6:sparc' 'libc6:armel' + +testsuccess aptget install libc6:armel -y +testdpkginstalled 'libc6:amd64' 'libc6:armel' 'libc6-i386' +testdpkgnotinstalled 'libc6:sparc' + +testsuccess aptget install libc6:sparc -y +testdpkginstalled 'libc6:amd64' 'libc6:armel' 'libc6:sparc' +testdpkgnotinstalled 'libc6-i386' + +testsuccess aptget purge 'libc6:*' 'libc6-i386' -y +testdpkgnotinstalled 'libc6:amd64' 'libc6:armel' 'libc6:sparc' 'libc6-i386' + +# check that (the actually simpler) single arch is fine, too +configarchitecture 'amd64' +testfailure aptget install libc6:sparc -s +testsuccess aptget install libc6 libc6-i386 -y -- cgit v1.2.3 From 4f6d26b4d41474aa390329b7e9cb167eb70b2821 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 12 May 2014 21:25:43 +0200 Subject: (try to) fix travis-ci build failures dpkg on Ubuntu 12.04 does not seem to support parsing arch-specific dependencies, so we try to detect if we face such a dpkg in the test. In the other test the order depends on libdb, which changes per arch, so we just run it through our sorting binary and be happy (hopefully). Git-Dch: Ignore --- test/integration/framework | 3 ++- test/integration/test-apt-ftparchive-src-cachedb | 10 +++++----- test/integration/test-bug-747261-arch-specific-conflicts | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 4d0d07cc2..b469fd3f6 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -36,7 +36,7 @@ msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}"; } msgtest() { while [ -n "$1" ]; do echo -n "${CINFO}$1${CCMD} " - echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " + echo -n "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} " shift if [ -n "$1" ]; then shift; else break; fi done @@ -114,6 +114,7 @@ aptget() { runapt apt-get "$@"; } aptftparchive() { runapt apt-ftparchive "$@"; } aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } +aptsortpkgs() { runapt apt-sortpkgs "$@"; } apt() { runapt apt "$@"; } apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index c850c739f..e7b148530 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -3,9 +3,9 @@ set -e assert_correct_sources_file() { testequal "Package: bar -Binary: bar -Version: 1.0 Architecture: all +Version: 1.0 +Binary: bar Format: 3.0 (native) Directory: pool/main Files: @@ -24,9 +24,9 @@ Checksums-Sha512: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz Package: foo -Binary: foo -Version: 1.0 Architecture: all +Version: 1.0 +Binary: foo Format: 3.0 (native) Directory: pool/main Files: @@ -43,7 +43,7 @@ Checksums-Sha256: Checksums-Sha512: 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz -" cat ./aptarchive/dists/test/main/source/Sources +" aptsortpkgs ./aptarchive/dists/test/main/source/Sources } create_source_files() { diff --git a/test/integration/test-bug-747261-arch-specific-conflicts b/test/integration/test-bug-747261-arch-specific-conflicts index bfb2d089f..be971b89e 100755 --- a/test/integration/test-bug-747261-arch-specific-conflicts +++ b/test/integration/test-bug-747261-arch-specific-conflicts @@ -6,6 +6,21 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' 'sparc' 'armel' +msgtest 'Check that dpkg supports' 'arch-specific dependencies' +set +e +# this fails always, the question is just how it fails +dpkg-checkbuilddeps -d 'foobar:barfoo' /dev/null 2>/dev/null >/dev/null +RETURNCODE=$? +set -e +if [ "$RETURNCODE" != '1' ]; then + dpkg-checkbuilddeps -d 'foobar:barfoo' /dev/null || true + echo "Command had returncode: $RETURNCODE" + msgskip + exit 0 +else + msgpass +fi + buildsimplenativepackage 'libc6' 'amd64,sparc,armel' '1' 'stable' 'Multi-Arch: same' buildsimplenativepackage 'libc6-i386' 'amd64' '1' 'stable' 'Conflicts: libc6:sparc' -- cgit v1.2.3 From bc1c9081e826c2c7f265f23d388ba868d5011f6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 15 May 2014 14:37:33 +0200 Subject: Never parse Version/Architecture tags in a Translation-$lang file Version/Architecture information in a Translation-$lang file is not allowed, so don't try to parse it. This is a fix for a bugreport where a Translation-en file contained the content of the regular Packages file (probably due to local FS corruption). This lead to strange error messages on file download. Thanks to Thomas Reusch for the report. --- .../test-apt-translation-has-no-packages | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 test/integration/test-apt-translation-has-no-packages (limited to 'test') diff --git a/test/integration/test-apt-translation-has-no-packages b/test/integration/test-apt-translation-has-no-packages new file mode 100755 index 000000000..bb2353a33 --- /dev/null +++ b/test/integration/test-apt-translation-has-no-packages @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Due to corruption (local or network) a user might end up with a +# Translation-$lang file on disk that is actually a Packages file. In this +# case apt used to generate invalid package versions out of the +# Translation-$lang file (i.e. apt-cache policy foo) would show a version +# comming out of a Translation file. Downloading this versions fails as +# there is no acquire method available for the package +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "amd64" + +if [ ! -x ${BUILDDIRECTORY}/apt ]; then + msgmsg "No ${BUILDDIRECTORY}/apt" + msgskip + exit 0 +fi + +buildsimplenativepackage 'foo' 'all' '1.0' +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +# corrupt the Translation-en file to look like a regular Packages file +rm rootdir/var/cache/apt/*.bin +cp $APTARCHIVE/dists/unstable/main/binary-amd64/Packages \ + rootdir/var/lib/apt/lists/*Translation-en + +# ensure that there is no Version for the package foo generated out of +# the corrupted Translation-en file +testequal "foo: + Installed: (none) + Candidate: 1.0 + Version table: + 1.0 0 + 500 file:$APTARCHIVE/ unstable/main amd64 Packages" aptcache policy foo -- cgit v1.2.3 From 6f22aa086954064b2ee58cd11b50832b242d54ad Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 10 May 2014 14:21:10 +0200 Subject: add an additional test for arch specific conflicts In bugreport #747261 I confirmed with this testcase that apt actually supports the requested architecture-specific conflicts already since 2012 with commit cef094c2ec8214b2783a2ac3aa70cf835381eae1. The old test only does simulations which are handy to check apt, this one builds 'real' packages to see if dpkg agrees with us. Git-Dch: Ignore --- .../test-bug-747261-arch-specific-conflicts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 test/integration/test-bug-747261-arch-specific-conflicts (limited to 'test') diff --git a/test/integration/test-bug-747261-arch-specific-conflicts b/test/integration/test-bug-747261-arch-specific-conflicts new file mode 100755 index 000000000..bfb2d089f --- /dev/null +++ b/test/integration/test-bug-747261-arch-specific-conflicts @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'sparc' 'armel' + +buildsimplenativepackage 'libc6' 'amd64,sparc,armel' '1' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libc6-i386' 'amd64' '1' 'stable' 'Conflicts: libc6:sparc' + +setupaptarchive + +testsuccess aptget install 'libc6:amd64' 'libc6:sparc' -y +testdpkginstalled 'libc6:amd64' 'libc6:sparc' +testdpkgnotinstalled 'libc6-i386' 'libc6:armel' + +testsuccess aptget install libc6-i386 -y +testdpkginstalled 'libc6:amd64' 'libc6-i386' +testdpkgnotinstalled 'libc6:sparc' 'libc6:armel' + +testsuccess aptget install libc6:armel -y +testdpkginstalled 'libc6:amd64' 'libc6:armel' 'libc6-i386' +testdpkgnotinstalled 'libc6:sparc' + +testsuccess aptget install libc6:sparc -y +testdpkginstalled 'libc6:amd64' 'libc6:armel' 'libc6:sparc' +testdpkgnotinstalled 'libc6-i386' + +testsuccess aptget purge 'libc6:*' 'libc6-i386' -y +testdpkgnotinstalled 'libc6:amd64' 'libc6:armel' 'libc6:sparc' 'libc6-i386' + +# check that (the actually simpler) single arch is fine, too +configarchitecture 'amd64' +testfailure aptget install libc6:sparc -s +testsuccess aptget install libc6 libc6-i386 -y -- cgit v1.2.3 From 8f418981337503ff7abedd872f788b51bcdbc886 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 22 Apr 2014 16:07:32 +0200 Subject: show upgradable packages after apt update Closes: 748389 --- test/integration/test-apt-cli-update | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 test/integration/test-apt-cli-update (limited to 'test') diff --git a/test/integration/test-apt-cli-update b/test/integration/test-apt-cli-update new file mode 100755 index 000000000..8237bf03f --- /dev/null +++ b/test/integration/test-apt-cli-update @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '2.0' +insertinstalledpackage 'foo' 'all' '1.0' + +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +testequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q -- cgit v1.2.3 From 50d98a1be2e15f44dea23a5d3840c79366a42fe0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 May 2014 10:49:35 +0200 Subject: Implement simple by-hash for apt update This implements a apt update schema that get the indexfiles by the hash instead of the name. The rational is that updates to the archive servers/mirrors are not atomic so the client may have the previous version of the Release file when the server updates to a new Release file and new Packages/Sources/Translations indexes. By keeping the files around by their hash we can still get the previous indexfile without a hashsum mismatch. Enable with APT::Acquire::By-Hash=1 --- test/integration/test-apt-by-hash-update | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 test/integration/test-apt-by-hash-update (limited to 'test') diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update new file mode 100755 index 000000000..6b3032ad6 --- /dev/null +++ b/test/integration/test-apt-by-hash-update @@ -0,0 +1,39 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '1.0' + +setupaptarchive --no-update + +APTARCHIVE=$(readlink -f ./aptarchive) + +# make Packages *only* accessable by-hash for this test +mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash +(cd aptarchive/dists/unstable/main/binary-i386/by-hash && + mv ../Packages* . && + ln -s Packages.gz $(sha256sum Packages.gz|cut -f1 -d' ') ) + +# add sources +mkdir -p aptarchive/dists/unstable/main/source/by-hash +(cd aptarchive/dists/unstable/main/source/by-hash && + ln -s ../Sources.gz $(sha256sum ../Sources.gz|cut -f1 -d' ') +) + + +# ensure we do not know about "foo" +testequal "Reading package lists... +Building dependency tree... +E: Unable to locate package foo" aptget install -q -s foo + +# ensure we can apt-get update by hash +testsuccess aptget update -o APT::Acquire::By-Hash=1 + +# ensure it keeps working +testequal "Inst foo (1.0 unstable [all]) +Conf foo (1.0 unstable [all])" aptget install -qq -s foo \ No newline at end of file -- cgit v1.2.3 From a2fdb57ff93c1b1f35b796c3c99878ec3ae54a06 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 May 2014 17:36:09 +0200 Subject: Add APT::Acquire::$(host)::By-Hash=1 knob, add Acquire-By-Hash to Release file The by-hash can be configured on a per-hostname basis and a Release file can indicate that it has by-hash support via a new flag. The location of the hash now matches the AptByHash spec --- test/integration/test-apt-by-hash-update | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index 6b3032ad6..23282bf86 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -14,17 +14,19 @@ setupaptarchive --no-update APTARCHIVE=$(readlink -f ./aptarchive) # make Packages *only* accessable by-hash for this test -mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash -(cd aptarchive/dists/unstable/main/binary-i386/by-hash && - mv ../Packages* . && - ln -s Packages.gz $(sha256sum Packages.gz|cut -f1 -d' ') ) +mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 +(cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 && + mv ../../Packages* . && + ln -s Packages.gz $(sha512sum Packages.gz|cut -f1 -d' ') ) # add sources -mkdir -p aptarchive/dists/unstable/main/source/by-hash -(cd aptarchive/dists/unstable/main/source/by-hash && - ln -s ../Sources.gz $(sha256sum ../Sources.gz|cut -f1 -d' ') +mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512 +(cd aptarchive/dists/unstable/main/source/by-hash/SHA512 && + ln -s ../../Sources.gz $(sha512sum ../../Sources.gz|cut -f1 -d' ') ) +# we moved the Packages file away, normal update won't work +testfailure aptget upate # ensure we do not know about "foo" testequal "Reading package lists... @@ -34,6 +36,14 @@ E: Unable to locate package foo" aptget install -q -s foo # ensure we can apt-get update by hash testsuccess aptget update -o APT::Acquire::By-Hash=1 -# ensure it keeps working +# ensure it works testequal "Inst foo (1.0 unstable [all]) -Conf foo (1.0 unstable [all])" aptget install -qq -s foo \ No newline at end of file +Conf foo (1.0 unstable [all])" aptget install -qq -s foo + +# add magic string to Release file ... +MAGIC="Acquire-By-Hash: true" +sed -i "s#Suite: unstable#Suite: unstable\n$MAGIC#" aptarchive/dists/unstable/Release +signreleasefiles +# ... and verify that it fetches by hash now +testsuccess aptget update + -- cgit v1.2.3 From a6fd378a9b2a541a18aeba722ecfedba9af567cb Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 8 May 2014 18:52:51 +0200 Subject: make test independent from the actual Install-Size Git-Dch: Ignore --- test/integration/test-apt-ftparchive-cachedb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index 147272a2c..0e1986bcd 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -5,7 +5,7 @@ ensure_correct_packages_file() { testequal "Package: foo Priority: optional Section: others -Installed-Size: 29 +$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##') Maintainer: Joe Sixpack Architecture: i386 Version: 1 @@ -25,7 +25,7 @@ usr/share/doc/foo/copyright others/foo" cat ./aptarchive/dists/test/Conte TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' mkdir -p aptarchive/dists/test/main/i18n/ mkdir -p aptarchive/dists/test/main/source/ -- cgit v1.2.3 From 0eb4af9d3d0c524c7afdc684238aa263ac287449 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 17 May 2014 12:37:13 +0200 Subject: fix tight loop detection and temporary removes As outlined in #748355 apt segfaulted if it encountered a loop between a package pre-depending on a package conflicting with the previous as it ended up in an endless loop trying to unpack 'the other package'. In this specific case as an essential package is involved a lot of force needs to be applied, but can also be caused by 'normal' tight loops and highlights a problem in how we handle breaks which we want to avoid. The fix comes in multiple entangled changes: 1. All Smart* calls are guarded with loop detection. Some already had it, some had parts of it, some did it incorrect, and some didn't even try. 2. temporary removes to avoid a loop (which is done if a loop is detected) prevent the unpack of this looping package (we tried to unpack it to avoid the conflict/breaks, but due to a loop we couldn't, so we remove/deconfigure it instead which means we can't unpack it now) 3. handle conflicts and breaks very similar instead of duplicating most of the code. The only remaining difference is, as it should: deconfigure is enough for breaks, for conflicts we need the big hammer --- .../test-bug-618288-multiarch-same-lockstep | 19 ++++---- .../test-bug-673536-pre-depends-breaks-loop | 28 +++++++++--- test/integration/test-conflicts-loop | 6 ++- test/integration/test-essential-force-loopbreak | 51 ++++++++++++++++++++++ 4 files changed, 86 insertions(+), 18 deletions(-) create mode 100755 test/integration/test-essential-force-loopbreak (limited to 'test') diff --git a/test/integration/test-bug-618288-multiarch-same-lockstep b/test/integration/test-bug-618288-multiarch-same-lockstep index e0305b64b..536124c2c 100755 --- a/test/integration/test-bug-618288-multiarch-same-lockstep +++ b/test/integration/test-bug-618288-multiarch-same-lockstep @@ -16,22 +16,23 @@ buildsimplenativepackage 'apt' 'i386' '2' 'unstable' 'Depends: libsame (= 2)' '' buildsimplenativepackage 'apt2' 'amd64' '2' 'unstable' 'Depends: libsame (= 2)' '' 'required' setupaptarchive -aptget dist-upgrade -s >output.apt 2>&1 +testsuccess aptget dist-upgrade -s -o Debug::pkgPackageManager=1 # order in switch libsame:{amd64,i386} are unpacked is irrelevant, as both are installed - but we need to do it together -LS_U_AMD="$(grep -o -n '^Inst libsame ' output.apt | cut -d: -f1)" -LS_U_INT="$(grep -o -n '^Inst libsame:i386 ' output.apt | cut -d: -f1)" -LS_C_AMD="$(grep -o -n '^Conf libsame ' output.apt | cut -d: -f1)" -LS_C_INT="$(grep -o -n '^Conf libsame:i386 ' output.apt | cut -d: -f1)" +OUTPUT=rootdir/tmp/testsuccess.output +LS_U_AMD="$(grep -o -n '^Inst libsame ' $OUTPUT | cut -d: -f1)" +LS_U_INT="$(grep -o -n '^Inst libsame:i386 ' $OUTPUT | cut -d: -f1)" +LS_C_AMD="$(grep -o -n '^Conf libsame ' $OUTPUT | cut -d: -f1)" +LS_C_INT="$(grep -o -n '^Conf libsame:i386 ' $OUTPUT | cut -d: -f1)" -msgtest 'Test if libsame:amd64 unpack before configure' +msgtest 'Test if' 'libsame:amd64 unpack before configure' test "$LS_U_AMD" -lt "$LS_C_AMD" && msgpass || msgfail -msgtest 'Test if libsame:i386 unpack before configure' +msgtest 'Test if' 'libsame:i386 unpack before configure' test "$LS_U_INT" -lt "$LS_C_INT" && msgpass || msgfail -msgtest 'Test if libsame:amd64 unpack is before libsame:i386 configure' +msgtest 'Test if' 'libsame:amd64 unpack is before libsame:i386 configure' test "$LS_U_AMD" -lt "$LS_C_INT" && msgpass || msgfail -msgtest 'Test if libsame:i386 unpack is before libsame:amd64 configure' +msgtest 'Test if' 'libsame:i386 unpack is before libsame:amd64 configure' test "$LS_U_INT" -lt "$LS_C_AMD" && msgpass || msgfail diff --git a/test/integration/test-bug-673536-pre-depends-breaks-loop b/test/integration/test-bug-673536-pre-depends-breaks-loop index f6a90b21f..21bd5e065 100755 --- a/test/integration/test-bug-673536-pre-depends-breaks-loop +++ b/test/integration/test-bug-673536-pre-depends-breaks-loop @@ -6,18 +6,32 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'native' -buildsimplenativepackage 'basic' 'native' '1' 'stable' +buildsimplenativepackage 'advanced' 'native' '1' 'stable' +buildsimplenativepackage 'advanced' 'native' '2' 'unstable' 'Pre-Depends: basic' buildsimplenativepackage 'basic' 'native' '2' 'unstable' 'Pre-Depends: common' -buildsimplenativepackage 'common' 'native' '2' 'unstable' 'Breaks: basic (<= 1)' + +buildsimplenativepackage 'common' 'native' '2~conflict' 'unstable-conflict' 'Conflicts: advanced (<= 1)' +buildsimplenativepackage 'common' 'native' '2~break' 'unstable-break' 'Conflicts: advanced (<= 1)' setupaptarchive # we check with 'real' packages here as the simulation reports a 'Conf broken' # which is technical correct for the simulation, but testing errormsg is ugly -testsuccess aptget install basic=1 -y -testdpkginstalled basic -testdpkgnotinstalled common +cp -a rootdir/var/lib/dpkg/status dpkg.status.backup + +testloopbreak() { + cp -a dpkg.status.backup rootdir/var/lib/dpkg/status + rm -f rootdir/var/lib/apt/extended_states + + + testsuccess aptget install advanced=1 -y -t "$1" -o Debug::pkgPackageManager=1 + testdpkginstalled advanced + testdpkgnotinstalled basic common + + testsuccess aptget dist-upgrade -y -t "$1" -o Debug::pkgPackageManager=1 + testdpkginstalled advanced basic common +} -testsuccess aptget dist-upgrade -y -testdpkginstalled basic common +testloopbreak 'unstable-break' +testloopbreak 'unstable-conflict' diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop index 4978fe1e8..a2c411aaf 100755 --- a/test/integration/test-conflicts-loop +++ b/test/integration/test-conflicts-loop @@ -20,11 +20,13 @@ Building dependency tree... The following packages will be upgraded: openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. -Remv openjdk-6-jre [6b16-1.8-0ubuntu1] +Remv openjdk-6-jre-headless [6b16-1.8-0ubuntu1] Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1] -Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Inst openjdk-6-jre [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Inst openjdk-6-jre-lib [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre-lib (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) +Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre-headless (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])' aptget dist-upgrade -s -o APT::Immediate-Configure-All=true + +testsuccess aptget dist-upgrade -s -o Debug::pkgPackageManager=1 diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak new file mode 100755 index 000000000..842dce61c --- /dev/null +++ b/test/integration/test-essential-force-loopbreak @@ -0,0 +1,51 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'sysvinit' 'amd64' '1' 'Essential: yes' + +buildsimplenativepackage 'sysvinit' 'amd64' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv +Essential: yes' +buildsimplenativepackage 'sysvinit-core' 'amd64' '2' 'sid' + +buildsimplenativepackage 'systemd-sysv' 'amd64' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2) +Breaks: sysvinit-core' + +buildsimplenativepackage 'systemd-sysv' 'amd64' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core' + +setupaptarchive + +cp -a rootdir/var/lib/dpkg/status dpkg.status.backup + +testforcebreak() { + cp -a dpkg.status.backup rootdir/var/lib/dpkg/status + rm -f rootdir/var/lib/apt/extended_states + testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + sysvinit +The following NEW packages will be installed: + systemd-sysv +The following packages will be upgraded: + sysvinit +1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +E: This installation run will require temporarily removing the essential package sysvinit:amd64 due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. +E: Internal Error, Could not early remove sysvinit:amd64 (2)' aptget install systemd-sysv -t "$1" -s + # ensure that really nothing happens + testfailure aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 + testdpkginstalled 'sysvinit' + testdpkgnotinstalled 'systemd-sysv' + + # with enough force however … + cp -a dpkg.status.backup rootdir/var/lib/dpkg/status + testsuccess aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 -o APT::Force-LoopBreak=1 + testdpkginstalled 'sysvinit' 'systemd-sysv' +} + +testforcebreak 'sid-conflict' +testforcebreak 'sid-break' -- cgit v1.2.3 From 28ba3f89659afe95fee4175d802febf895dc15a4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 28 May 2014 09:24:58 +0200 Subject: Fix uninitialized value Reported-By: scan-build --- test/libapt/cdrom_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/libapt/cdrom_test.cc b/test/libapt/cdrom_test.cc index 626ef538e..5cf3b353c 100644 --- a/test/libapt/cdrom_test.cc +++ b/test/libapt/cdrom_test.cc @@ -91,7 +91,7 @@ TEST(CDROMTest,ReduceSourcelist) } TEST(CDROMTest, FindMountPointForDevice) { - char * tempfile; + char * tempfile = NULL; FileFd fd; createTemporaryFile("mountpoints", fd, &tempfile, "rootfs / rootfs rw 0 0\n" -- cgit v1.2.3 From e1a69e71efc0679815f722480169f16bf02622ab Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 12 May 2014 21:25:43 +0200 Subject: (try to) fix travis-ci build failures dpkg on Ubuntu 12.04 does not seem to support parsing arch-specific dependencies, so we try to detect if we face such a dpkg in the test. In the other test the order depends on libdb, which changes per arch, so we just run it through our sorting binary and be happy (hopefully). Git-Dch: Ignore --- test/integration/framework | 3 ++- test/integration/test-apt-ftparchive-src-cachedb | 10 +++++----- test/integration/test-bug-747261-arch-specific-conflicts | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index eda3cebad..4f0a69994 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -36,7 +36,7 @@ msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}"; } msgtest() { while [ -n "$1" ]; do echo -n "${CINFO}$1${CCMD} " - echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " + echo -n "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} " shift if [ -n "$1" ]; then shift; else break; fi done @@ -114,6 +114,7 @@ aptget() { runapt apt-get "$@"; } aptftparchive() { runapt apt-ftparchive "$@"; } aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } +aptsortpkgs() { runapt apt-sortpkgs "$@"; } apt() { runapt apt "$@"; } apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 1af193632..adcca6217 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -3,9 +3,9 @@ set -e assert_correct_sources_file() { testequal "Package: bar -Binary: bar -Version: 1.0 Architecture: all +Version: 1.0 +Binary: bar Format: 3.0 (native) Directory: pool/main Files: @@ -24,9 +24,9 @@ Checksums-Sha512: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz Package: foo -Binary: foo -Version: 1.0 Architecture: all +Version: 1.0 +Binary: foo Format: 3.0 (native) Directory: pool/main Files: @@ -43,7 +43,7 @@ Checksums-Sha256: Checksums-Sha512: 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz -" cat ./aptarchive/dists/test/main/source/Sources +" aptsortpkgs ./aptarchive/dists/test/main/source/Sources } create_source_files() { diff --git a/test/integration/test-bug-747261-arch-specific-conflicts b/test/integration/test-bug-747261-arch-specific-conflicts index bfb2d089f..be971b89e 100755 --- a/test/integration/test-bug-747261-arch-specific-conflicts +++ b/test/integration/test-bug-747261-arch-specific-conflicts @@ -6,6 +6,21 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' 'sparc' 'armel' +msgtest 'Check that dpkg supports' 'arch-specific dependencies' +set +e +# this fails always, the question is just how it fails +dpkg-checkbuilddeps -d 'foobar:barfoo' /dev/null 2>/dev/null >/dev/null +RETURNCODE=$? +set -e +if [ "$RETURNCODE" != '1' ]; then + dpkg-checkbuilddeps -d 'foobar:barfoo' /dev/null || true + echo "Command had returncode: $RETURNCODE" + msgskip + exit 0 +else + msgpass +fi + buildsimplenativepackage 'libc6' 'amd64,sparc,armel' '1' 'stable' 'Multi-Arch: same' buildsimplenativepackage 'libc6-i386' 'amd64' '1' 'stable' 'Conflicts: libc6:sparc' -- cgit v1.2.3 From 1f6cf9e79742ea8e328ef2225b2f5217a9440216 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 30 May 2014 18:01:47 +0200 Subject: support parsing EDSP requests Architecture{,s} stanza Adds also a small testcase for EDSP Git-Dch: Ignore --- test/integration/framework | 6 ++ .../test-external-dependency-solver-protocol | 65 ++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100755 test/integration/test-external-dependency-solver-protocol (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 4f0a69994..7959699fd 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -194,6 +194,12 @@ setupenvironment() { touch var/lib/dpkg/available mkdir -p usr/lib/apt ln -s ${METHODSDIR} usr/lib/apt/methods + if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then + mkdir -p usr/lib/apt/solvers + ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr/lib/apt/solvers/dump + ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr/lib/apt/solvers/apt + echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc/apt/apt.conf.d/externalsolver.conf + fi # use the autoremove from the BUILDDIRECTORY if its there, otherwise # system if [ -e ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove ]; then diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol new file mode 100755 index 000000000..129565993 --- /dev/null +++ b/test/integration/test-external-dependency-solver-protocol @@ -0,0 +1,65 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'cool' 'all' '1' +insertinstalledpackage 'stuff' 'all' '1' + +insertpackage 'unstable' 'cool' 'all' '2' 'Multi-Arch: foreign' +insertpackage 'unstable' 'stuff' 'all' '2' 'Multi-Arch: foreign' +insertpackage 'unstable' 'coolstuff' 'i386,amd64' '2' 'Depends: cool, stuff' +insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign' +insertpackage 'unstable' 'awesomecoolstuff' 'i386' '2' 'Depends: coolstuff, awesome' + +insertpackage 'experimental' 'cool' 'all' '3' 'Multi-Arch: foreign' +insertpackage 'experimental' 'stuff' 'all' '3' 'Multi-Arch: foreign' +insertpackage 'experimental' 'coolstuff' 'i386,amd64' '3' 'Depends: cool, stuff' + +setupaptarchive + +rm -f /tmp/dump.edsp +testequal 'Reading package lists... +Building dependency tree... +Execute external solver... +The solver encountered an error of type: ERR_JUST_DUMPING +The following information might help you to understand what is wrong: +I am too dumb, i can just dump! +Please use one of my friends instead! + +E: External solver failed with: I am too dumb, i can just dump!' aptget install --solver dump coolstuff -s +testsuccess test -s /tmp/dump.edsp +rm -f /tmp/dump.edsp + +#FIXME: this should be unstable, but we don't support pinning yet +testequal 'Reading package lists... +Building dependency tree... +Execute external solver... +The following NEW packages will be installed: + coolstuff +0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. +Inst coolstuff (3 experimental [amd64]) +Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s + +testsuccess aptget install awesomecoolstuff:i386 -s +testsuccess aptget install --solver apt awesomecoolstuff:i386 -s + +rm -f /tmp/dump.edsp +testfailure aptget install --solver dump awesomecoolstuff:i386 -s +testsuccess test -s /tmp/dump.edsp + +configarchitecture 'armel' +msgtest 'Test direct calling is okay for' 'apt-internal-solver' +cat /tmp/dump.edsp | runapt apt-internal-solver > solver.result 2>&1 || true +if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then + msgpass +else + cat solver.result + msgfail +fi +rm -f /tmp/dump.edsp + +testfailure aptget install --solver apt awesomecoolstuff:i386 -s -- cgit v1.2.3 From 91a6f32eec508465e7ffafa6b3fef3bb59c719c0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 30 May 2014 19:18:25 +0200 Subject: show current/total testcase statistic also in concise mode Git-Dch: Ignore --- test/integration/run-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/run-tests b/test/integration/run-tests index d700cc3fc..d39daeee5 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -39,7 +39,7 @@ fi TOTAL="$(run-parts --list $DIR | grep '/test-' | wc -l)" for testcase in $(run-parts --list $DIR | grep '/test-'); do if [ "$MSGLEVEL" -le 2 ]; then - echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " + echo -n "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " else echo "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}" fi -- cgit v1.2.3 From d91e3cfa1992599c088673ef68bcdfd4d0aedc85 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 30 May 2014 23:15:28 +0200 Subject: use 'native' instead of 'amd64' as pkg arch Git-Dch: Ignore --- test/integration/test-essential-force-loopbreak | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak index 842dce61c..d60c6cbd5 100755 --- a/test/integration/test-essential-force-loopbreak +++ b/test/integration/test-essential-force-loopbreak @@ -5,18 +5,18 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture 'amd64' +configarchitecture 'native' -insertinstalledpackage 'sysvinit' 'amd64' '1' 'Essential: yes' +insertinstalledpackage 'sysvinit' 'native' '1' 'Essential: yes' -buildsimplenativepackage 'sysvinit' 'amd64' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv +buildsimplenativepackage 'sysvinit' 'native' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv Essential: yes' -buildsimplenativepackage 'sysvinit-core' 'amd64' '2' 'sid' +buildsimplenativepackage 'sysvinit-core' 'native' '2' 'sid' -buildsimplenativepackage 'systemd-sysv' 'amd64' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2) +buildsimplenativepackage 'systemd-sysv' 'native' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2) Breaks: sysvinit-core' -buildsimplenativepackage 'systemd-sysv' 'amd64' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core' +buildsimplenativepackage 'systemd-sysv' 'native' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core' setupaptarchive @@ -25,7 +25,7 @@ cp -a rootdir/var/lib/dpkg/status dpkg.status.backup testforcebreak() { cp -a dpkg.status.backup rootdir/var/lib/dpkg/status rm -f rootdir/var/lib/apt/extended_states - testequal 'Reading package lists... + testequal "Reading package lists... Building dependency tree... The following extra packages will be installed: sysvinit @@ -34,8 +34,8 @@ The following NEW packages will be installed: The following packages will be upgraded: sysvinit 1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -E: This installation run will require temporarily removing the essential package sysvinit:amd64 due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. -E: Internal Error, Could not early remove sysvinit:amd64 (2)' aptget install systemd-sysv -t "$1" -s +E: This installation run will require temporarily removing the essential package sysvinit:$(getarchitecture 'native') due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. +E: Internal Error, Could not early remove sysvinit:amd64 (2)" aptget install systemd-sysv -t "$1" -s # ensure that really nothing happens testfailure aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 testdpkginstalled 'sysvinit' -- cgit v1.2.3 From a3f1d60cb75ab83f63a52a43c056a4752c8fdeb2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 30 May 2014 14:47:56 +0200 Subject: Show unauthenticated warning for source packages as well This will show the same unauthenticated warning for source packages as for binary packages and will not download a source package if it is unauthenticated. This can be overridden with --allow-unauthenticated Closes: #749795 --- test/integration/test-apt-get-source-authenticated | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 test/integration/test-apt-get-source-authenticated (limited to 'test') diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated new file mode 100755 index 000000000..2cee13923 --- /dev/null +++ b/test/integration/test-apt-get-source-authenticated @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Regression test for debian bug #749795. Ensure that we fail with +# a error if apt-get source foo will download a source that comes +# from a unauthenticated repository +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# a "normal" package with source and binary +buildsimplenativepackage 'foo' 'all' '2.0' + +setupaptarchive --no-update + +APTARCHIVE=$(readlink -f ./aptarchive) +rm -f $APTARCHIVE/dists/unstable/*Release* + +# update without authenticated InRelease file +testsuccess aptget update + +# this all should fail +testfailure aptget install -y foo +testfailure aptget source foo + +# allow overriding the warning +testsuccess aptget source --allow-unauthenticated foo -- cgit v1.2.3 From 243b2a381f4a12939d91084ecf100ee6d3dcb007 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Jun 2014 12:39:36 +0200 Subject: Add compat mode for old (32bit FileSize) CacheDB (LP: #1274466) --- test/integration/cachedb-lp1274466-old-format.db | Bin 0 -> 8192 bytes test/integration/deb-lp1274466-cachedb.deb | Bin 0 -> 1270 bytes .../test-apt-ftparchive-cachedb-lp1274466 | 51 +++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 test/integration/cachedb-lp1274466-old-format.db create mode 100644 test/integration/deb-lp1274466-cachedb.deb create mode 100755 test/integration/test-apt-ftparchive-cachedb-lp1274466 (limited to 'test') diff --git a/test/integration/cachedb-lp1274466-old-format.db b/test/integration/cachedb-lp1274466-old-format.db new file mode 100644 index 000000000..88da5f1ee Binary files /dev/null and b/test/integration/cachedb-lp1274466-old-format.db differ diff --git a/test/integration/deb-lp1274466-cachedb.deb b/test/integration/deb-lp1274466-cachedb.deb new file mode 100644 index 000000000..43d7ee6f1 Binary files /dev/null and b/test/integration/deb-lp1274466-cachedb.deb differ diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466 new file mode 100755 index 000000000..211740a53 --- /dev/null +++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466 @@ -0,0 +1,51 @@ +#!/bin/sh +set -e + + +# +# main() +# +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +# gather the db and the deb, ensure mtime is not modfied as its saved in the DB +cp -p $TESTDIR/deb-lp1274466-cachedb.deb foo_1_i386.deb +cp $TESTDIR/cachedb-lp1274466-old-format.db old-format.db + +# verify that the format is different +testsuccess aptftparchive --db new-format.db packages . +db_dump new-format.db > new-format.dump +db_dump old-format.db > old-format.dump +testfailure diff -u old-format.dump new-format.dump + +# ensure the new format as the sha512 +testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c new-format.dump +# but the old format does not +testfailure grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump + +# regression test for corruption with previous generation of cachedb +testequal "Package: foo +Priority: optional +Section: others +Installed-Size: 29 +Maintainer: Joe Sixpack +Architecture: i386 +Version: 1 +Filename: ./foo_1_i386.deb +Size: 1270 +MD5sum: 85d0e908c1a897700e2c5dea72d7e3c0 +SHA1: 858b09169032b7925a0e463f46b6634243fc40ce +SHA256: 3750a2c9c6b5beee7f307564be3d51d3ec7cbb78fa4f0b47f84a7c41477bff59 +SHA512: 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c +Description: an autogenerated dummy foo=1/test + If you find such a package installed on your system, + something went horribly wrong! They are autogenerated + und used only by testcases and surf no other propose… +" aptftparchive --db old-format.db packages . + +# ensure that the db is updated +db_dump old-format.db > old-format.dump +testsuccess diff -u old-format.dump new-format.dump + -- cgit v1.2.3 From e41d3d7e25754f858b6dfe4dd841f4749f7f3ab1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 7 Jun 2014 22:46:37 +0200 Subject: do not revert candidate for protected packages In commit 21b3eac8 I promoted the check for installable dependencies to a pre-install check, which also reverts to a known good candidate (the installed version) if it fails. This revert was done even for user requested candidate switches which disabled our Broken detection so that install requests which are impossible to satisfy do not fail anymore, but print an (incomplete) solution proposal and then exit successfully. Closes: 745046 --- .../test-bug-745046-candidate-propagation-fails | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 test/integration/test-bug-745046-candidate-propagation-fails (limited to 'test') diff --git a/test/integration/test-bug-745046-candidate-propagation-fails b/test/integration/test-bug-745046-candidate-propagation-fails new file mode 100755 index 000000000..e4aa67a72 --- /dev/null +++ b/test/integration/test-bug-745046-candidate-propagation-fails @@ -0,0 +1,39 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'gedit' 'amd64' '1' + +insertpackage 'unstable' 'gedit' 'amd64' '1' +insertpackage 'experimental' 'gedit' 'amd64' '2' 'Depends: common (>= 2)' + +setupaptarchive + +testequal "Reading package lists... +Building dependency tree... +Selected version '2' (experimental [amd64]) for 'gedit' +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + gedit : Depends: common (>= 2) but it is not installable +E: Unable to correct problems, you have held broken packages." aptget install gedit/experimental -sq=0 + +insertinstalledpackage 'common' 'amd64' '2' + +testequal "Reading package lists... +Building dependency tree... +Selected version '2' (experimental [amd64]) for 'gedit' +The following packages will be upgraded: + gedit +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst gedit [1] (2 experimental [amd64]) +Conf gedit (2 experimental [amd64])" aptget install gedit/experimental -sq=0 -- cgit v1.2.3 From 4dde2b4285fc6288e44e915a0d7bc0faac114a2e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Jun 2014 14:12:12 +0200 Subject: support Acquire::GzipIndexes in dumpavail Closes: 742835 --- test/integration/test-compressed-indexes | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 67ca0ba27..6671dd75a 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -67,6 +67,8 @@ testrun() { msgtest "\tdsc file is present"; testsuccess --nomsg test -f testpkg_1.0.dsc msgtest "\tdirectory is present"; testsuccess --nomsg test -d testpkg-1.0 rm -rf testpkg-1.0 + testequal "$(aptcache show testpkg -o Acquire::Languages=none) +" aptcache dumpavail } echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex -- cgit v1.2.3 From ea606ec43a364a8e471fd9502d79fe2dfeb6e4ba Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jun 2014 15:21:30 +0200 Subject: fix test/integration/test-apt-ftparchive-cachedb-lp1274466 in travis --- test/integration/test-apt-ftparchive-cachedb-lp1274466 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466 index 211740a53..2a28d6ef0 100755 --- a/test/integration/test-apt-ftparchive-cachedb-lp1274466 +++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466 @@ -12,7 +12,7 @@ configarchitecture "i386" # gather the db and the deb, ensure mtime is not modfied as its saved in the DB cp -p $TESTDIR/deb-lp1274466-cachedb.deb foo_1_i386.deb -cp $TESTDIR/cachedb-lp1274466-old-format.db old-format.db +cp -p $TESTDIR/cachedb-lp1274466-old-format.db old-format.db # verify that the format is different testsuccess aptftparchive --db new-format.db packages . @@ -45,7 +45,7 @@ Description: an autogenerated dummy foo=1/test und used only by testcases and surf no other propose… " aptftparchive --db old-format.db packages . -# ensure that the db is updated -db_dump old-format.db > old-format.dump -testsuccess diff -u old-format.dump new-format.dump +# ensure that the db is updated and contains the new sha512 +testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump + -- cgit v1.2.3 From 686b484b407fdbef47d9f2064284a567b72417fe Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 11 Jun 2014 14:50:48 +0200 Subject: fix autopkgtest tests --- test/integration/framework | 2 ++ test/integration/test-external-dependency-solver-protocol | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 7959699fd..6c9e8bd57 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -120,6 +120,7 @@ apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } aptitude() { runapt aptitude "$@"; } aptextracttemplates() { runapt apt-extracttemplates "$@"; } +aptinternalsolver() { runapt "${APTINTERNALSOLVERBINDIR}/apt-internal-solver" "$@"; } dpkg() { command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" @@ -181,6 +182,7 @@ setupenvironment() { METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"} APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"} APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"} + APTINTERNALSOLVERBINDIR=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER_DIR:-"${BUILDDIRECTORY}"} test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" # ----- diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol index 129565993..09230d383 100755 --- a/test/integration/test-external-dependency-solver-protocol +++ b/test/integration/test-external-dependency-solver-protocol @@ -53,7 +53,7 @@ testsuccess test -s /tmp/dump.edsp configarchitecture 'armel' msgtest 'Test direct calling is okay for' 'apt-internal-solver' -cat /tmp/dump.edsp | runapt apt-internal-solver > solver.result 2>&1 || true +cat /tmp/dump.edsp | aptinternalsolver > solver.result 2>&1 || true if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then msgpass else -- cgit v1.2.3 From 3082603f0ef76876810cb8c6d02d03ba67ec8c6b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 11 Jun 2014 18:17:45 +0200 Subject: fix test-apt-ftparchive-cachedb-lp1274466 and apt-internal-solver tests --- test/integration/framework | 4 ++-- test/integration/test-apt-ftparchive-cachedb-lp1274466 | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 6c9e8bd57..a687dcb35 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -120,7 +120,7 @@ apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } aptitude() { runapt aptitude "$@"; } aptextracttemplates() { runapt apt-extracttemplates "$@"; } -aptinternalsolver() { runapt "${APTINTERNALSOLVERBINDIR}/apt-internal-solver" "$@"; } +aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } dpkg() { command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" @@ -182,7 +182,7 @@ setupenvironment() { METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"} APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"} APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"} - APTINTERNALSOLVERBINDIR=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER_DIR:-"${BUILDDIRECTORY}"} + APTINTERNALSOLVER=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"} test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" # ----- diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466 index 2a28d6ef0..579ae33a6 100755 --- a/test/integration/test-apt-ftparchive-cachedb-lp1274466 +++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466 @@ -46,6 +46,8 @@ Description: an autogenerated dummy foo=1/test " aptftparchive --db old-format.db packages . # ensure that the db is updated and contains the new sha512 +db_dump old-format.db > old-format.dump + testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump -- cgit v1.2.3 From eb197ed71b1535f3c1715c8a751485ef927b51b7 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 12 Jun 2014 10:09:24 +0200 Subject: test/integration/test-essential-force-loopbreak: fix on non-amd64 systems --- test/integration/test-essential-force-loopbreak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak index d60c6cbd5..ac8fc6d28 100755 --- a/test/integration/test-essential-force-loopbreak +++ b/test/integration/test-essential-force-loopbreak @@ -35,7 +35,7 @@ The following packages will be upgraded: sysvinit 1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. E: This installation run will require temporarily removing the essential package sysvinit:$(getarchitecture 'native') due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. -E: Internal Error, Could not early remove sysvinit:amd64 (2)" aptget install systemd-sysv -t "$1" -s +E: Internal Error, Could not early remove sysvinit:$(dpkg --print-architecture) (2)" aptget install systemd-sysv -t "$1" -s # ensure that really nothing happens testfailure aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 testdpkginstalled 'sysvinit' -- cgit v1.2.3 From 224dc038412459a5f64d4e7a16845847b7797a67 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 Jun 2014 16:55:19 +0200 Subject: fix SubstVar to be usable as a replace_all method The name suggests that it is supposed to substitute a variable with a value, but we tend to use it in a more liberal replace_all() fashion, but this breaks if either of the parameters is empty or more importantly if two "variable" occurrences follow each other directly. --- test/libapt/strutil_test.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'test') diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index bc004fd66..e9b778c6b 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -70,3 +70,38 @@ TEST(StrUtilTest,EndsWith) EXPECT_FALSE(Endswith("abcd", "x")); EXPECT_FALSE(Endswith("abcd", "abcndefg")); } +TEST(StrUtilTest,SubstVar) +{ + EXPECT_EQ("", SubstVar("", "fails", "passes")); + EXPECT_EQ("test ", SubstVar("test fails", "fails", "")); + EXPECT_EQ("test passes", SubstVar("test passes", "", "fails")); + + EXPECT_EQ("test passes", SubstVar("test passes", "fails", "passes")); + EXPECT_EQ("test passes", SubstVar("test fails", "fails", "passes")); + + EXPECT_EQ("starts with", SubstVar("beginnt with", "beginnt", "starts")); + EXPECT_EQ("beginnt with", SubstVar("starts with", "starts", "beginnt")); + EXPECT_EQ("is in middle", SubstVar("is in der middle", "in der", "in")); + EXPECT_EQ("is in der middle", SubstVar("is in middle", "in", "in der")); + EXPECT_EQ("does end", SubstVar("does enden", "enden", "end")); + EXPECT_EQ("does enden", SubstVar("does end", "end", "enden")); + + EXPECT_EQ("abc", SubstVar("abc", "d", "a")); + EXPECT_EQ("abc", SubstVar("abd", "d", "c")); + EXPECT_EQ("abc", SubstVar("adc", "d", "b")); + EXPECT_EQ("abc", SubstVar("dbc", "d", "a")); + + EXPECT_EQ("b", SubstVar("b", "aa", "a")); + EXPECT_EQ("bb", SubstVar("bb", "aa", "a")); + EXPECT_EQ("bbb", SubstVar("bbb", "aa", "a")); + + EXPECT_EQ("aa", SubstVar("aaaa", "aa", "a")); + EXPECT_EQ("aaaa", SubstVar("aa", "a", "aa")); + EXPECT_EQ("aaaa", SubstVar("aaaa", "a", "a")); + EXPECT_EQ("a a a a ", SubstVar("aaaa", "a", "a ")); + + EXPECT_EQ(" bb bb bb bb ", SubstVar(" a a a a ", "a", "bb")); + EXPECT_EQ(" bb bb bb bb ", SubstVar(" aaa aaa aaa aaa ", "aaa", "bb")); + EXPECT_EQ(" bb a bb a bb a bb ", SubstVar(" aaa a aaa a aaa a aaa ", "aaa", "bb")); + +} -- cgit v1.2.3 From 172947cd7dc5c88c94c6ad269dc6c6be002ee958 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 Jun 2014 19:05:53 +0200 Subject: do not call resolver twice on (dist-)upgrade --- test/integration/test-external-dependency-solver-protocol | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol index 09230d383..07d2441b6 100755 --- a/test/integration/test-external-dependency-solver-protocol +++ b/test/integration/test-external-dependency-solver-protocol @@ -51,6 +51,12 @@ rm -f /tmp/dump.edsp testfailure aptget install --solver dump awesomecoolstuff:i386 -s testsuccess test -s /tmp/dump.edsp +testsuccess aptget dist-upgrade -s +testsuccess aptget dist-upgrade -s --solver apt + +testsuccess aptget upgrade -s +testsuccess aptget upgrade -s --solver apt + configarchitecture 'armel' msgtest 'Test direct calling is okay for' 'apt-internal-solver' cat /tmp/dump.edsp | aptinternalsolver > solver.result 2>&1 || true -- cgit v1.2.3 From 4f445ff78220568e0fcfa373ba1b06e0ad13e63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michele=20Orr=C3=B9?= Date: Mon, 7 Jul 2014 20:43:45 +0200 Subject: use exit instead of incorrect return in test wrapper bash as sh doesn't like it, too. Git-Dch: Ignore --- test/integration/test-dpkg-assert-multi-arch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-dpkg-assert-multi-arch b/test/integration/test-dpkg-assert-multi-arch index 177d7489b..e6be6ac7d 100755 --- a/test/integration/test-dpkg-assert-multi-arch +++ b/test/integration/test-dpkg-assert-multi-arch @@ -32,7 +32,7 @@ echo '#! /bin/sh if echo "$*" | grep -q -- "--assert-multi-arch"; then echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch' echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch' - return 2; + exit 2; fi return $*' > ./dpkg-wrapper chmod +x ./dpkg-wrapper @@ -68,9 +68,10 @@ touch rootdir/var/lib/dpkg/status echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper echo '#! /bin/sh if echo "$*" | grep -q -- "--assert-multi-arch"; then - return 0; -fi -return $*' > ./dpkg-wrapper + exit 0 +else + exit 1 +fi' > ./dpkg-wrapper testqualifier 'native-pkg' 'native-pkg:amd64' testqualifier 'native-pkg:amd64' 'native-pkg:amd64' -- cgit v1.2.3 From eb191ca3584816533e82cd6b8cd1f133ae28149a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Jul 2014 20:45:28 +0200 Subject: properly handle (currently unused) dpkg pass-through Git-Dch: ignore --- test/integration/test-dpkg-assert-multi-arch | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/integration/test-dpkg-assert-multi-arch b/test/integration/test-dpkg-assert-multi-arch index e6be6ac7d..b3fbbf0eb 100755 --- a/test/integration/test-dpkg-assert-multi-arch +++ b/test/integration/test-dpkg-assert-multi-arch @@ -26,15 +26,17 @@ testqualifier() { fi } -# non-multiarch or "ubuntus" old multiarchified dpkg +msgmsg 'non-multiarch or "ubuntus" old multiarchified dpkg' echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper -echo '#! /bin/sh -if echo "$*" | grep -q -- "--assert-multi-arch"; then +cat > ./dpkg-wrapper <&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch' echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch' - exit 2; + exit 2 fi -return $*' > ./dpkg-wrapper +exec "\$@" +EOF chmod +x ./dpkg-wrapper testqualifier 'native-pkg' 'native-pkg' @@ -61,17 +63,18 @@ testqualifier 'all-foreign-pkg-' 'all-foreign-pkg' testqualifier 'always-all-pkg-' 'always-all-pkg' testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg' -# multiarch dpkg (new interface version) - +msgmsg 'multiarch dpkg (new interface version)' rm rootdir/var/lib/dpkg/status touch rootdir/var/lib/dpkg/status echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper -echo '#! /bin/sh -if echo "$*" | grep -q -- "--assert-multi-arch"; then - exit 0 -else - exit 1 -fi' > ./dpkg-wrapper +cat > ./dpkg-wrapper < Date: Mon, 7 Jul 2014 20:48:16 +0200 Subject: use printf instead of echo in testing framework MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The behaviour of echo "\tA\t" differs between dash/zsh which interprets the \t as tab and bash which prints it literally. Similar things happen for other escape sequences – without the -e flag. Switching to printf makes this more painless^Wportable, so that the tests are also working correctly with bash as sh. (commit message by committer, patch otherwise unmodified) --- test/integration/framework | 58 +++++++++++++++++++++++----------------------- test/integration/run-tests | 4 ++-- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index a687dcb35..3bbf440c8 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -23,30 +23,30 @@ if [ "$MSGCOLOR" != 'NO' ]; then CCMD="\033[1;35m" # pink fi -msgdie() { echo "${CERROR}E: $1${CNORMAL}" >&2; exit 1; } -msgwarn() { echo "${CWARNING}W: $1${CNORMAL}" >&2; } -msgmsg() { echo "${CMSG}$1${CNORMAL}"; } -msginfo() { echo "${CINFO}I: $1${CNORMAL}"; } -msgdebug() { echo "${CDEBUG}D: $1${CNORMAL}"; } -msgdone() { echo "${CDONE}DONE${CNORMAL}"; } -msgnwarn() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; } -msgnmsg() { echo -n "${CMSG}$1${CNORMAL}"; } -msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}"; } -msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}"; } +msgdie() { printf "${CERROR}E: $1${CNORMAL}\n" >&2; exit 1; } +msgwarn() { printf "${CWARNING}W: $1${CNORMAL}\n" >&2; } +msgmsg() { printf "${CMSG}$1${CNORMAL}\n"; } +msginfo() { printf "${CINFO}I: $1${CNORMAL}\n"; } +msgdebug() { printf "${CDEBUG}D: $1${CNORMAL}\n"; } +msgdone() { printf "${CDONE}DONE${CNORMAL}\n"; } +msgnwarn() { printf "${CWARNING}W: $1${CNORMAL}" >&2; } +msgnmsg() { printf "${CMSG}$1${CNORMAL}"; } +msgninfo() { printf "${CINFO}I: $1${CNORMAL}"; } +msgndebug() { printf "${CDEBUG}D: $1${CNORMAL}"; } msgtest() { while [ -n "$1" ]; do - echo -n "${CINFO}$1${CCMD} " - echo -n "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} " + printf "${CINFO}$1${CCMD} " + printf -- "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} " shift if [ -n "$1" ]; then shift; else break; fi done - echo -n "…${CNORMAL} " + printf "…${CNORMAL} " } -msgpass() { echo "${CPASS}PASS${CNORMAL}"; } -msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; } +msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } +msgskip() { printf "${CWARNING}SKIP${CNORMAL}\n" >&2; } msgfail() { - if [ $# -gt 0 ]; then echo "${CFAIL}FAIL: $*${CNORMAL}" >&2; - else echo "${CFAIL}FAIL${CNORMAL}" >&2; fi + if [ $# -gt 0 ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; + else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi EXIT_CODE=$((EXIT_CODE+1)); } @@ -63,12 +63,12 @@ if [ $MSGLEVEL -le 2 ]; then msgmsg() { true; } msgnmsg() { true; } msgtest() { true; } - msgpass() { echo -n " ${CPASS}P${CNORMAL}"; } - msgskip() { echo -n " ${CWARNING}S${CNORMAL}" >&2; } + msgpass() { printf " ${CPASS}P${CNORMAL}"; } + msgskip() { printf " ${CWARNING}S${CNORMAL}" >&2; } if [ -n "$CFAIL" ]; then - msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); } + msgfail() { printf " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); } else - msgfail() { echo -n " ###FAILED###" >&2; EXIT_CODE=$((EXIT_CODE+1)); } + msgfail() { printf " ###FAILED###" >&2; EXIT_CODE=$((EXIT_CODE+1)); } fi fi if [ $MSGLEVEL -le 3 ]; then @@ -87,7 +87,7 @@ msgdone() { [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then true; else - echo "${CDONE}DONE${CNORMAL}"; + printf "${CDONE}DONE${CNORMAL}\n"; fi } getaptconfig() { @@ -155,7 +155,7 @@ exitwithstatus() { shellsetedetector() { local exit_status=$? if [ "$exit_status" != '0' ]; then - echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}" + printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" if [ "$EXIT_CODE" = '0' ]; then EXIT_CODE="$exit_status" fi @@ -328,12 +328,12 @@ configdpkg() { configcompression() { while [ -n "$1" ]; do case "$1" in - '.') echo ".\t.\tcat";; - 'gz') echo "gzip\tgz\tgzip";; - 'bz2') echo "bzip2\tbz2\tbzip2";; - 'lzma') echo "lzma\tlzma\txz --format=lzma";; - 'xz') echo "xz\txz\txz";; - *) echo "$1\t$1\t$1";; + '.') printf ".\t.\tcat\n";; + 'gz') printf "gzip\tgz\tgzip\n";; + 'bz2') printf "bzip2\tbz2\tbzip2\n";; + 'lzma') printf "lzma\tlzma\txz --format=lzma\n";; + 'xz') printf "xz\txz\txz\n";; + *) printf "$1\t$1\t$1\n";; esac shift done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf diff --git a/test/integration/run-tests b/test/integration/run-tests index d39daeee5..9dd550aa2 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -39,9 +39,9 @@ fi TOTAL="$(run-parts --list $DIR | grep '/test-' | wc -l)" for testcase in $(run-parts --list $DIR | grep '/test-'); do if [ "$MSGLEVEL" -le 2 ]; then - echo -n "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " + printf "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " else - echo "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}" + printf "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}\n" fi if ! ${testcase}; then FAIL=$((FAIL+1)) -- cgit v1.2.3 From a034d8528bc98e9caf12e024a0d5eeb25f87a500 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 2 Jul 2014 04:10:37 +0200 Subject: build: Convert from DebianDoc SGML to DocBook XML --- test/Makefile | 2 +- test/libapt/parsedepends_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index 74bffccb7..35a0a51e3 100644 --- a/test/Makefile +++ b/test/Makefile @@ -7,7 +7,7 @@ ifndef NOISY endif .PHONY: startup headers library clean veryclean all binary program doc test update-po -startup all clean veryclean binary program dirs test update-po manpages debiandoc: +startup all clean veryclean binary program dirs test update-po manpages docbook: $(MAKE) -C libapt $@ $(MAKE) -C interactive-helper $@ diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc index 1e0afb66c..52eac8232 100644 --- a/test/libapt/parsedepends_test.cc +++ b/test/libapt/parsedepends_test.cc @@ -23,7 +23,7 @@ static void parseDependency(bool const StripMultiArch, bool const ParseArchFlag "libdb-dev:any, " "gettext:native (<= 0.12), " "libcurl4-gnutls-dev:native | libcurl3-gnutls-dev (>> 7.15.5), " - "debiandoc-sgml, " + "docbook-xml, " "apt (>= 0.7.25), " "not-for-me [ !amd64 ], " "only-for-me [ amd64 ], " @@ -82,7 +82,7 @@ static void parseDependency(bool const StripMultiArch, bool const ParseArchFlag EXPECT_EQ(Null | pkgCache::Dep::Greater, Op); Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); - EXPECT_EQ("debiandoc-sgml", Package); + EXPECT_EQ("docbook-xml", Package); EXPECT_EQ("", Version); EXPECT_EQ(Null | pkgCache::Dep::NoOp, Op); -- cgit v1.2.3 From a5bb5e1e747ceb7b5a9defb6b1a8d9282a6e0957 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 8 Jul 2014 15:11:14 +0200 Subject: Only allow "apt-get build-dep path" when path starts with ./ or / This avoid the subtle problem that someone might have a directory with the same package name as the build-depends he/she is trying to fetch. Also print a note that the specific file/dir is used. --- test/integration/test-apt-get-build-dep | 3 +++ test/libapt/strutil_test.cc | 9 +++++++++ 2 files changed, 12 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-get-build-dep b/test/integration/test-apt-get-build-dep index f71beae9c..87ec6e54d 100755 --- a/test/integration/test-apt-get-build-dep +++ b/test/integration/test-apt-get-build-dep @@ -34,6 +34,7 @@ EOF testequal "Reading package lists... Building dependency tree... +Note, using file '2vcard_0.5-3.dsc' to get the build dependencies The following NEW packages will be installed: build-essential debhelper 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. @@ -76,6 +77,7 @@ EOF testequal "Reading package lists... Building dependency tree... +Note, using file '2vcard_0.5-3.dsc' to get the build dependencies The following NEW packages will be installed: build-essential debhelper 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. @@ -117,6 +119,7 @@ EOF testequal "Reading package lists... Building dependency tree... +Note, using directory './foo-1.0' to get the build dependencies The following NEW packages will be installed: build-essential debhelper 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index e9b778c6b..1c2f0abac 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -70,6 +70,15 @@ TEST(StrUtilTest,EndsWith) EXPECT_FALSE(Endswith("abcd", "x")); EXPECT_FALSE(Endswith("abcd", "abcndefg")); } +TEST(StrUtilTest,StartWith) +{ + using APT::String::Startswith; + EXPECT_TRUE(Startswith("abcd", "a")); + EXPECT_TRUE(Startswith("abcd", "ab")); + EXPECT_TRUE(Startswith("abcd", "abcd")); + EXPECT_FALSE(Startswith("abcd", "x")); + EXPECT_FALSE(Startswith("abcd", "abcndefg")); +} TEST(StrUtilTest,SubstVar) { EXPECT_EQ("", SubstVar("", "fails", "passes")); -- cgit v1.2.3 From 08be0ca32ad69e9ebf28fe26aa85990700c81cf6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 16 Jul 2014 13:57:50 +0200 Subject: StringToBool: only act if the entire string is consumed by strtol() StringToBool uses strtol() internally to check if the argument is a number. This function stops when it does not find any more numbers. So a string like "0ad" (which is a valid packagename) is interpreted as a "0". The code now checks that the entire string is consumed not just a part of it. Thanks to Johannes Schauer for raising this issue. --- test/libapt/commandline_test.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc index 26e80bfde..e403a28c8 100644 --- a/test/libapt/commandline_test.cc +++ b/test/libapt/commandline_test.cc @@ -56,3 +56,32 @@ TEST(CommandLineTest,Parsing) EXPECT_TRUE(c.FindB("Test::Worked", false)); EXPECT_FALSE(c.FindB("Test::Zero", false)); } + +TEST(CommandLineTest, BoolParsing) +{ + CommandLine::Args Args[] = { + { 't', 0, "Test::Worked", 0 }, + {0,0,0,0} + }; + ::Configuration c; + CommandLine CmdL(Args, &c); + + // the commandline parser used to use strtol() on the argument + // to check if the argument is a boolean expression - that + // stopped after the "0". this test ensures that we always check + // that the entire string was consumed by strtol + { + char const * argv[] = { "show", "-t", "0ad" }; + bool res = CmdL.Parse(sizeof(argv)/sizeof(char*), argv); + EXPECT_TRUE(res); + ASSERT_EQ(std::string(CmdL.FileList[0]), "0ad"); + } + + { + char const * argv[] = { "show", "-t", "0", "ad" }; + bool res = CmdL.Parse(sizeof(argv)/sizeof(char*), argv); + EXPECT_TRUE(res); + ASSERT_EQ(std::string(CmdL.FileList[0]), "ad"); + } + +} -- cgit v1.2.3 From 9c3e15ab5f8b5864c43a08065a6bc8cf376fd138 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 16 Jul 2014 15:48:05 +0200 Subject: Do not crash for apt-get install /dev/null Thanks to Jakub Wilk for the bugreport. Closes: #754904 --- test/integration/test-apt-get-install-deb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 test/integration/test-apt-get-install-deb (limited to 'test') diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb new file mode 100755 index 000000000..700009da5 --- /dev/null +++ b/test/integration/test-apt-get-install-deb @@ -0,0 +1,30 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# regression test for #754904 +testequal 'E: Unable to locate package /dev/null' aptget install -qq /dev/null + +# and ensure we fail for invalid debs +cat > foo.deb < Date: Fri, 18 Jul 2014 23:41:29 +0200 Subject: add pkgAcquire::TransactionHasError() --- test/integration/test-apt-update-transactions | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 test/integration/test-apt-update-transactions (limited to 'test') diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions new file mode 100755 index 000000000..ee8d20dbf --- /dev/null +++ b/test/integration/test-apt-update-transactions @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '1.0' + +setupaptarchive --no-update +changetowebserver + +# break package file +cat > aptarchive/dists/unstable/main/binary-i386/Packages < Date: Mon, 21 Jul 2014 11:19:37 +0200 Subject: Download Release first, then Release.gpg The old way of handling this was that pkgAcqMetaIndex was responsible to check/move both Release and Release.gpg in place. This breaks the assumption of the transaction that each pkgAcquire::Item has a single File that its responsible for. --- test/integration/test-apt-update-transactions | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index ee8d20dbf..247334991 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -21,3 +21,4 @@ compressfile aptarchive/dists/unstable/main/binary-i386/Packages '+1hour' # ensure that a update will only succeed entirely or not at all testfailure aptget update testequal "partial" ls rootdir/var/lib/apt/lists + -- cgit v1.2.3 From 2f58969150b0daec1de407f61385ccf5b2065aa3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 29 Jul 2014 15:01:13 +0200 Subject: Fix SmartConfigure to ignore ordering of packages that are already valid With the change of SmartConfigure() in git commit 42d51f the ordering code was trying to re-order dependencies, even when at this point in time this was not needed. Now it will first check all targets of the given dependency and only if there is not a good one try to reorder and unpack/configure as needed. Closes: LP: #1347721 --- .../Packages-bug-lp1347721-dpkg-ordering | 445 +++++ .../integration/status-bug-lp1347721-dpkg-ordering | 1942 ++++++++++++++++++++ test/integration/test-bug-lp1347721-dpkg-ordering | 11 + 3 files changed, 2398 insertions(+) create mode 100644 test/integration/Packages-bug-lp1347721-dpkg-ordering create mode 100644 test/integration/status-bug-lp1347721-dpkg-ordering create mode 100755 test/integration/test-bug-lp1347721-dpkg-ordering (limited to 'test') diff --git a/test/integration/Packages-bug-lp1347721-dpkg-ordering b/test/integration/Packages-bug-lp1347721-dpkg-ordering new file mode 100644 index 000000000..ea96b387c --- /dev/null +++ b/test/integration/Packages-bug-lp1347721-dpkg-ordering @@ -0,0 +1,445 @@ +Package: init +xEssential: yes +Priority: required +Section: metapackages +Installed-Size: 29 +Maintainer: Ubuntu Developers +Original-Maintainer: pkg-systemd-maintainers +Architecture: i386 +Source: init-system-helpers +Version: 1.20 +Pre-Depends: sysvinit-core | systemd-sysv | upstart +Filename: pool/main/i/init-system-helpers/init_1.20_i386.deb +Size: 3494 +MD5sum: a388b6f4f6ed0d01b3d459cfad6582fe +SHA1: d0eb6414a6bb48bb886fcc19962f6a7f302977f3 +SHA256: 9f299b2bf18d6e4534f3a73cca97ef93850e1b5fa38f8519da7c2b825d581f4c +Description: System-V-like init utilities - metapackage +Description-md5: e52554c23609041bfbca72fe27a132f9 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu + +Package: libudev1 +Priority: required +Section: libs +Installed-Size: 132 +Maintainer: Ubuntu Developers +Original-Maintainer: Debian systemd Maintainers +Architecture: i386 +Source: systemd +Version: 208-6ubuntu2 +Depends: libc6 (>= 2.17), libselinux1 (>= 1.32) +Pre-Depends: multiarch-support +Filename: pool/main/s/systemd/libudev1_208-6ubuntu2_i386.deb +Size: 36008 +MD5sum: b03338c052438a95919b9db4d6f9493e +SHA1: a85242bfc653255b5fa73d0fbec92815dc9c09fc +SHA256: d66d7948703b33bd617e16a1b9ac6f24ca564312890b1f9218330f638080a307 +Description: libudev shared library +Multi-Arch: same +Homepage: http://www.freedesktop.org/wiki/Software/systemd +Description-md5: ace5b83d7b48187416c90173a93255b6 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: udev +Priority: required +Section: admin +Installed-Size: 5879 +Maintainer: Ubuntu Developers +Original-Maintainer: Debian systemd Maintainers +Architecture: i386 +Source: systemd +Version: 208-6ubuntu2 +Depends: libacl1 (>= 2.2.51-8), libblkid1 (>= 2.19.1), libc6 (>= 2.17), libkmod2 (>= 5~), libselinux1 (>= 2.0.65), libudev1 (= 208-6ubuntu2), lsb-base (>= 4.1+Debian11ubuntu7), util-linux (>= 2.16), procps +Pre-Depends: debconf (>= 1.4.69) | debconf-2.0 +Breaks: consolekit (<< 0.4.6-1) +Filename: pool/main/s/systemd/udev_208-6ubuntu2_i386.deb +Size: 799582 +MD5sum: 814bb3babdbe76994ce536384ca31f88 +SHA1: bbb662c89f2b1ff4fd450d1523cc21b5b1c339bc +SHA256: e444350214c5c121b2ca8031f76c53809f95ebb5c4cec4cf4595c7520ac09529 +Description: /dev/ and hotplug management daemon +Multi-Arch: foreign +Homepage: http://www.freedesktop.org/wiki/Software/systemd +Description-md5: e875ddb09f46f1f7672af537f0c875ca +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: initscripts +Priority: required +Section: admin +Installed-Size: 246 +Maintainer: Ubuntu Core Developers +Original-Maintainer: Debian sysvinit maintainers +Architecture: i386 +Source: sysvinit +Version: 2.88dsf-41ubuntu16 +Replaces: libc0.1, libc0.3, libc6, libc6.1 +Depends: libc6 (>= 2.4), mount (>= 2.11x-1), debianutils (>= 4), lsb-base (>= 4.1+Debian11ubuntu7), sysvinit-utils (>= 2.86.ds1-64), sysv-rc | file-rc, coreutils (>= 5.93), passwd, init, mountall (>= 2.28) +Recommends: psmisc, e2fsprogs +Conflicts: libdevmapper1.02.1 (<< 2:1.02.24-1) +Breaks: aide (<< 0.15.1-5), atm-tools (<< 1:2.5.1-1.3), bootchart (<< 0.10~svn407-3.3), console-common (<< 0.7.86), cruft (<< 0.9.16), eepc-acpi-scripts (<< 1.1.12), fcheck (<< 2.7.59-16), hostapd (<< 1:0.7.3-3), hostname (<< 2.95ubuntu1~boot2), ifupdown (<< 0.6.8ubuntu27), libpam-mount (<< 2.13-1), ltsp-client-core (<< 5.2.16-1), mdadm (<< 3.2.2-1), nbd-client (<< 1:2.9.23-1), nfs-common (<< 1:1.2.5-3), portmap (<< 6.0.0-2), readahead-fedora (<< 2:1.5.6-3), resolvconf (<< 1.49), rpcbind (<< 0.2.0-7), rsyslog (<< 5.8.2-2), selinux-policy-default (<= 2:0.2.20100524-9), splashy (<< 0.3.13-5.1+b1), sysklogd (<< 1.5-6.2), udev (<< 146-2~boot6), upstart (<< 0.6.3-2~boot4), wpasupplicant (<< 0.7.3-4), xymon (<< 4.3.0~beta2.dfsg-9) +Filename: pool/main/s/sysvinit/initscripts_2.88dsf-41ubuntu16_i386.deb +Size: 35150 +MD5sum: e78f1e7816f03ded97eacd469505ea45 +SHA1: 81f88f9258c680e9983316d75baff7572ecec75c +SHA256: 996e4d86486cbe12a7b7852ec1a9fe459dbf0afab51dc13bd701b6d970fdc14a +Description: scripts for initializing and shutting down the system +Multi-Arch: foreign +Homepage: http://savannah.nongnu.org/projects/sysvinit +Description-md5: db9003c179cd2a623493209da58ea2ea +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: libc6 +Priority: required +Section: libs +Installed-Size: 9284 +Maintainer: Ubuntu Developers +Original-Maintainer: GNU Libc Maintainers +Architecture: i386 +Source: glibc +Version: 2.19-4ubuntu1 +Replaces: libc6-i386, libc6-xen +Provides: glibc-2.19-1, libc6-i686, libc6-xen +Depends: libgcc1 +Suggests: glibc-doc, debconf | debconf-2.0, locales +Conflicts: libc6-xen, prelink (<= 0.0.20090311-1), tzdata (<< 2007k-1), tzdata-etch +Breaks: hurd (<< 1:0.5.git20140203-1), libtirpc1 (<< 0.2.3), nscd (<< 2.19) +Filename: pool/main/g/glibc/libc6_2.19-4ubuntu1_i386.deb +Size: 4012440 +MD5sum: 946665711bb0294bd2c7729b3174ba8b +SHA1: 063e268e0d1e368e218d450a4bd2af7608b5e38e +SHA256: 0e33f5c3b6da3a6ec52fb0274abfa0da5489808feb220b6e6640432cb84f948f +Description: GNU C Library: Shared libraries +Multi-Arch: same +Homepage: http://www.gnu.org/software/libc/libc.html +Description-md5: fc3001b0b90a1c8e6690b283a619d57f +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: libmount1 +Priority: required +Section: libs +Installed-Size: 253 +Maintainer: Ubuntu Developers +Original-Maintainer: LaMont Jones +Architecture: i386 +Source: util-linux +Version: 2.20.1-5.1ubuntu21 +Depends: libblkid1 (>= 2.17.2), libc6 (>= 2.8), libselinux1 (>= 1.32) +Pre-Depends: multiarch-support +Filename: pool/main/u/util-linux/libmount1_2.20.1-5.1ubuntu21_i386.deb +Size: 60156 +MD5sum: d17af590ad06ac914a1024d54184cee6 +SHA1: 6eb2a281c409bd5181ce6b871795f8e4609565bc +SHA256: 78ce54b9f644c365b95a7230e1e50762d628c9d0d3549211017a98d4cb5013c4 +Description: block device id library +Multi-Arch: same +Homepage: http://userweb.kernel.org/~kzak/util-linux/ +Description-md5: 8f605597a2fb2fd7bffd09db537dd040 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: libplymouth4 +Priority: required +Section: libs +Installed-Size: 315 +Maintainer: Ubuntu Developers +Architecture: i386 +Source: plymouth +Version: 0.9.0-0ubuntu2 +Replaces: plymouth (<< 0.7.0+git20090207-0ubuntu0.1~ppa4) +Depends: libc6 (>= 2.9), libpng12-0 (>= 1.2.13-4), libudev1 (>= 183) +Pre-Depends: multiarch-support +Breaks: casper (= 1.227), mountall (<< 2.8) +Filename: pool/main/p/plymouth/libplymouth4_0.9.0-0ubuntu2_i386.deb +Size: 85024 +MD5sum: 8d9e7001ba371bd802956de1e81d1997 +SHA1: 749bdaee4d8bd4c2383c703eb244caa473180d35 +SHA256: 59bd4492b6e71eee5c13ba9c63da12ece49c43106829556722ca503867ce7251 +Description: graphical boot animation and logger - shared libraries +Multi-Arch: same +Description-md5: 29e2ed45f3e127c38b58dae52061cc33 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: libprocps3 +Priority: required +Section: libs +Installed-Size: 133 +Maintainer: Ubuntu Developers +Original-Maintainer: Craig Small +Architecture: i386 +Source: procps +Version: 1:3.3.9-1ubuntu5 +Replaces: procps (<< 1:3.3.2-1) +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Filename: pool/main/p/procps/libprocps3_3.3.9-1ubuntu5_i386.deb +Size: 30078 +MD5sum: 0df60f591dfe64ed23bb1f3a1546c0ce +SHA1: db672ec37e88574bf1a1d5484d80cfd4ff04f9f6 +SHA256: b5df28501805a6833dc78e049159a7c560af6f24f18f51459bd8890c31e0fdc6 +Description: library for accessing process information from /proc +Multi-Arch: same +Homepage: http://gitorious.org/procps +Description-md5: 195f4a1a493350f6f0732a65b3cda83f +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: libudev1 +Priority: required +Section: libs +Installed-Size: 131 +Maintainer: Ubuntu Developers +Original-Maintainer: Debian systemd Maintainers +Architecture: i386 +Source: systemd +Version: 204-14ubuntu2 +Depends: libc6 (>= 2.17), libcgmanager0, libdbus-1-3 (>= 1.0.2), libnih-dbus1 (>= 1.0.0), libnih1 (>= 1.0.0) +Pre-Depends: multiarch-support +Filename: pool/main/s/systemd/libudev1_204-14ubuntu2_i386.deb +Size: 35518 +MD5sum: a606f9e4aab028b9ab658b6e8a09d5fb +SHA1: ef28d377e6cc8f1e98dd9cd8c40edda90e2eed20 +SHA256: c02c85725f64b6c804235329166bf66e40da948d96123336ec55e13e1654720f +Description: libudev shared library +Multi-Arch: same +Homepage: http://www.freedesktop.org/wiki/Software/systemd +Description-md5: ace5b83d7b48187416c90173a93255b6 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: lsb-base +Priority: required +Section: misc +Installed-Size: 83 +Maintainer: Ubuntu Developers +Original-Maintainer: Debian LSB Team +Architecture: all +Source: lsb +Version: 4.1+Debian11ubuntu8 +Replaces: upstart (<< 1.12.1-0ubuntu8) +Breaks: upstart (<< 1.12.1-0ubuntu8) +Filename: pool/main/l/lsb/lsb-base_4.1+Debian11ubuntu8_all.deb +Size: 13094 +MD5sum: 9ec51f910e6d8e86bfb489b71b237e66 +SHA1: 8091ba9ffc03999a3db1e2e0ee7d32ac5139a942 +SHA256: be8d24447147aa997b79353eaf8732b3d0967118c011b47476c841667eb15f7e +Description: Linux Standard Base 4.1 init script functionality +Multi-Arch: foreign +Homepage: http://www.linuxfoundation.org/collaborate/workgroups/lsb +Description-md5: 4ebb3d88f9f483751e70c55779c52d01 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: mount +Essential: yes +Priority: required +Section: admin +Installed-Size: 410 +Maintainer: Ubuntu Developers +Original-Maintainer: LaMont Jones +Architecture: i386 +Source: util-linux +Version: 2.20.1-5.1ubuntu21 +Pre-Depends: libblkid1 (>= 2.20.1), libc6 (>= 2.8), libmount1 (>= 2.20.1), libselinux1 (>= 2.0.15) +Suggests: nfs-common (>= 1:1.1.0-13) +Filename: pool/main/u/util-linux/mount_2.20.1-5.1ubuntu21_i386.deb +Size: 112598 +MD5sum: bdff5dbfbf17e2be281d64e2e7a4912b +SHA1: 1ed4abb0d5de8a09c704ac2d33de123015e5318a +SHA256: d2f023c763f7b6e91f3cd14073bfc5af7e7bfe3922fc5ca681d8038c80323f9e +Description: Tools for mounting and manipulating filesystems +Multi-Arch: foreign +Homepage: http://userweb.kernel.org/~kzak/util-linux/ +Description-md5: 46eb8e09a600d5eb98b6b40428349102 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: mountall +Priority: required +Section: admin +Installed-Size: 248 +Maintainer: Ubuntu Developers +Original-Maintainer: Steve Langasek +Architecture: i386 +Version: 2.54build1 +Replaces: upstart (<< 0.6.3-2) +Depends: makedev, udev, plymouth, coreutils (>= 7.1), libc6 (>= 2.9), libdbus-1-3 (>= 1.2.16), libnih-dbus1 (>= 1.0.0), libnih1 (>= 1.0.0), libplymouth4 (>= 0.8.1-3), libudev1 (>= 183) +Pre-Depends: dpkg (>= 1.15.7.2) +Breaks: initscripts (<< 2.88dsf-24), policycoreutils (<< 2.0.69-2ubuntu4), usplash (<< 0.5.47) +Filename: pool/main/m/mountall/mountall_2.54build1_i386.deb +Size: 54166 +MD5sum: a208d9dc5aef018087d5e00cea7f6c92 +SHA1: 13686aa81ebef6c3009ff618708d76bc68ff94e8 +SHA256: dee359411cd7cfad19581f380af6275d46a6c5ecf55f512523b75adaa4734d03 +Description: filesystem mounting tool +Multi-Arch: foreign +Description-md5: b5b5a27fc0e8063ef1226a39fb8ecf70 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: procps +Priority: required +Section: admin +Installed-Size: 634 +Maintainer: Ubuntu Developers +Original-Maintainer: Craig Small +Architecture: i386 +Version: 1:3.3.9-1ubuntu5 +Provides: watch +Depends: libc6 (>= 2.15), libncurses5 (>= 5.5-5~), libncursesw5 (>= 5.6+20070908), libprocps3, libtinfo5, lsb-base (>= 4.1+Debian11ubuntu7), initscripts +Recommends: psmisc +Conflicts: pgrep (<< 3.3-5), w-bassman (<< 1.0-3) +Breaks: guymager (<= 0.5.9-1), open-vm-tools (<= 2011.12.20-562307-1), xmem (<= 1.20-27.1) +Filename: pool/main/p/procps/procps_3.3.9-1ubuntu5_i386.deb +Size: 203368 +MD5sum: 17be371891f077e04075c6eb0af06b3c +SHA1: a5c6171b5a6430aa9436e42f0e64226dd2e7a665 +SHA256: 41e03fd2d05161c402d9a5d2b5feecb30a42f8919eb43712ebdd4340433803c1 +Description: /proc file system utilities +Multi-Arch: foreign +Homepage: http://gitorious.org/procps +Description-md5: 943f3288c1aaa379fca73a3ff1a35278 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: sysv-rc +Priority: required +Section: admin +Installed-Size: 224 +Maintainer: Ubuntu Core Developers +Original-Maintainer: Debian sysvinit maintainers +Architecture: all +Source: sysvinit +Version: 2.88dsf-41ubuntu16 +Replaces: file-rc +Depends: debconf (>= 0.5) | debconf-2.0, sysvinit-utils (>= 2.86.ds1-62), insserv (>> 1.12.0-10) +Recommends: lsb-base (>= 3.2-14) +Suggests: sysv-rc-conf, bum +Conflicts: file-rc +Breaks: initscripts (<< 2.88dsf-41ubuntu14) +Filename: pool/main/s/sysvinit/sysv-rc_2.88dsf-41ubuntu16_all.deb +Size: 37784 +MD5sum: e57bc9887432f76266d7bf741cf9d813 +SHA1: 446d24cc86bdb7a779856c00f9dea966227a00e2 +SHA256: 072d2745b9c966d63cba5abf52357374e7a043b3cc1bbde0b8ccf68f82e45f60 +Description: System-V-like runlevel change mechanism +Multi-Arch: foreign +Homepage: http://savannah.nongnu.org/projects/sysvinit +Description-md5: 195f2d617082a23f37cee0f50784eef9 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: sysvinit-utils +Priority: required +Section: admin +Installed-Size: 236 +Maintainer: Ubuntu Core Developers +Original-Maintainer: Debian sysvinit maintainers +Architecture: i386 +Source: sysvinit +Version: 2.88dsf-41ubuntu16 +Replaces: last, sysvinit (<= 2.86.ds1-65) +Depends: libc6 (>= 2.15), libselinux1 (>= 1.32), lsb-base (>= 4.1+Debian11ubuntu7) +Recommends: upstart (>= 0.6.3-4) +Suggests: bootlogd, sash +Conflicts: chkconfig (<< 11.0-79.1-2), last, sysvconfig +Breaks: upstart (<< 1.5-0ubuntu5) +Filename: pool/main/s/sysvinit/sysvinit-utils_2.88dsf-41ubuntu16_i386.deb +Size: 49652 +MD5sum: e1340ba69c7a5f0cf1a84b3f68993570 +SHA1: 7cbd535c1c010c2e84cb454562fb6632fb366ddc +SHA256: 576c2bcfbf56871acd68576f07fd18b6bfccd8a5db6dfa04bcf62183f43e77a0 +Description: System-V-like utilities +Multi-Arch: foreign +Homepage: http://savannah.nongnu.org/projects/sysvinit +Description-md5: 1d2bc4c9c32104729144c7578ecd30bd +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: udev +Priority: required +Section: admin +Installed-Size: 5123 +Maintainer: Ubuntu Developers +Original-Maintainer: Debian systemd Maintainers +Architecture: i386 +Source: systemd +Version: 204-14ubuntu2 +Depends: libacl1 (>= 2.2.51-8), libblkid1 (>= 2.19.1), libc6 (>= 2.17), libcgmanager0, libdbus-1-3 (>= 1.0.2), libkmod2 (>= 5~), libnih-dbus1 (>= 1.0.0), libnih1 (>= 1.0.0), libselinux1 (>= 2.0.65), libudev1 (= 204-14ubuntu2), lsb-base (>= 4.1+Debian11ubuntu7), util-linux (>= 2.16), procps +Pre-Depends: debconf (>= 1.4.69) | debconf-2.0 +Breaks: consolekit (<< 0.4.6-1) +Filename: pool/main/s/systemd/udev_204-14ubuntu2_i386.deb +Size: 739026 +MD5sum: a85b035885e1b316354f6e5d0b8eeb69 +SHA1: 970405e4c8838c3cf17d1834c8917705d977879e +SHA256: 05fbd7f4b502fde9752b84b49364fe633b8377bcd996ec16462e0bc94adc9fcf +Description: /dev/ and hotplug management daemon +Multi-Arch: foreign +Homepage: http://www.freedesktop.org/wiki/Software/systemd +Description-md5: e875ddb09f46f1f7672af537f0c875ca +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + +Package: upstart +Priority: required +Section: admin +Installed-Size: 1721 +Maintainer: James Hunt +Architecture: i386 +Version: 1.13.1-0ubuntu1 +Replaces: startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job +Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job +Depends: libc6 (>= 2.15), libcgmanager0, libdbus-1-3 (>= 1.2.16), libjson-c2 (>= 0.10), libnih-dbus1 (>= 1.0.0), libnih1 (>= 1.0.0), libudev1 (>= 183), sysvinit-utils, initscripts, mountall, ifupdown (>= 0.6.10ubuntu5), libjson0 (>= 0.10-1.1ubuntu1), debianutils (>= 4) +Suggests: python3, graphviz, bash-completion, upstart-monitor +Conflicts: lxcguest, startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job +Breaks: friendly-recovery (<< 0.2.13), libc6 (<< 2.12.1-0ubuntu12) +Filename: pool/main/u/upstart/upstart_1.13.1-0ubuntu1_i386.deb +Size: 388978 +MD5sum: 2ebf7fb1083b581707e445fee808e120 +SHA1: 901424ec0d304ca8d10a25321a55d1d69bd8e82d +SHA256: c42fb117e90770c7163c9f4770e75e9c0d6a00d41c4b3afc2afebfa65ede80f8 +Description: event-based init daemon +Multi-Arch: foreign +Homepage: http://upstart.ubuntu.com/ +Orig-Maintainer: Steve Langasek +Description-md5: b776ec43b708c13dd0c2ab824471f478 +Bugs: https://bugs.launchpad.net/ubuntu/+filebug +Origin: Ubuntu +Supported: 9m +Task: minimal + diff --git a/test/integration/status-bug-lp1347721-dpkg-ordering b/test/integration/status-bug-lp1347721-dpkg-ordering new file mode 100644 index 000000000..62e545c55 --- /dev/null +++ b/test/integration/status-bug-lp1347721-dpkg-ordering @@ -0,0 +1,1942 @@ +Package: libustr-1.0-1 +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 261 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: ustr +Version: 1.0.4-3ubuntu2 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Description: Micro string library: shared library + ustr (Micro string library) is a string API for C. It has tiny overhead over + just plain strdup(), is much safer, is easier to use, is faster for many + operations, can be used with read-only or automatically allocated data. You + don't even need to link to the library to use it (so there are no + dependencies). + . + This package contains the shared library for ustr. +Homepage: http://www.and.org/ustr/ +Original-Maintainer: Vaclav Ovsik + +Package: debconf +Status: install ok installed +Priority: important +Section: admin +Installed-Size: 609 +Maintainer: Colin Watson +Architecture: all +Multi-Arch: foreign +Version: 1.5.53ubuntu1 +Replaces: debconf-tiny +Provides: debconf-2.0 +Pre-Depends: perl-base (>= 5.6.1-4) +Recommends: apt-utils (>= 0.5.1), debconf-i18n +Suggests: debconf-doc, debconf-utils, whiptail | dialog | gnome-utils, libterm-readline-gnu-perl, libgtk2-perl (>= 1:1.130), libnet-ldap-perl, perl, libqtgui4-perl, libqtcore4-perl +Conflicts: apt (<< 0.3.12.1), cdebconf (<< 0.96), debconf-tiny, debconf-utils (<< 1.3.22), dialog (<< 0.9b-20020814-1), menu (<= 2.1.3-1), whiptail (<< 0.51.4-11), whiptail-utf8 (<= 0.50.17-13) +Conffiles: + /etc/debconf.conf 8c0619be413824f1fc7698cee0f23811 + /etc/apt/apt.conf.d/70debconf 7e9d09d5801a42b4926b736b8eeabb73 + /etc/bash_completion.d/debconf 8fa1862734fbe54d7178aaaa419f5a11 +Description: Debian configuration management system + Debconf is a configuration management system for debian packages. Packages + use Debconf to ask questions when they are installed. +Original-Maintainer: Debconf Developers + +Package: iproute2 +Status: install ok installed +Priority: important +Section: net +Installed-Size: 1184 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 3.14.0-1 +Replaces: iproute +Provides: arpd +Depends: libc6 (>= 2.14), libdb5.3 +Recommends: libatm1 (>= 2.4.1-17~), libxtables10 +Suggests: iproute2-doc +Conflicts: arpd, iproute (<< 20130000-1) +Conffiles: + /etc/iproute2/rt_realms 7137bdf40e8d58c87ac7e3bba503767f + /etc/iproute2/rt_protos 95ce0b4b5b79f5a8a45941fb418a904c + /etc/iproute2/rt_dsfield 4264d5c7c8298300185aa04e1a736934 + /etc/iproute2/rt_scopes 6298b8df09e9bda23ea7da49021ca457 + /etc/iproute2/ematch_map b91e7f9b26918449bade9573f8871d61 + /etc/iproute2/group 3aea2c0e0dd75e13a5f8f48f2936915f + /etc/iproute2/rt_tables a1313318d6778fe6b8c680248ef5a463 +Description: networking and traffic control tools + The iproute2 suite is a collection of utilities for networking and + traffic control. + . + These tools communicate with the Linux kernel via the (rt)netlink + interface, providing advanced features not available through the + legacy net-tools commands 'ifconfig' and 'route'. +Original-Maintainer: Debian iproute2 Maintainers +Homepage: http://www.linux-foundation.org/en/Net:Iproute2 + +Package: coreutils +Essential: yes +Status: install ok installed +Priority: required +Section: utils +Installed-Size: 6124 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 8.21-1ubuntu5 +Replaces: mktemp, timeout +Pre-Depends: libacl1 (>= 2.2.51-8), libattr1 (>= 1:2.4.46-8), libc6 (>= 2.17), libselinux1 (>= 1.32) +Conflicts: timeout +Description: GNU core utilities + This package contains the basic file, shell and text manipulation + utilities which are expected to exist on every operating system. + . + Specifically, this package includes: + arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp + csplit cut date dd df dir dircolors dirname du echo env expand expr + factor false flock fmt fold groups head hostid id install join link ln + logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc od + paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir runcon + sha*sum seq shred sleep sort split stat stty sum sync tac tail tee test + timeout touch tr true truncate tsort tty uname unexpand uniq unlink + users vdir wc who whoami yes +Homepage: http://gnu.org/software/coreutils +Original-Maintainer: Michael Stone + +Package: debianutils +Essential: yes +Status: install ok installed +Priority: required +Section: utils +Installed-Size: 273 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 4.4 +Replaces: manpages-pl (<< 1:0.5) +Depends: sensible-utils +Pre-Depends: libc6 (>= 2.15) +Description: Miscellaneous utilities specific to Debian + This package provides a number of small utilities which are used + primarily by the installation scripts of Debian packages, although + you may use them directly. + . + The specific utilities included are: + add-shell installkernel ischroot remove-shell run-parts savelog + tempfile which +Original-Maintainer: Clint Adams + +Package: initramfs-tools +Status: install ok installed +Priority: optional +Section: utils +Installed-Size: 365 +Maintainer: Ubuntu Kernel Team +Architecture: all +Multi-Arch: foreign +Version: 0.103ubuntu4 +Provides: linux-initramfs-tool +Depends: initramfs-tools-bin (>= 0.103ubuntu4), initramfs-tools-bin (<< 0.103ubuntu4.1~), klibc-utils (>= 2.0-1~), busybox-initramfs (>= 1:1.13.3-1ubuntu5), cpio, module-init-tools, udev (>= 147~-5), findutils (>= 4.2.24), util-linux (>> 2.15~rc1) +Suggests: bash-completion +Breaks: cryptsetup (<< 2:1.1.0-2.1), elilo (<< 3.12-3.1~), lilo (<< 22.8-8.2~), mountall (<< 2.0~), s390-tools (<< 1.8.3-2~) +Conflicts: usplash (<< 0.5.50) +Conffiles: + /etc/bash_completion.d/initramfs-tools 7eeb7184772f3658e7cf446945c096b1 + /etc/initramfs-tools/update-initramfs.conf e2026d4603e7161efaccca519aeb1297 + /etc/initramfs-tools/initramfs.conf 8801535d9bec98754eea6a172f956d42 + /etc/kernel/postrm.d/initramfs-tools e22d1ab0d7a7a1b66ae6d71ea4f21938 + /etc/kernel/postinst.d/initramfs-tools fe7713b9a74a10ed71d1e7dd93afc209 +Description: tools for generating an initramfs + This package contains tools to create and boot an initramfs for packaged 2.6 + Linux kernel. The initramfs is a gzipped cpio archive. At boot time, the + kernel unpacks that archive into RAM, mounts and uses it as initial root file + system. The mounting of the real root file system occurs in early user space. + klibc provides utilities to setup root. Having the root on MD, LVM2, LUKS or + NFS is also supported. + Any boot loader with initrd support is able to load an initramfs archive. +Original-Maintainer: Debian kernel team + +Package: makedev +Status: install ok installed +Priority: extra +Section: admin +Installed-Size: 125 +Maintainer: Ubuntu Developers +Architecture: all +Multi-Arch: foreign +Version: 2.3.1-93ubuntu1 +Depends: base-passwd (>= 3.0.4) +Conflicts: udev (<= 0.024-7) +Description: creates device files in /dev + The MAKEDEV executable is used to create device files, often in /dev. + . + Device files are special files through which applications can interact + with hardware. + . + This package is not necessary for most modern Linux systems, where the udev + subsystem provides a more dynamic mechanism for device file management. +Original-Maintainer: Debian QA Group + +Package: libdbus-1-3 +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 398 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: dbus +Version: 1.6.18-0ubuntu4 +Depends: libc6 (>= 2.10) +Pre-Depends: multiarch-support +Recommends: dbus +Breaks: kde-window-manager (<< 4:4.4.5-9), kdebase-workspace-bin (<< 4:4.4.5-9) +Description: simple interprocess messaging system (library) + D-Bus is a message bus, used for sending messages between applications. + Conceptually, it fits somewhere in between raw sockets and CORBA in + terms of complexity. + . + D-Bus supports broadcast messages, asynchronous messages (thus + decreasing latency), authentication, and more. It is designed to be + low-overhead; messages are sent using a binary protocol, not using + XML. D-Bus also supports a method call mapping for its messages, but + it is not required; this makes using the system quite simple. + . + It comes with several bindings, including GLib, Python, Qt and Java. + . + The daemon can be found in the dbus package. +Homepage: http://dbus.freedesktop.org/ +Original-Maintainer: Utopia Maintenance Team + +Package: module-init-tools +Status: install ok installed +Priority: extra +Section: admin +Installed-Size: 31 +Maintainer: Ubuntu Developers +Architecture: all +Multi-Arch: foreign +Source: kmod +Version: 16-2ubuntu3 +Depends: libkmod2, kmod +Pre-Depends: dpkg (>= 1.15.7.2) +Description: transitional dummy package (module-init-tools to kmod) + This dummy package is provided to support the transition from + module-init-tools to kmod and should be removed afterwards. +Original-Maintainer: Marco d'Itri + +Package: libuuid1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 107 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: util-linux +Version: 2.20.1-5.1ubuntu20 +Replaces: e2fsprogs (<< 1.34-1) +Depends: passwd, libc6 (>= 2.4) +Pre-Depends: multiarch-support +Recommends: uuid-runtime +Description: Universally Unique ID library + The libuuid library generates and parses 128-bit universally unique + ids (UUIDs). A UUID is an identifier that is unique across both + space and time, with respect to the space of all UUIDs. A UUID can + be used for multiple purposes, from tagging objects with an extremely + short lifetime, to reliably identifying very persistent objects + across a network. + . + See RFC 4122 for more information. +Homepage: http://userweb.kernel.org/~kzak/util-linux/ +Original-Maintainer: LaMont Jones + +Package: lsb-base +Status: install ok installed +Priority: required +Section: misc +Installed-Size: 82 +Maintainer: Ubuntu Developers +Architecture: all +Multi-Arch: foreign +Source: lsb +Version: 4.1+Debian11ubuntu6 +Description: Linux Standard Base 4.1 init script functionality + The Linux Standard Base (http://www.linuxbase.org/) is a standard + core system that third-party applications written for Linux can + depend upon. + . + This package only includes the init-functions shell library, which + may be used by other packages' initialization scripts for console + logging and other purposes. +Homepage: http://www.linuxfoundation.org/collaborate/workgroups/lsb +Original-Maintainer: Debian LSB Team + +Package: procps +Status: install ok installed +Priority: important +Section: admin +Installed-Size: 637 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 1:3.3.9-1ubuntu2 +Provides: watch +Depends: libc6 (>= 2.15), libncurses5 (>= 5.5-5~), libncursesw5 (>= 5.6+20070908), libprocps3, libtinfo5, lsb-base (>= 3.0-10), initscripts +Recommends: psmisc +Breaks: guymager (<= 0.5.9-1), open-vm-tools (<= 2011.12.20-562307-1), xmem (<= 1.20-27.1) +Conflicts: pgrep (<< 3.3-5), w-bassman (<< 1.0-3) +Conffiles: + /etc/sysctl.d/10-console-messages.conf 154f6f5c5810d10bb303fb6a8e907c6a + /etc/sysctl.d/README c20074b9b11a5202758c69d7bcb6996f + /etc/sysctl.d/10-magic-sysrq.conf b3059f2835f17c97265433fdfdee358f + /etc/sysctl.d/10-kernel-hardening.conf 5c1388f00011a287cdeba60208c674e1 + /etc/sysctl.d/10-link-restrictions.conf 8568316f2baa8db06554dab91f93a161 + /etc/sysctl.d/10-zeropage.conf 8d7193abcc4dfedaf519dd03016a5e59 + /etc/sysctl.d/10-network-security.conf 4ac7258f5336e7eeaf448c05ab668d3c + /etc/sysctl.d/10-ptrace.conf 47f40494b2fc698e15549e0a4a79e81c + /etc/sysctl.d/10-ipv6-privacy.conf e9473d12b4a7069d6a3ca8b694511ddf + /etc/sysctl.conf 76c1d8285c578d5e827c3e07b9738112 + /etc/init.d/procps 021482ebab1024f5ed76e650e5191e8f + /etc/init/procps.conf 96170a339d08797dc90d69b01d6bf610 +Description: /proc file system utilities + This package provides command line and full screen utilities for browsing + procfs, a "pseudo" file system dynamically generated by the kernel to + provide information about the status of entries in its process table + (such as whether the process is running, stopped, or a "zombie"). + . + It contains free, kill, pkill, pgrep, pmap, ps, pwdx, skill, slabtop, + snice, sysctl, tload, top, uptime, vmstat, w, and watch. +Homepage: http://gitorious.org/procps +Original-Maintainer: Craig Small + +Package: libpam0g +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 219 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: pam +Version: 1.1.8-1ubuntu2 +Replaces: libpam0g-util +Depends: libaudit1 (>= 1:2.2.1), libc6 (>= 2.8), debconf (>= 0.5) | debconf-2.0 +Pre-Depends: multiarch-support +Suggests: libpam-doc +Description: Pluggable Authentication Modules library + Contains the shared library for Linux-PAM, a library that enables the + local system administrator to choose how applications authenticate users. + In other words, without rewriting or recompiling a PAM-aware application, + it is possible to switch between the authentication mechanism(s) it uses. + One may entirely upgrade the local authentication system without touching + the applications themselves. +Homepage: http://pam.sourceforge.net/ +Original-Maintainer: Steve Langasek + +Package: sensible-utils +Status: install ok installed +Priority: required +Section: utils +Installed-Size: 110 +Maintainer: Ubuntu Developers +Architecture: all +Multi-Arch: foreign +Version: 0.0.9 +Replaces: debianutils (<= 2.32.3), manpages-pl (<= 20060617-3~) +Description: Utilities for sensible alternative selection + This package provides a number of small utilities which are used + by programs to sensibly select and spawn an appropriate browser, + editor, or pager. + . + The specific utilities included are: sensible-browser sensible-editor + sensible-pager +Original-Maintainer: Anibal Monsalve Salazar + +Package: perl-base +Essential: yes +Status: install ok installed +Priority: required +Section: perl +Installed-Size: 4780 +Maintainer: Ubuntu Developers +Architecture: i386 +Source: perl +Version: 5.18.2-2ubuntu1 +Replaces: libperl5.8 (<< 5.8.0-20), libscalar-list-utils-perl, libsocket-perl, libxsloader-perl, perl (<< 5.10.1-12), perl-modules (<< 5.10.1-1) +Provides: libscalar-list-utils-perl, libsocket-perl, libxsloader-perl, perl5-base, perlapi-5.18.1, perlapi-5.18.2 +Pre-Depends: libc6 (>= 2.11), dpkg (>= 1.14.20) +Suggests: perl +Breaks: autoconf2.13 (<< 2.13-45), libcommon-sense-perl (<< 3.72-2~), libfile-spec-perl (<< 3.4000), libmarc-charset-perl (<< 1.2), libsocket-perl (<< 2.009), libxsloader-perl (<< 0.16) +Conflicts: defoma (<< 0.11.12), doc-base (<< 0.10.3), libscalar-list-utils-perl, mono-gac (<< 2.10.8.1-3), safe-rm (<< 0.8), update-inetd (<< 4.41) +Description: minimal Perl system + Perl is a scripting language used in many system scripts and utilities. + . + This package provides a Perl interpreter and the small subset of the + standard run-time library required to perform basic tasks. For a full + Perl installation, install "perl" (and its dependencies, "perl-modules" + and "perl-doc"). +Original-Maintainer: Niko Tyni +Homepage: http://dev.perl.org/perl5/ + +Package: sysv-rc +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 221 +Maintainer: Ubuntu Core Developers +Architecture: all +Multi-Arch: foreign +Source: sysvinit +Version: 2.88dsf-41ubuntu6 +Replaces: file-rc +Depends: debconf (>= 0.5) | debconf-2.0, sysvinit-utils (>= 2.86.ds1-62), insserv (>> 1.12.0-10) +Recommends: lsb-base (>= 3.2-14) +Suggests: sysv-rc-conf, bum +Breaks: initscripts (<< 2.86.ds1-63) +Conflicts: file-rc +Description: System-V-like runlevel change mechanism + This package provides support for the System-V like system + for booting, changing runlevels, and shutting down, + configured through symbolic links in /etc/rc?.d/. +Homepage: http://savannah.nongnu.org/projects/sysvinit +Original-Maintainer: Debian sysvinit maintainers + +Package: libprocps3 +Status: install ok installed +Priority: important +Section: libs +Installed-Size: 129 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: procps +Version: 1:3.3.9-1ubuntu2 +Replaces: procps (<< 1:3.3.2-1) +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Description: library for accessing process information from /proc + The libprocps library is a way of accessing information out of the /proc + filesystem. + . + This package contains the shared libraries necessary to run programs + compilied with libprocps. +Homepage: http://gitorious.org/procps +Original-Maintainer: Craig Small + +Package: libjson-c2 +Status: install ok installed +Priority: extra +Section: libs +Installed-Size: 82 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: json-c +Version: 0.11-4ubuntu1 +Depends: libc6 (>= 2.8) +Pre-Depends: multiarch-support +Description: JSON manipulation library - shared library + This library allows you to easily construct JSON objects in C, + output them as JSON formatted strings and parse JSON formatted + strings back into the C representation of JSON objects. +Homepage: https://github.com/json-c/json-c/wiki +Original-Maintainer: fabien boucher + +Package: libdrm2 +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 105 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: libdrm +Version: 2.4.53-1 +Depends: libc6 (>= 2.17) +Pre-Depends: multiarch-support +Description: Userspace interface to kernel DRM services -- runtime + This library implements the userspace interface to the kernel DRM + services. DRM stands for "Direct Rendering Manager", which is the + kernelspace portion of the "Direct Rendering Infrastructure" (DRI). + The DRI is currently used on Linux to provide hardware-accelerated + OpenGL drivers. + . + This package provides the runtime environment for libdrm. +Original-Maintainer: Debian X Strike Force + +Package: libsepol1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 322 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: libsepol +Version: 2.2-1 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Description: SELinux library for manipulating binary security policies + Security-enhanced Linux is a patch of the Linux kernel and a number + of utilities with enhanced security functionality designed to add + mandatory access controls to Linux. The Security-enhanced Linux + kernel contains new architectural components originally developed to + improve the security of the Flask operating system. These + architectural components provide general support for the enforcement + of many kinds of mandatory access control policies, including those + based on the concepts of Type Enforcement®, Role-based Access + Control, and Multi-level Security. + . + libsepol provides an API for the manipulation of SELinux binary policies. + It is used by checkpolicy (the policy compiler) and similar tools, as well + as by programs like load_policy that need to perform specific transformations + on binary policies such as customizing policy boolean settings. +Original-Maintainer: Debian SELinux maintainers +Homepage: http://userspace.selinuxproject.org/ + +Package: libpam-modules +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 764 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: pam +Version: 1.1.8-1ubuntu2 +Replaces: libpam-umask, libpam0g-util +Provides: libpam-mkhomedir, libpam-motd, libpam-umask +Pre-Depends: libaudit1 (>= 1:2.2.1), libc6 (>= 2.15), libdb5.3, libpam0g (>= 1.1.3-2), libselinux1 (>= 2.1.9), debconf (>= 0.5) | debconf-2.0, libpam-modules-bin (= 1.1.8-1ubuntu2) +Conflicts: libpam-mkhomedir, libpam-motd, libpam-umask +Conffiles: + /etc/security/limits.conf 11c27ba00b7bd6a255f33126f75c5005 + /etc/security/group.conf f1e26e8db6f7abd2d697d7dad3422c36 + /etc/security/access.conf 13ec4d189f0ed9acf3433977a53d446b + /etc/security/pam_env.conf ddee4a931170dc21b4e0b9bb28e02a7b + /etc/security/namespace.init b46b23d64860d1557d2a8f44b231fd54 + /etc/security/time.conf 06e05c6079e839c8833ac7c3abfde192 + /etc/security/sepermit.conf d41c74654734a5c069a37bfc02f0a6d4 + /etc/security/namespace.conf 6424c99a62ddf4b7d3ca713bb06ded89 +Description: Pluggable Authentication Modules for PAM + This package completes the set of modules for PAM. It includes the + pam_unix.so module as well as some specialty modules. +Homepage: http://pam.sourceforge.net/ +Original-Maintainer: Steve Langasek + +Package: tzdata +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 1599 +Maintainer: Ubuntu Developers +Architecture: all +Multi-Arch: foreign +Version: 2014b-1 +Replaces: libc0.1, libc0.3, libc6, libc6.1 +Provides: tzdata-jessie +Depends: debconf (>= 0.5) | debconf-2.0 +Description: time zone and daylight-saving time data + This package contains data required for the implementation of + standard local time for many representative locations around the + globe. It is updated periodically to reflect changes made by + political bodies to time zone boundaries, UTC offsets, and + daylight-saving rules. +Original-Maintainer: GNU Libc Maintainers +Homepage: http://www.iana.org/time-zones + +Package: libudev1 +Status: install ok installed +Priority: important +Section: libs +Installed-Size: 129 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: systemd +Version: 204-10ubuntu1 +Depends: libc6 (>= 2.17), libcgmanager0, libdbus-1-3 (>= 1.0.2), libnih-dbus1 (>= 1.0.0), libnih1 (>= 1.0.0) +Pre-Depends: multiarch-support +Description: libudev shared library + This library provides access to udev device information. +Homepage: http://www.freedesktop.org/wiki/Software/systemd +Original-Maintainer: Debian systemd Maintainers + +Package: ifupdown +Status: install ok installed +Priority: important +Section: admin +Installed-Size: 229 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 0.7.48.1ubuntu1 +Replaces: netbase (<< 5.0) +Depends: iproute2 | iproute (>= 20071016-1), libc6 (>= 2.7), sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16), lsb-base (>= 4.1+Debian3), initscripts (>= 2.88dsf-25), adduser +Recommends: isc-dhcp-client | dhcp-client +Suggests: ppp, rdnssd, net-tools +Breaks: dhcp3-client (<< 4.0), netbase (<< 5.0) +Conffiles: + /etc/network/if-up.d/upstart dfbcde4fd4a3a2553930605e03e160ab + /etc/network/if-down.d/upstart 1a0205ddbc1446782a8d4d818e97d8a5 + /etc/init/network-interface-container.conf 4daa570594afc50940f140a7731d20d1 + /etc/init/networking.conf c50811e19bcd596d99b0467b40cfbb8b + /etc/init/network-interface.conf aae12345eba8e946579b06798b1752c1 + /etc/init/network-interface-security.conf feb6b4b52fe24c44ff1bc68addf245d6 + /etc/init.d/networking 2c8c3be8b90f99de7edf0f883ebe39f3 + /etc/default/networking 35cd4a2713981c9239ce4532c1bfc1c7 +Description: high level tools to configure network interfaces + This package provides the tools ifup and ifdown which may be used to + configure (or, respectively, deconfigure) network interfaces based on + interface definitions in the file /etc/network/interfaces. +Original-Maintainer: Andrew Shadura + +Package: libsemanage1 +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 261 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: libsemanage +Version: 2.2-1ubuntu1 +Depends: libsemanage-common (= 2.2-1ubuntu1), libaudit1 (>= 1:2.2.1), libbz2-1.0, libc6 (>= 2.8), libselinux1 (>= 2.1.12), libsepol1 (>= 2.1.4), libustr-1.0-1 (>= 1.0.4) +Pre-Depends: multiarch-support +Description: SELinux policy management library + This package provides the shared libraries for SELinux policy management. + It uses libsepol for binary policy manipulation and libselinux for + interacting with the SELinux system. It also exec's helper programs + for loading policy and for checking whether the file_contexts + configuration is valid (load_policy and setfiles from + policycoreutils) presently, although this may change at least for the + bootstrapping case + . + Security-enhanced Linux is a patch of the Linux kernel and a + number of utilities with enhanced security functionality designed to + add mandatory access controls to Linux. The Security-enhanced Linux + kernel contains new architectural components originally developed to + improve the security of the Flask operating system. These + architectural components provide general support for the enforcement + of many kinds of mandatory access control policies, including those + based on the concepts of Type Enforcement, Role-based Access + Control, and Multi-level Security. +Original-Maintainer: Debian SELinux maintainers +Homepage: http://userspace.selinuxproject.org/ + +Package: mountall +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 248 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 2.53 +Replaces: upstart (<< 0.6.3-2) +Depends: makedev, udev, plymouth, coreutils (>= 7.1), libc6 (>= 2.9), libdbus-1-3 (>= 1.2.16), libnih-dbus1 (>= 1.0.0), libnih1 (>= 1.0.0), libplymouth2 (>= 0.8.1-3), libudev1 (>= 183) +Pre-Depends: dpkg (>= 1.15.7.2) +Breaks: initscripts (<< 2.88dsf-24), policycoreutils (<< 2.0.69-2ubuntu4), usplash (<< 0.5.47) +Conffiles: + /etc/init/checkroot.sh.conf 3ea7f6ba450f431fd239e2b53a805216 + /etc/init/mounted-dev.conf cf7bea42235e77168c996d774f059c44 + /etc/init/mounted-tmp.conf 289fa57d726885147a41b2b1f3695a29 + /etc/init/mountdevsubfs.sh.conf dd33cb414bca17d97140d7f8671207f2 + /etc/init/mountall-net.conf feff70cd7006f6763e24263d381940f3 + /etc/init/mountall-shell.conf aa05af89db3de044d1cd7f6971b46d9f + /etc/init/mountall.sh.conf ee258840aad52477434cc22e34efcc50 + /etc/init/bootmisc.sh.conf d1a51c54dcfe6f3f5265246888ba4161 + /etc/init/mountnfs.sh.conf 760a5b57cbd0d1e2c65ba6db9297a586 + /etc/init/mounted-proc.conf 07198659bd06c1442a35882b2fae05fc + /etc/init/mountnfs-bootclean.sh.conf 0b6f3f9e9f8757efee57f6a4839d7dff + /etc/init/mountall.conf ac0fbaa98e705e52f59ca9e4d39751ad + /etc/init/mountall-bootclean.sh.conf d1899239aa60ea903f43a3ac58c5c238 + /etc/init/mtab.sh.conf 27aece82dbe70232d734d1dadfe87518 + /etc/init/mountkernfs.sh.conf 2e7449097b6cf88cba915edc1c339ec4 + /etc/init/mounted-var.conf 02f90856c91a46e9cbed1c35b92fec6c + /etc/init/mountall-reboot.conf 43e3c229085a13005b0681a49b2bef51 + /etc/init/checkroot-bootclean.sh.conf e02a473c76e4a2bfc1efb4c367495052 + /etc/init/checkfs.sh.conf 2e928476ccb2ecefe9ee87e2f83d34da + /etc/init/mounted-debugfs.conf 462c8aab0d9d4e6e496b1e2be5910edc + /etc/init/mounted-run.conf a26db58c801e0f6ec8738a5838aa53ed + /etc/dbus-1/system.d/Mountall.Server.conf 91b1414af1257d2ef089f84a3e5c1ed1 +Description: filesystem mounting tool + mountall mounts filesystems when the underlying block devices are + ready, or when network interfaces come up, checking the filesystems + first. +Original-Maintainer: Steve Langasek + +Package: kmod +Status: install ok installed +Priority: important +Section: admin +Installed-Size: 285 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 16-2ubuntu3 +Replaces: module-init-tools (<< 4) +Depends: libc6 (>= 2.17), libkmod2, sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16), lsb-base (>= 3.0-6) +Breaks: module-init-tools (<< 4) +Conffiles: + /etc/init/kmod.conf 2686532745c8b71d6d3df91c3a53aef3 + /etc/modprobe.d/blacklist-framebuffer.conf 097e2142ae3e4dd2911eda7844ce0c18 + /etc/modprobe.d/blacklist-rare-network.conf 8fb4b96124e461f53adceba9ca91f09a + /etc/modprobe.d/blacklist.conf bc6754fa320733c6d239a4bb0148ffd7 + /etc/modprobe.d/iwlwifi.conf f27bc645e93e20c8e532325d190ac8ee + /etc/modprobe.d/blacklist-ath_pci.conf d1da9bb08c2b0f56f3be93fd0e37946b + /etc/modprobe.d/mlx4.conf b2a0bedb7461daeb0138270639581bbf + /etc/modprobe.d/blacklist-firewire.conf 9cc07a17e8e64f9cd35ff59c29debe69 + /etc/modprobe.d/blacklist-watchdog.conf 55327f9270c8a6257a833c4d127a39e1 + /etc/init.d/kmod e6d43abead3714ceb8aca68dd77e1dad + /etc/depmod.d/ubuntu.conf 7c8439ef36b12e5f226b5dbfa20b8c2d +Description: tools for managing Linux kernel modules + This package contains a set of programs for loading, inserting, and + removing kernel modules for Linux. + It replaces module-init-tools. +Original-Maintainer: Marco d'Itri + +Package: libkmod2 +Status: install ok installed +Priority: important +Section: libs +Installed-Size: 138 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: kmod +Version: 16-2ubuntu3 +Depends: libc6 (>= 2.17) +Pre-Depends: multiarch-support +Description: libkmod shared library + This library provides an API for insertion, removal, configuration and + listing of kernel modules. +Original-Maintainer: Marco d'Itri + +Package: tar +Essential: yes +Status: install ok installed +Priority: required +Section: utils +Installed-Size: 760 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 1.27.1-2 +Replaces: cpio (<< 2.4.2-39) +Pre-Depends: libacl1 (>= 2.2.51-8), libc6 (>= 2.17), libselinux1 (>= 1.32) +Suggests: bzip2, ncompress, xz-utils, tar-scripts +Breaks: dpkg-dev (<< 1.14.26) +Conflicts: cpio (<= 2.4.2-38) +Conffiles: + /etc/rmt 3c58b7cd13da1085eff0acc6a00f43c7 +Description: GNU version of the tar archiving utility + Tar is a program for packaging a set of files as a single archive in tar + format. The function it performs is conceptually similar to cpio, and to + things like PKZIP in the DOS world. It is heavily used by the Debian package + management system, and is useful for performing system backups and exchanging + sets of files with others. +Original-Maintainer: Bdale Garbee + +Package: libmount1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 249 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: util-linux +Version: 2.20.1-5.1ubuntu20 +Depends: libblkid1 (>= 2.17.2), libc6 (>= 2.8), libselinux1 (>= 1.32) +Pre-Depends: multiarch-support +Description: block device id library + The device mounting library, used by mount and mount helpers. +Homepage: http://userweb.kernel.org/~kzak/util-linux/ +Original-Maintainer: LaMont Jones + +Package: zlib1g +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 170 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: zlib +Version: 1:1.2.8.dfsg-1ubuntu1 +Provides: libz1 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Breaks: libxml2 (<< 2.7.6.dfsg-2), texlive-binaries (<< 2009-12) +Conflicts: zlib1 (<= 1:1.0.4-7) +Description: compression library - runtime + zlib is a library implementing the deflate compression method found + in gzip and PKZIP. This package includes the shared library. +Homepage: http://zlib.net/ +Original-Maintainer: Mark Brown + +Package: adduser +Status: install ok installed +Priority: important +Section: admin +Installed-Size: 644 +Maintainer: Ubuntu Core Developers +Architecture: all +Multi-Arch: foreign +Version: 3.113+nmu3ubuntu3 +Replaces: manpages-it (<< 0.3.4-2), manpages-pl (<= 20051117-1) +Depends: perl-base (>= 5.6.0), passwd (>= 1:4.0.12), debconf | debconf-2.0 +Suggests: liblocale-gettext-perl, perl-modules, ecryptfs-utils (>= 67-1) +Conffiles: + /etc/deluser.conf 773fb95e98a27947de4a95abb3d3f2a2 +Description: add and remove users and groups + This package includes the 'adduser' and 'deluser' commands for creating + and removing users. + . + - 'adduser' creates new users and groups and adds existing users to + existing groups; + - 'deluser' removes users and groups and removes users from a given + group. + . + Adding users with 'adduser' is much easier than adding them manually. + Adduser will choose appropriate UID and GID values, create a home + directory, copy skeletal user configuration, and automate setting + initial values for the user's password, real name and so on. + . + Deluser can back up and remove users' home directories + and mail spool or all the files they own on the system. + . + A custom script can be executed after each of the commands. + . + Development mailing list: + http://lists.alioth.debian.org/mailman/listinfo/adduser-devel/ +Homepage: http://alioth.debian.org/projects/adduser/ +Original-Maintainer: Debian Adduser Developers + +Package: libgcc1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 154 +Maintainer: Ubuntu Core developers +Architecture: i386 +Multi-Arch: same +Source: gcc-4.9 (4.9.0-1ubuntu3) +Version: 1:4.9.0-1ubuntu3 +Depends: gcc-4.9-base (= 4.9.0-1ubuntu3), libc6 (>= 2.2.4) +Pre-Depends: multiarch-support +Breaks: gcc-4.3 (<< 4.3.6-1), gcc-4.4 (<< 4.4.6-4), gcc-4.5 (<< 4.5.3-2) +Description: GCC support library + Shared version of the support library, a library of internal subroutines + that GCC uses to overcome shortcomings of particular machines, or + special needs for some languages. +Homepage: http://gcc.gnu.org/ +Original-Maintainer: Debian GCC Maintainers + +Package: libdebconfclient0 +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 85 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: cdebconf +Version: 0.190ubuntu1 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Description: Debian Configuration Management System (C-implementation library) + Debconf is a configuration management system for Debian packages. It is + used by some packages to prompt you for information before they are + installed. This is a reimplementation of the original debconf version + in C. + . + This is the libraries needed by libdebconfclient-dev and cdebconf. +Original-Maintainer: Debian Install System Team + +Package: libklibc +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 133 +Maintainer: Ubuntu Developers +Architecture: i386 +Source: klibc +Version: 2.0.3-0ubuntu1 +Description: minimal libc subset for use with initramfs + klibc is intended to be a minimalistic libc subset for use with + initramfs. It is deliberately written for small size, minimal + entanglement, and portability, not speed. It is definitely a work in + progress, and a lot of things are still missing. +Homepage: http://git.kernel.org/?p=libs/klibc/klibc.git;a=summary +Original-Maintainer: maximilian attems + +Package: libcgmanager0 +Status: install ok installed +Priority: optional +Section: admin +Installed-Size: 152 +Maintainer: Serge Hallyn +Architecture: i386 +Multi-Arch: same +Source: cgmanager +Version: 0.25-0ubuntu4 +Depends: libc6 (>= 2.1.3), libdbus-1-3 (>= 1.0.2) +Description: Central cgroup manager daemon (client library) + cgmanager provides a central cgroup manager daemon and a + per-namespace manager proxy, allowing users and programs + to administrate cgroups through D-Bus requests. + . + This package contains the shared library. +Homepage: http://cgmanager.linuxcontainers.org/ + +Package: mount +Essential: yes +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 410 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Source: util-linux +Version: 2.20.1-5.1ubuntu20 +Pre-Depends: libblkid1 (>= 2.20.1), libc6 (>= 2.8), libmount1 (>= 2.20.1), libselinux1 (>= 2.0.15) +Suggests: nfs-common (>= 1:1.1.0-13) +Description: Tools for mounting and manipulating filesystems + This package provides the mount(8), umount(8), swapon(8), + swapoff(8), and losetup(8) commands. +Homepage: http://userweb.kernel.org/~kzak/util-linux/ +Original-Maintainer: LaMont Jones + +Package: libncurses5 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 292 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: ncurses +Version: 5.9+20140118-1ubuntu1 +Depends: libtinfo5 (= 5.9+20140118-1ubuntu1), libc6 (>= 2.15) +Pre-Depends: multiarch-support, libtinfo5 (>= 5.9-3) +Recommends: libgpm2 +Description: shared libraries for terminal handling + The ncurses library routines are a terminal-independent method of + updating character screens with reasonable optimization. + . + This package contains the shared libraries necessary to run programs + compiled with ncurses. +Homepage: http://invisible-island.net/ncurses/ +Original-Maintainer: Craig Small + +Package: libplymouth2 +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 298 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: plymouth +Version: 0.8.8-0ubuntu17 +Replaces: plymouth (<< 0.7.0+git20090207-0ubuntu0.1~ppa4) +Depends: libc6 (>= 2.8), libpng12-0 (>= 1.2.13-4) +Pre-Depends: multiarch-support +Breaks: casper (= 1.227), mountall (<< 2.8) +Description: graphical boot animation and logger - shared libraries + Plymouth is an application that runs very early in the boot process + (even before the root filesystem is mounted!) that provides a graphical + boot animation while the boot process happens in the background. + . + This package contains the shared libraries. + +Package: gcc-4.9-base +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 213 +Maintainer: Ubuntu Core developers +Architecture: i386 +Multi-Arch: same +Source: gcc-4.9 +Version: 4.9.0-1ubuntu3 +Breaks: dehydra (<= 0.9.hg20110609-2), gcc-4.4-base (<< 4.4.7), gcj-4.4-base (<< 4.4.6-9~), gcj-4.6-base (<< 4.6.1-4~), gnat-4.4-base (<< 4.4.6-3~), gnat-4.6 (<< 4.6.1-5~) +Description: GCC, the GNU Compiler Collection (base package) + This package contains files common to all languages and libraries + contained in the GNU Compiler Collection (GCC). +Homepage: http://gcc.gnu.org/ +Original-Maintainer: Debian GCC Maintainers + +Package: initramfs-tools-bin +Status: install ok installed +Priority: optional +Section: utils +Installed-Size: 119 +Maintainer: Ubuntu Kernel Team +Architecture: i386 +Source: initramfs-tools +Version: 0.103ubuntu4 +Depends: libc6 (>= 2.4), libudev1 (>= 183) +Description: binaries used by initramfs-tools + This package contains binaries used inside the initramfs images generated + by initramfs-tools. +Original-Maintainer: Debian kernel team + +Package: libattr1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 55 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: attr +Version: 1:2.4.47-1ubuntu1 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Conflicts: attr (<< 2.0.0) +Description: Extended attribute shared library + Contains the runtime environment required by programs that make use + of extended attributes. +Homepage: http://savannah.nongnu.org/projects/attr/ +Original-Maintainer: Anibal Monsalve Salazar + +Package: klibc-utils +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 392 +Maintainer: Ubuntu Developers +Architecture: i386 +Source: klibc +Version: 2.0.3-0ubuntu1 +Depends: libklibc (= 2.0.3-0ubuntu1) +Breaks: initramfs-tools (<< 0.103) +Description: small utilities built with klibc for early boot + This package contains a collection of programs that are linked + against klibc. These duplicate some of the functionality of a + regular Linux toolset, but are typically much smaller than their + full-function counterparts. They are intended for inclusion in + initramfs images and embedded systems. +Homepage: http://git.kernel.org/?p=libs/klibc/klibc.git;a=summary +Original-Maintainer: maximilian attems + +Package: e2fslibs +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 418 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: e2fsprogs +Version: 1.42.9-3ubuntu1 +Replaces: e2fsprogs (<< 1.34-1) +Provides: libe2p2, libext2fs2 +Depends: libc6 (>= 2.17) +Pre-Depends: multiarch-support +Description: ext2/ext3/ext4 file system libraries + The ext2, ext3 and ext4 file systems are successors of the original ext + ("extended") file system. They are the main file system types used for + hard disks on Debian and other Linux systems. + . + This package provides the ext2fs and e2p libraries, for userspace software + that directly accesses extended file systems. Programs that use libext2fs + include e2fsck, mke2fs, and tune2fs. Programs that use libe2p include + dumpe2fs, chattr, and lsattr. +Homepage: http://e2fsprogs.sourceforge.net +Original-Maintainer: Theodore Y. Ts'o + +Package: base-passwd +Essential: yes +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 247 +Maintainer: Colin Watson +Architecture: i386 +Multi-Arch: foreign +Version: 3.5.33 +Replaces: base +Depends: libc6 (>= 2.8), libdebconfclient0 (>= 0.145) +Recommends: debconf (>= 0.5) | debconf-2.0 +Description: Debian base system master password and group files + These are the canonical master copies of the user database files + (/etc/passwd and /etc/group), containing the Debian-allocated user and + group IDs. The update-passwd tool is provided to keep the system databases + synchronized with these master files. + +Package: libcomerr2 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 102 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: e2fsprogs +Version: 1.42.9-3ubuntu1 +Replaces: e2fsprogs (<< 1.34-1) +Provides: libcomerr-kth-compat +Depends: libc6 (>= 2.17) +Pre-Depends: multiarch-support +Description: common error description library + libcomerr is an attempt to present a common error-handling mechanism to + manipulate the most common form of error code in a fashion that does not + have the problems identified with mechanisms commonly in use. +Homepage: http://e2fsprogs.sourceforge.net +Original-Maintainer: Theodore Y. Ts'o + +Package: plymouth +Status: install ok installed +Priority: optional +Section: x11 +Installed-Size: 441 +Maintainer: Ubuntu Developers +Architecture: i386 +Version: 0.8.8-0ubuntu17 +Depends: initramfs-tools, libplymouth2 (= 0.8.8-0ubuntu17), mountall (>= 2.0), upstart (>= 1.11-0ubuntu3), udev (>= 166-0ubuntu4), sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16), libc6 (>= 2.8), libdbus-1-3 (>= 1.1.1), libdrm2 (>= 2.4.25), libtinfo5 +Recommends: plymouth-theme-ubuntu-text | plymouth-theme +Breaks: gdm (<< 3.0.4-0ubuntu11), kdm (<< 4:4.7.1-0ubuntu3), lightdm (<< 0.9.7-0ubuntu2), lubuntu-plymouth-theme (<= 0.4), lxdm (<< 0.4.1-0ubuntu2), ubuntustudio-plymouth-theme (<= 0.38), xubuntu-plymouth-theme (<< 10.04.4) +Conflicts: usplash +Conffiles: + /etc/init/plymouth-ready.conf f8542ccc586a5b63f5b76f68ac4f2f59 + /etc/init/plymouth-shutdown.conf febc1a3763f8e15add963ede4e561a26 + /etc/init/plymouth-stop.conf 03c8ba8289470d71e22fdbfa5859e122 + /etc/init/plymouth.conf 859e01281230eb9a522c99875f4b8b69 + /etc/init/plymouth-log.conf 65d2943a69f455dec3fed43fd7996d76 + /etc/init/plymouth-splash.conf 63b63b446cc981dc4f2fa5772b4b3e93 + /etc/init/plymouth-upstart-bridge.conf dd271be2c476aadd0cd34bc77d95a379 +Description: graphical boot animation and logger - main package + Plymouth is an application that runs very early in the boot process + (even before the root filesystem is mounted!) that provides a graphical + boot animation while the boot process happens in the background. + +Package: upstart +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 1621 +Maintainer: James Hunt +Architecture: i386 +Multi-Arch: foreign +Version: 1.12.1-0ubuntu4 +Replaces: startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job +Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job +Depends: libc6 (>= 2.15), libdbus-1-3 (>= 1.2.16), libjson-c2 (>= 0.10), libnih-dbus1 (>= 1.0.0), libnih1 (>= 1.0.0), libselinux1 (>= 1.32), libudev1 (>= 183), sysvinit-utils, initscripts, mountall, ifupdown (>= 0.6.10ubuntu5), libjson0 (>= 0.10-1.1ubuntu1), debianutils (>= 4) +Suggests: python3, graphviz, bash-completion, upstart-monitor +Breaks: friendly-recovery (<< 0.2.13), libc6 (<< 2.12.1-0ubuntu12) +Conflicts: lxcguest, startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job +Conffiles: + /etc/logrotate.d/upstart 070767086a27883ec119e1dde779a856 + /etc/cron.daily/upstart 761747ebd3d1677620d5af50c9900b13 + /etc/dbus-1/system.d/Upstart.conf 64be74cddb0c74b7d98202b40389784c + /etc/bash_completion.d/upstart 080f7eee4a3f3e5f76197eaa581fb4da + /etc/X11/Xsession.d/99upstart d150fce36cf22f5504e4dbc89b4826e0 + /etc/X11/Xsession.d/00upstart 46b4576b1f2ceffb2450a88d58786b95 + /etc/init/tty5.conf 6d5794f72a1098b008e53e326a6bb5a0 + /etc/init/rc-sysinit.conf a50c045d9390a6e6c43c18b19cd72fe5 + /etc/init/rcS.conf 8533688686f75d7bcf20da5a0d36d94b + /etc/init/flush-early-job-log.conf 09e959647877c39f6490ad29b8a35a28 + /etc/init/wait-for-state.conf 20b85b55c3f1e040fdbbf669afe4d2a1 + /etc/init/shutdown.conf 559659602cefe7e8d3c1e76820f5ae5d + /etc/init/upstart-udev-bridge.conf 2c24bb70877476b5e7016ccf6de745a4 + /etc/init/tty2.conf 0d9326fdda081ac96d92bbc57ff773e4 + /etc/init/failsafe.conf 0b88eeccf6c8fd456e886aa7a76e3291 + /etc/init/rc.conf 3ebc6ddcd00482cfb24ce09a14ded29f + /etc/init/upstart-file-bridge.conf 57ea7ed6cba1f1259ac87410c59237ca + /etc/init/console.conf 8d79b0205f2daffb473604ce53e1dc83 + /etc/init/tty1.conf f42f2298f711147ecf177054294861a7 + /etc/init/control-alt-delete.conf 16e6603524084b63b0f0ca04eb56757e + /etc/init/upstart-socket-bridge.conf 5f3eaca09ee1f03d5d0686ea99f8c051 + /etc/init/tty4.conf 2c78cd865d848bb2674104905151dbe2 + /etc/init/tty3.conf 6608f08adf00a282358a1eeb9bdcf78e + /etc/init/tty6.conf e8ad2f0411614f9c8dc9c4e364763549 + /etc/init/container-detect.conf 6bae6257355ad7322e7263e567817465 + /etc/upstart-xsessions ec9aa92a5c50938479d711daa9ee774a +Description: event-based init daemon + upstart is a replacement for the /sbin/init daemon which handles + starting of tasks and services during boot, stopping them during + shutdown and supervising them while the system is running. +Homepage: http://upstart.ubuntu.com/ +Orig-Maintainer: Steve Langasek + +Package: passwd +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 2250 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Source: shadow +Version: 1:4.1.5.1-1ubuntu9 +Replaces: manpages-tr (<< 1.0.5), manpages-zh (<< 1.5.1-1) +Depends: libc6 (>= 2.8), libpam0g (>= 0.99.7.1), libselinux1 (>= 1.32), libsemanage1 (>= 2.0.3), libpam-modules, debianutils (>= 2.15.2) +Conffiles: + /etc/default/useradd cc9f9a7713ab62a32cd38363d958f396 + /etc/init/passwd.conf ea81baf06e4c358225ce22b786ad9e6a + /etc/cron.daily/passwd db990990933b6f56322725223f13c2bc + /etc/pam.d/chpasswd 9900720564cb4ee98b7da29e2d183cb2 + /etc/pam.d/newusers 1454e29bfa9f2a10836563e76936cea5 + /etc/pam.d/chfn 4d466e00a348ba426130664d795e8afa + /etc/pam.d/passwd eaf2ad85b5ccd06cceb19a3e75f40c63 + /etc/pam.d/chsh a6e9b589e90009334ffd030d819290a6 +Description: change and administer password and group data + This package includes passwd, chsh, chfn, and many other programs to + maintain password and group data. + . + Shadow passwords are supported. See /usr/share/doc/passwd/README.Debian +Homepage: http://pkg-shadow.alioth.debian.org/ +Original-Maintainer: Shadow package maintainers + +Package: libacl1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 75 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: acl +Version: 2.2.52-1 +Depends: libattr1 (>= 1:2.4.46-8), libc6 (>= 2.4) +Pre-Depends: multiarch-support +Conflicts: acl (<< 2.0.0), libacl1-kerberos4kth +Description: Access control list shared library + This package contains the libacl.so dynamic library containing + the POSIX 1003.1e draft standard 17 functions for manipulating + access control lists. +Original-Maintainer: Anibal Monsalve Salazar +Homepage: http://savannah.nongnu.org/projects/acl/ + +Package: libslang2 +Status: install ok installed +Priority: important +Section: libs +Installed-Size: 1244 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: slang2 +Version: 2.2.4-16ubuntu1 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Recommends: libpng12-0 +Description: S-Lang programming library - runtime version + S-Lang is a C programmer's library that includes routines for the rapid + development of sophisticated, user friendly, multi-platform applications. + . + This package contains only the shared library libslang.so.* and copyright + information. It is only necessary for programs that use this library (such + as jed and slrn). If you plan on doing development with S-Lang, you will + need the companion -dev package as well. +Homepage: http://www.jedsoft.org/slang/ +Original-Maintainer: Alastair McKinstry + +Package: initscripts +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 219 +Maintainer: Ubuntu Core Developers +Architecture: i386 +Multi-Arch: foreign +Source: sysvinit +Version: 2.88dsf-41ubuntu6 +Replaces: libc0.1, libc0.3, libc6, libc6.1 +Depends: libc6 (>= 2.4), mount (>= 2.11x-1), debianutils (>= 4), lsb-base (>= 3.2-14), sysvinit-utils (>= 2.86.ds1-64), sysv-rc | file-rc, coreutils (>= 5.93), passwd, upstart, mountall (>= 2.28) +Recommends: psmisc, e2fsprogs +Breaks: aide (<< 0.15.1-5), atm-tools (<< 1:2.5.1-1.3), bootchart (<< 0.10~svn407-3.3), console-common (<< 0.7.86), cruft (<< 0.9.16), eepc-acpi-scripts (<< 1.1.12), fcheck (<< 2.7.59-16), hostapd (<< 1:0.7.3-3), hostname (<< 2.95ubuntu1~boot2), ifupdown (<< 0.6.8ubuntu27), libpam-mount (<< 2.13-1), ltsp-client-core (<< 5.2.16-1), mdadm (<< 3.2.2-1), nbd-client (<< 1:2.9.23-1), nfs-common (<< 1:1.2.5-3), portmap (<< 6.0.0-2), readahead-fedora (<< 2:1.5.6-3), resolvconf (<< 1.49), rpcbind (<< 0.2.0-7), rsyslog (<< 5.8.2-2), selinux-policy-default (<= 2:0.2.20100524-9), splashy (<< 0.3.13-5.1+b1), sysklogd (<< 1.5-6.2), udev (<< 146-2~boot6), upstart (<< 0.6.3-2~boot4), wpasupplicant (<< 0.7.3-4), xymon (<< 4.3.0~beta2.dfsg-9) +Conflicts: libdevmapper1.02.1 (<< 2:1.02.24-1) +Conffiles: + /etc/init.d/halt 6ae1b3b1b8198567a5e32116077f12a2 + /etc/init.d/killprocs 5e404d35091fab6c4889302736ed4602 + /etc/init.d/ondemand 63d57b1f5df759ddea8ef193094c118a + /etc/init.d/rc.local 18cd07959adfa8411ca17fe7c2ec3d96 + /etc/init.d/reboot 1b9db1ef7bfd79b128ef85d5065721a6 + /etc/init.d/sendsigs 8376da0c226dcc989f6829230b1d5b50 + /etc/init.d/single dc13cb373c5c098a8fb95424701373e3 + /etc/init.d/umountfs 07e4c8c8d9136f36745feb4776edc6f4 + /etc/init.d/umountnfs.sh b369d5215733f79ee2bf58cc966c5931 + /etc/init.d/umountroot 677b1eb8358469b50044663bfbee5699 + /etc/init.d/urandom e6454386bfce38efb5987dd06cb3b21d + /etc/default/devpts fc857c5ac5fb84d80720ed4d1c624f6e + /etc/default/halt 18d9844cf8ca8608e2a559a4555e593a + /etc/default/rcS db3696fc6caa33a1d72b33fa3cec7c42 +Description: scripts for initializing and shutting down the system + The scripts in this package initialize a standard Debian + system at boot time and shut it down at halt or reboot time. +Homepage: http://savannah.nongnu.org/projects/sysvinit +Original-Maintainer: Debian sysvinit maintainers + +Package: libblkid1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 254 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: util-linux +Version: 2.20.1-5.1ubuntu20 +Depends: libc6 (>= 2.7), libuuid1 (>= 2.16) +Pre-Depends: multiarch-support +Conffiles: + /etc/blkid.conf 7f4c49e01e0a23d2f4b20eeb32e95abb +Description: block device id library + The blkid library which allows system programs like fsck and + mount to quickly and easily find block devices by filesystem UUID and + LABEL. This allows system administrators to avoid specifying + filesystems by hard-coded device names, but via a logical naming + system instead. +Homepage: http://userweb.kernel.org/~kzak/util-linux/ +Original-Maintainer: LaMont Jones + +Package: libss2 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 110 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: e2fsprogs +Version: 1.42.9-3ubuntu1 +Replaces: e2fsprogs (<< 1.34-1) +Depends: libcomerr2, libc6 (>= 2.17) +Pre-Depends: multiarch-support +Description: command-line interface parsing library + libss provides a simple command-line interface parser which will + accept input from the user, parse the command into an argv argument + vector, and then dispatch it to a handler function. + . + It was originally inspired by the Multics SubSystem library. +Homepage: http://e2fsprogs.sourceforge.net +Original-Maintainer: Theodore Y. Ts'o + +Package: libsemanage-common +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 56 +Maintainer: Ubuntu Developers +Architecture: all +Multi-Arch: foreign +Source: libsemanage +Version: 2.2-1ubuntu1 +Replaces: libsemanage1 (<= 2.0.41-1), libsemanage1-dev (<< 2.1.6-3~) +Breaks: libsemanage1 (<= 2.0.41-1), libsemanage1-dev (<< 2.1.6-3~) +Conffiles: + /etc/selinux/semanage.conf e69d42a4d98a93c3b8e201bdda367c55 +Description: Common files for SELinux policy management libraries + This package provides the common files used by the shared libraries + for SELinux policy management. + . + Security-enhanced Linux is a patch of the Linux kernel and a + number of utilities with enhanced security functionality designed to + add mandatory access controls to Linux. The Security-enhanced Linux + kernel contains new architectural components originally developed to + improve the security of the Flask operating system. These + architectural components provide general support for the enforcement + of many kinds of mandatory access control policies, including those + based on the concepts of Type Enforcement, Role-based Access + Control, and Multi-level Security. +Original-Maintainer: Debian SELinux maintainers +Homepage: http://userspace.selinuxproject.org/ + +Package: libpam-modules-bin +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 212 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Source: pam +Version: 1.1.8-1ubuntu2 +Replaces: libpam-modules (<< 1.1.3-8) +Depends: libaudit1 (>= 1:2.2.1), libc6 (>= 2.4), libpam0g (>= 0.99.7.1), libselinux1 (>= 1.32) +Description: Pluggable Authentication Modules for PAM - helper binaries + This package contains helper binaries used by the standard set of PAM + modules in the libpam-modules package. +Homepage: http://pam.sourceforge.net/ +Original-Maintainer: Steve Langasek + +Package: findutils +Essential: yes +Status: install ok installed +Priority: required +Section: utils +Installed-Size: 668 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 4.4.2-8 +Pre-Depends: libc6 (>= 2.17) +Suggests: mlocate | locate +Description: utilities for finding files--find, xargs + GNU findutils provides utilities to find files meeting specified + criteria and perform various actions on the files which are found. + This package contains 'find' and 'xargs'; however, 'locate' has + been split off into a separate package. +Original-Maintainer: Andreas Metzler +Homepage: http://savannah.gnu.org/projects/findutils/ + +Package: e2fsprogs +Essential: yes +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 2424 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 1.42.9-3ubuntu1 +Replaces: hurd (<= 20040301-1), libblkid1 (<< 1.38+1.39-WIP-2005.12.10-2), libuuid1 (<< 1.38+1.39-WIP-2005.12.10-2) +Pre-Depends: e2fslibs (= 1.42.9-3ubuntu1), libblkid1 (>= 2.17.2), libc6 (>= 2.11), libcomerr2 (>= 1.42~WIP-2011-10-05-1), libss2 (>= 1.34-1), libuuid1 (>= 2.16), util-linux (>= 2.15~rc1-1) +Suggests: gpart, parted, e2fsck-static +Conflicts: dump (<< 0.4b4-4), initscripts (<< 2.85-4), quota (<< 1.55-8.1), sysvinit (<< 2.85-4) +Conffiles: + /etc/mke2fs.conf e2cdbf0620e93949af5857eb4739f949 +Description: ext2/ext3/ext4 file system utilities + The ext2, ext3 and ext4 file systems are successors of the original ext + ("extended") file system. They are the main file system types used for + hard disks on Debian and other Linux systems. + . + This package contains programs for creating, checking, and maintaining + ext2/3/4-based file systems. It also includes the "badbocks" program, + which can be used to scan for bad blocks on a disk or other storage device. +Homepage: http://e2fsprogs.sourceforge.net +Original-Maintainer: Theodore Y. Ts'o + +Package: liblzma5 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 316 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: xz-utils +Version: 5.1.1alpha+20120614-2ubuntu2 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Description: XZ-format compression library + XZ is the successor to the Lempel-Ziv/Markov-chain Algorithm + compression format, which provides memory-hungry but powerful + compression (often better than bzip2) and fast, easy decompression. + . + The native format of liblzma is XZ; it also supports raw (headerless) + streams and the older LZMA format used by lzma. (For 7-Zip's related + format, use the p7zip package instead.) +Homepage: http://tukaani.org/xz/ +Original-Maintainer: Jonathan Nieder + +Package: libnih1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 147 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: libnih +Version: 1.0.3-4ubuntu25 +Pre-Depends: multiarch-support, libc6 (>= 2.15~) +Description: NIH Utility Library + libnih is a light-weight "standard library" of C functions to ease the + development of other libraries and applications, especially those + normally found in /lib. + . + This package contains the shared library. +Homepage: https://launchpad.net/libnih +Original-Maintainer: Scott James Remnant + +Package: libaudit1 +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 143 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: audit +Version: 1:2.3.2-2ubuntu1 +Depends: libaudit-common (= 1:2.3.2-2ubuntu1), libc6 (>= 2.8) +Pre-Depends: multiarch-support +Description: Dynamic library for security auditing + The audit-libs package contains the dynamic libraries needed for + applications to use the audit framework. It is used to monitor systems for + security related events. +Homepage: http://people.redhat.com/sgrubb/audit/ +Original-Maintainer: Debian QA Group + +Package: libdb5.3 +Status: install ok installed +Priority: standard +Section: libs +Installed-Size: 1788 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: db5.3 +Version: 5.3.28-3ubuntu3 +Depends: libc6 (>= 2.17) +Pre-Depends: multiarch-support +Description: Berkeley v5.3 Database Libraries [runtime] + This is the runtime package for programs that use the v5.3 Berkeley + database library. +Homepage: http://www.oracle.com/technology/software/products/berkeley-db/index.html +Original-Maintainer: Debian Berkeley DB Group + +Package: insserv +Status: install ok installed +Priority: optional +Section: misc +Installed-Size: 182 +Maintainer: Ubuntu Developers +Architecture: i386 +Version: 1.14.0-5ubuntu2 +Depends: libc6 (>= 2.7) +Suggests: bootchart2 +Breaks: sysv-rc (<< 2.87dsf-3) +Conffiles: + /etc/insserv.conf 3e9467113029a6356f57842085f3c849 + /etc/bash_completion.d/insserv 32975fe14795d6fce1408d5fd22747fd +Description: boot sequence organizer using LSB init.d script dependency information + The insserv program is used by the standard SysV-based init system. It + updates the order of symlinks in /etc/rc?.d/ based on dependencies + specified by LSB headers in the init.d scripts themselves. + . + These declared relations between scripts make it possible to optimize + the boot sequence for the currently installed set of packages, while + detecting and rejecting dependency loops. + . + Using insserv incorrectly can result in an unbootable system. +Homepage: http://savannah.nongnu.org/projects/sysvinit +Original-Maintainer: Petter Reinholdtsen + +Package: dpkg +Essential: yes +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 6327 +Origin: debian +Maintainer: Ubuntu Developers +Bugs: debbugs://bugs.debian.org +Architecture: i386 +Multi-Arch: foreign +Version: 1.17.9ubuntu1 +Replaces: manpages-it (<< 2.80-4) +Pre-Depends: libbz2-1.0, libc6 (>= 2.11), liblzma5 (>= 5.1.1alpha+20120614), libselinux1 (>= 2.1.0), zlib1g (>= 1:1.1.4), tar (>= 1.23) +Suggests: apt +Breaks: apt (<< 0.7.7), aptitude (<< 0.4.7-1), dpkg-dev (<< 1.15.8), libdpkg-perl (<< 1.15.8) +Conflicts: ada-reference-manual (<< 20021112web-4), asn1-mode (<< 2.7-7), bogosort (<< 0.4.2-3), cl-yacc (<< 0.3-3), cpp-4.1-doc (<< 4.1.2.nf2-4), cpp-4.2-doc (<< 4.2.4.nf1-4), gcc-4.1-doc (<< 4.1.2.nf2-4), gcc-4.2-doc (<< 4.2.4.nf1-4), gcj-4.1-doc (<< 4.1.2.nf2-4), gcj-4.2-doc (<< 4.2.4.nf1-4), gfortran-4.1-doc (<< 4.1.2.nf2-4), gfortran-4.2-doc (<< 4.2.4.nf1-4), ggz-docs (<< 0.0.14.1-2), glame (<< 2.0.1-6), gnat-4.1-doc (<< 4.1.2.nf2-4), gnat-4.2-doc (<< 4.2.4.nf1-4), gtalk (<< 0.99.10-16), libalogg-dev (<< 1.3.7-2), libgtk1.2-doc (<< 1.2.10-19), libnettle-dev (<< 2), liborbit-dev (<< 0.5.17-12), libreadline5-dev (<< 5.2-8), librep-doc (<< 0.90), mmucl (<< 1.5.2-3), nxml-mode (<< 20041004-9), r6rs-doc (<< 1.0-2), serveez-doc (<< 0.1.5-3), slat (<< 2.0-6), texlive-base-bin-doc (<< 2007.dfsg.2-9), ttcn-el (<< 0.6.9-2), ulog-acctd (<< 0.4.3-3), xconq-doc (<< 7.4.1-5), zenirc (<< 2.112.dfsg-1) +Conffiles: + /etc/alternatives/README 69c4ba7f08363e998e0f2e244a04f881 + /etc/logrotate.d/dpkg 782ea5ae536f67ff51dc8c3e2eeb4cf9 + /etc/dpkg/dpkg.cfg f4413ffb515f8f753624ae3bb365b81b + /etc/cron.daily/dpkg 2712ab0dc801324ea632a0f1f82cd38c +Description: Debian package management system + This package provides the low-level infrastructure for handling the + installation and removal of Debian software packages. + . + For Debian package development tools, install dpkg-dev. +Homepage: https://wiki.debian.org/Teams/Dpkg +Original-Maintainer: Dpkg Developers + +Package: libpcre3 +Status: install ok installed +Priority: important +Section: libs +Installed-Size: 595 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: pcre3 +Version: 1:8.31-5ubuntu1 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Breaks: approx (<< 4.4-1~), cduce (<< 0.5.3-2~), cmigrep (<< 1.5-7~), galax (<< 1.1-7~), libpcre-ocaml (<< 6.0.1~), liquidsoap (<< 0.9.2-3~), ocsigen (<< 1.3.3-1~) +Conflicts: libpcre3-dev (<= 4.3-3) +Description: Perl 5 Compatible Regular Expression Library - runtime files + This is a library of functions to support regular expressions whose syntax + and semantics are as close as possible to those of the Perl 5 language. + . + This package contains the runtime libraries. +Original-Maintainer: Mark Baker + +Package: libncursesw5 +Status: install ok installed +Priority: important +Section: libs +Installed-Size: 378 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: ncurses +Version: 5.9+20140118-1ubuntu1 +Depends: libtinfo5 (= 5.9+20140118-1ubuntu1), libc6 (>= 2.15) +Pre-Depends: multiarch-support +Recommends: libgpm2 +Description: shared libraries for terminal handling (wide character support) + The ncurses library routines are a terminal-independent method of + updating character screens with reasonable optimization. + . + This package contains the shared libraries necessary to run programs + compiled with ncursesw, which includes support for wide characters. +Homepage: http://invisible-island.net/ncurses/ +Original-Maintainer: Craig Small + +Package: busybox-initramfs +Status: install ok installed +Priority: optional +Section: shells +Installed-Size: 357 +Maintainer: Ubuntu Developers +Architecture: i386 +Source: busybox +Version: 1:1.22.0-5ubuntu1 +Depends: libc6 (>= 2.11) +Description: Standalone shell setup for initramfs + BusyBox combines tiny versions of many common UNIX utilities into a single + small executable. It provides minimalist replacements for the most common + utilities you would usually find on your desktop system (i.e., ls, cp, mv, + mount, tar, etc.). The utilities in BusyBox generally have fewer options than + their full-featured GNU cousins; however, the options that are included + provide the expected functionality and behave very much like their GNU + counterparts. + . + busybox-initramfs provides a simple stand alone shell that provides + only the basic utilities needed for the initramfs. +Homepage: http://www.busybox.net +Original-Maintainer: Debian Install System Team + +Package: libbz2-1.0 +Status: install ok installed +Priority: important +Section: libs +Installed-Size: 116 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: bzip2 +Version: 1.0.6-5 +Depends: libc6 (>= 2.4) +Pre-Depends: multiarch-support +Description: high-quality block-sorting file compressor library - runtime + This package contains libbzip2 which is used by the bzip2 compressor. + . + bzip2 is a freely available, patent free, high-quality data compressor. + It typically compresses files to within 10% to 15% of the best available + techniques, whilst being around twice as fast at compression and six + times faster at decompression. + . + bzip2 compresses files using the Burrows-Wheeler block-sorting text + compression algorithm, and Huffman coding. Compression is generally + considerably better than that achieved by more conventional + LZ77/LZ78-based compressors, and approaches the performance of the PPM + family of statistical compressors. + . + The archive file format of bzip2 (.bz2) is incompatible with that of its + predecessor, bzip (.bz). +Original-Maintainer: Anibal Monsalve Salazar +Homepage: http://www.bzip.org/ + +Package: libtinfo5 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 433 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: ncurses +Version: 5.9+20140118-1ubuntu1 +Replaces: libncurses5 (<< 5.9-3) +Depends: libc6 (>= 2.15) +Pre-Depends: multiarch-support +Breaks: dialog (<< 1.2-20130523) +Description: shared low-level terminfo library for terminal handling + The ncurses library routines are a terminal-independent method of + updating character screens with reasonable optimization. + . + This package contains the shared low-level terminfo library. +Homepage: http://invisible-island.net/ncurses/ +Original-Maintainer: Craig Small + +Package: sysvinit-utils +Status: install ok installed +Priority: required +Section: admin +Installed-Size: 232 +Maintainer: Ubuntu Core Developers +Architecture: i386 +Multi-Arch: foreign +Source: sysvinit +Version: 2.88dsf-41ubuntu6 +Replaces: last, sysvinit (<= 2.86.ds1-65) +Depends: libc6 (>= 2.15), libselinux1 (>= 1.32), sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16) +Recommends: upstart (>= 0.6.3-4) +Suggests: bootlogd, sash +Breaks: upstart (<< 1.5-0ubuntu5) +Conflicts: chkconfig (<< 11.0-79.1-2), last, sysvconfig +Conffiles: + /etc/init/startpar-bridge.conf d220afa75514468471c42469967341d2 +Description: System-V-like utilities + This package contains the important System-V-like utilities. + . + Specifically, this package includes: + killall5, last, lastb, mesg, pidof, service, sulogin +Homepage: http://savannah.nongnu.org/projects/sysvinit +Original-Maintainer: Debian sysvinit maintainers + +Package: multiarch-support +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 201 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Source: eglibc +Version: 2.19-0ubuntu6 +Depends: libc6 (>= 2.13-5) +Description: Transitional package to ensure multiarch compatibility + This is a transitional package used to ensure multiarch support is present + in ld.so before unpacking libraries to the multiarch directories. It can + be removed once nothing on the system depends on it. +Homepage: http://www.eglibc.org +Original-Maintainer: GNU Libc Maintainers + +Package: libjson0 +Status: install ok installed +Priority: extra +Section: oldlibs +Installed-Size: 29 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: json-c +Version: 0.11-4ubuntu1 +Depends: libjson-c2 +Description: JSON manipulation library (transitional package) + This is a transition package that can be safely removed once no + package depend on it. +Homepage: https://github.com/json-c/json-c/wiki +Original-Maintainer: fabien boucher + +Package: libnih-dbus1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 65 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: libnih +Version: 1.0.3-4ubuntu25 +Depends: libnih1 (= 1.0.3-4ubuntu25), libc6 (>= 2.3.4), libdbus-1-3 (>= 1.2.16) +Pre-Depends: multiarch-support +Description: NIH D-Bus Bindings Library + libnih-dbus is a D-Bus bindings library that integrates with the main + loop provided by libnih. + . + This package contains the shared library. +Homepage: https://launchpad.net/libnih +Original-Maintainer: Scott James Remnant + +Package: libselinux1 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 192 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: libselinux +Version: 2.2.2-1ubuntu1 +Depends: libc6 (>= 2.8), libpcre3 +Pre-Depends: multiarch-support +Description: SELinux runtime shared libraries + This package provides the shared libraries for Security-enhanced + Linux that provides interfaces (e.g. library functions for the + SELinux kernel APIs like getcon(), other support functions like + getseuserbyname()) to SELinux-aware applications. Security-enhanced + Linux is a patch of the Linux kernel and a number of utilities with + enhanced security functionality designed to add mandatory access + controls to Linux. The Security-enhanced Linux kernel contains new + architectural components originally developed to improve the security + of the Flask operating system. These architectural components provide + general support for the enforcement of many kinds of mandatory access + control policies, including those based on the concepts of Type + Enforcement, Role-based Access Control, and Multi-level Security. + . + libselinux1 provides an API for SELinux applications to get and set + process and file security contexts and to obtain security policy + decisions. Required for any applications that use the SELinux + API. libselinux may use the shared libsepol to manipulate the binary + policy if necessary (e.g. to downgrade the policy format to an older + version supported by the kernel) when loading policy. +Homepage: http://userspace.selinuxproject.org/ +Original-Maintainer: Debian SELinux maintainers + +Package: libaudit-common +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 44 +Maintainer: Ubuntu Developers +Architecture: all +Multi-Arch: foreign +Source: audit +Version: 1:2.3.2-2ubuntu1 +Replaces: libaudit0, libaudit1 (<< 1:2.2.1-2) +Breaks: libaudit0, libaudit1 (<< 1:2.2.1-2) +Conffiles: + /etc/libaudit.conf cdc703f9d27f0d980271a9e95d0f18b2 +Description: Dynamic library for security auditing - common files + The audit-libs package contains the dynamic libraries needed for + applications to use the audit framework. It is used to monitor systems for + security related events. + . + This package contains the libaudit.conf configuration file and the associated + manpage. +Homepage: http://people.redhat.com/sgrubb/audit/ +Original-Maintainer: Debian QA Group + +Package: libc6 +Status: install ok installed +Priority: required +Section: libs +Installed-Size: 9254 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: eglibc +Version: 2.19-0ubuntu6 +Replaces: libc6-i386, libc6-xen +Provides: glibc-2.19-1, libc6-i686, libc6-xen +Depends: libgcc1 +Suggests: glibc-doc, debconf | debconf-2.0, locales +Breaks: hurd (<< 1:0.5.git20140203-1), nscd (<< 2.19) +Conflicts: libc6-xen, prelink (<= 0.0.20090311-1), tzdata (<< 2007k-1), tzdata-etch +Conffiles: + /etc/ld.so.conf.d/i686-linux-gnu.conf 1c63da36f33ec6647af1d8faff9b9795 +Description: Embedded GNU C Library: Shared libraries + Contains the standard libraries that are used by nearly all programs on + the system. This package includes shared versions of the standard C library + and the standard math library, as well as many others. +Homepage: http://www.eglibc.org +Original-Maintainer: GNU Libc Maintainers + +Package: libpng12-0 +Status: install ok installed +Priority: optional +Section: libs +Installed-Size: 308 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: same +Source: libpng +Version: 1.2.50-1ubuntu2 +Replaces: libpng12-dev (<= 1.2.8rel-7) +Depends: libc6 (>= 2.11), zlib1g (>= 1:1.1.4) +Pre-Depends: multiarch-support +Conflicts: libpng12-dev (<= 1.2.8rel-7), mzscheme (<= 1:209-5), pngcrush (<= 1.5.10-2), pngmeta (<= 1.11-3), povray-3.5 (<= 3.5.0c-10), qemacs (<= 0.3.1-5) +Description: PNG library - runtime + libpng is a library implementing an interface for reading and writing + PNG (Portable Network Graphics) format files. + . + This package contains the runtime library files needed to run software + using libpng. +Homepage: http://libpng.org/pub/png/libpng.html +Original-Maintainer: Anibal Monsalve Salazar + +Package: udev +Status: install ok installed +Priority: important +Section: admin +Installed-Size: 5119 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Source: systemd +Version: 204-10ubuntu1 +Depends: libacl1 (>= 2.2.51-8), libblkid1 (>= 2.19.1), libc6 (>= 2.17), libcgmanager0, libdbus-1-3 (>= 1.0.2), libkmod2 (>= 5~), libnih-dbus1 (>= 1.0.0), libnih1 (>= 1.0.0), libselinux1 (>= 2.0.65), libudev1 (= 204-10ubuntu1), sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16), lsb-base (>= 3.0-6), util-linux (>= 2.16), procps +Pre-Depends: debconf (>= 1.4.69) | debconf-2.0 +Breaks: consolekit (<< 0.4.6-1) +Conffiles: + /etc/udev/udev.conf ae415f84e2967eff580089fb08aa0a61 + /etc/init.d/udev b1cab2570af69ccbf49a208799af6247 + /etc/init.d/udev-finish 6eac2544228b88cbe8cede182082f46a + /etc/init/udev-fallback-graphics.conf b8bfe7164e10cd0e53494b243c5728b1 + /etc/init/udevtrigger.conf 651ff2421dde80be7ce7ccbf7fa8cf18 + /etc/init/udev-finish.conf 5c953c5b98ccfbb2a02985bfa2f80aed + /etc/init/udev.conf 41c0081f3a830e0902aaff76a53edf98 + /etc/init/udevmonitor.conf b541dfb5aa4958e9a5336ecaec00ca15 + /etc/modprobe.d/fbdev-blacklist.conf 01cd03c88ce6821c03baf904f7dfcbd0 + /etc/udev/rules.d/README 3b6de9f3f911176734c66903b4f8735c obsolete +Description: /dev/ and hotplug management daemon + udev is a daemon which dynamically creates and removes device nodes from + /dev/, handles hotplug events and loads drivers at boot time. +Homepage: http://www.freedesktop.org/wiki/Software/systemd +Original-Maintainer: Debian systemd Maintainers + +Package: util-linux +Essential: yes +Status: install ok installed +Priority: required +Section: utils +Installed-Size: 1554 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 2.20.1-5.1ubuntu20 +Replaces: e2fsprogs, fdisk, fstrim, linux32, miscutils, schedutils, setterm, sparc-utils +Provides: linux32, schedutils +Depends: lsb-base (>= 3.0-6), tzdata (>= 2006c-2), dpkg (>= 1.15.4) | install-info, debconf (>= 0.5) | debconf-2.0, sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16) +Pre-Depends: libblkid1 (>= 2.20.1), libc6 (>= 2.15), libncurses5 (>= 5.5-5~), libselinux1 (>= 1.32), libslang2 (>= 2.2.4), libtinfo5, libuuid1 (>= 2.16), zlib1g (>= 1:1.1.4) +Suggests: util-linux-locales, kbd | console-tools, dosfstools +Conflicts: console-tools (<< 1:0.2.3-21), fdisk, fstrim, kbd (<< 1.05-3), linux32, schedutils, setterm +Conffiles: + /etc/cron.weekly/fstrim 4de5cd1aac392609593296f0d81e7595 + /etc/init/hwclock.conf 132aa3db7e5a8cf55168e4866052208a + /etc/init/hwclock-save.conf 4a002046525e338fc23e4418602865c9 +Description: Miscellaneous system utilities + This package contains a number of important utilities, most of which + are oriented towards maintenance of your system. Some of the more + important utilities included in this package allow you to partition + your hard disk, view kernel messages, and create new filesystems. +Homepage: http://userweb.kernel.org/~kzak/util-linux/ +Original-Maintainer: LaMont Jones + +Package: cpio +Status: install ok installed +Priority: important +Section: utils +Installed-Size: 312 +Maintainer: Ubuntu Developers +Architecture: i386 +Multi-Arch: foreign +Version: 2.11+dfsg-2ubuntu1 +Replaces: cpio-mt +Depends: libc6 (>= 2.17) +Suggests: libarchive1 +Conflicts: cpio-mt, mt-st (<< 0.6) +Description: GNU cpio -- a program to manage archives of files + GNU cpio is a tool for creating and extracting archives, or copying + files from one place to another. It handles a number of cpio formats + as well as reading and writing tar files. +Homepage: http://www.gnu.org/software/cpio/ +Original-Maintainer: Anibal Monsalve Salazar + diff --git a/test/integration/test-bug-lp1347721-dpkg-ordering b/test/integration/test-bug-lp1347721-dpkg-ordering new file mode 100755 index 000000000..cfe7a4df2 --- /dev/null +++ b/test/integration/test-bug-lp1347721-dpkg-ordering @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" +setupaptarchive + +# ensure we find a valid ordering +testsuccess aptget dist-upgrade -s -- cgit v1.2.3 From e05672e88678f520b2db59599e939345ad0b6e53 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 31 Jul 2014 09:53:13 +0200 Subject: Rework TransactionID stuff --- test/integration/test-apt-update-rollback | 180 ++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100755 test/integration/test-apt-update-rollback (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback new file mode 100755 index 000000000..cd28f1f1f --- /dev/null +++ b/test/integration/test-apt-update-rollback @@ -0,0 +1,180 @@ +#!/bin/sh +# +# test that apt-get update is transactional +# +set -e + +avoid_ims_hit() { + touch -d '+1hour' aptarchive/dists/unstable/main/binary-i386/Packages* + touch -d '+1hour' aptarchive/dists/unstable/main/source/Sources* + touch -d '+1hour' aptarchive/dists/unstable/*Release* + + touch -d '-1hour' rootdir/var/lib/apt/lists/* +} + +create_fresh_archive() +{ + rm -rf aptarchive/* + rm -f rootdir/var/lib/apt/lists/_* rootdir/var/lib/apt/lists/partial/* + + insertpackage 'unstable' 'old' 'all' '1.0' + + setupaptarchive +} + +add_new_package() { + insertpackage "unstable" "new" "all" "1.0" + insertsource "unstable" "new" "all" "1.0" + + setupaptarchive --no-update + + avoid_ims_hit +} + +break_repository_sources_index() { + printf "xxx" > $APTARCHIVE/dists/unstable/main/source/Sources + gzip -c $APTARCHIVE/dists/unstable/main/source/Sources > \ + $APTARCHIVE/dists/unstable/main/source/Sources.gz + avoid_ims_hit +} + +test_inrelease_to_new_inrelease() { + msgmsg "Test InRelease to new InRelease works fine" + create_fresh_archive + testequal "old/unstable 1.0 all" apt list -q + + add_new_package + testsuccess aptget update + + testequal "new/unstable 1.0 all +old/unstable 1.0 all" apt list -q +} + +test_inrelease_to_broken_hash_reverts_all() { + msgmsg "Test InRelease to broken InRelease reverts everything" + create_fresh_archive + add_new_package + # break the Sources file + break_repository_sources_index + + # test the error condition + testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease + +W: Failed to fetch copy:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch + +W: Failed to fetch copy:${APTARCHIVE}/dists/unstable/main/binary-i386/Packages + +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + # ensure that the Packages file is also rolled back + testequal "E: Unable to locate package new" aptget install new -s -qq +} + +test_inreleae_to_valid_release() { + msgmsg "Test InRelease to valid Release" + create_fresh_archive + add_new_package + # switch to a unsinged repo now + rm $APTARCHIVE/dists/unstable/InRelease + rm $APTARCHIVE/dists/unstable/Release.gpg + avoid_ims_hit + + # update works + testsuccess aptget update -o Debug::Acquire::Transaction=1 + + # test that we can install the new packages but do no longer have a sig + testsuccess aptget install old -s + testsuccess aptget install new -s + testfailure ls $ROOTDIR/var/lib/apt/lists/*_InRelease + testfailure ls $ROOTDIR/var/lib/apt/lists/*_Release.gpg + testsuccess ls $ROOTDIR/var/lib/apt/lists/*_Release +} + +test_inreleae_to_release_reverts_all() { + msgmsg "Test InRelease to broken Release reverts everything" + create_fresh_archive + + # switch to a unsinged repo now + add_new_package + rm $APTARCHIVE/dists/unstable/InRelease + rm $APTARCHIVE/dists/unstable/Release.gpg + # break it + break_repository_sources_index + + # ensure error + testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease + +W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release + +W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release.gpg + +W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch + +W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/binary-i386/Packages + +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # -o Debug::acquire::transaction=1 + + # ensure that the Packages file is also rolled back + testsuccess aptget install old -s + testfailure aptget install new -s + testsuccess ls $ROOTDIR/var/lib/apt/lists/*_InRelease + testfailure ls $ROOTDIR/var/lib/apt/lists/*_Release +} + +test_unauthenticated_to_invalid_inrelease() { + msgmsg "Test UnAuthenticated to invalid InRelease reverts everything" + create_fresh_archive + rm $APTARCHIVE/dists/unstable/InRelease + rm $APTARCHIVE/dists/unstable/Release.gpg + avoid_ims_hit + + testsuccess aptget update -qq + testequal "WARNING: The following packages cannot be authenticated! + old +E: There are problems and -y was used without --force-yes" aptget install -qq -y old + + # go to authenticated but not correct + add_new_package + break_repository_sources_index + + testequal "W: Hashsum mismatch $ROOTDIR/var/lib/apt/lists/${APTARCHIVE_LISTS}_dists_unstable_main_source_Sources +W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease + +W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch + +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + + testfailure ls rootdir/var/lib/apt/lists/*_InRelease + testequal "WARNING: The following packages cannot be authenticated! + old +E: There are problems and -y was used without --force-yes" aptget install -qq -y old +} + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# setup the archive and ensure we have a single package that installs fine +setupaptarchive +APTARCHIVE=$(readlink -f ./aptarchive) +ROOTDIR=${TMPWORKINGDIRECTORY}/rootdir +APTARCHIVE_LISTS="$(echo $APTARCHIVE | tr "/" "_" )" + +# test the following cases: +# - InRelease -> broken InRelease revert to previous state +# - empty lists dir and broken remote leaves nothing on the system +# - InRelease -> hashsum mismatch for one file reverts all files to previous state +# - Release/Release.gpg -> hashsum mismatch +# - InRelease -> Release with hashsum mismatch revert entire state and kills Release +# - Release -> InRelease with broken Sig/Hash removes InRelease +# going from Release/Release.gpg -> InRelease and vice versa +# - unauthenticated -> invalid InRelease + +test_inrelease_to_new_inrelease +test_inrelease_to_broken_hash_reverts_all + +test_inreleae_to_valid_release +test_inreleae_to_release_reverts_all + +#test_unauthenticated_to_invalid_inrelease -- cgit v1.2.3 From 6d979490c13e9d8004942507c99d152c22184a27 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 31 Jul 2014 10:02:27 +0200 Subject: make test_unauthenticated_to_invalid_inrelease work --- test/integration/test-apt-update-rollback | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index cd28f1f1f..9771f0edc 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -136,11 +136,12 @@ E: There are problems and -y was used without --force-yes" aptget install -qq -y add_new_package break_repository_sources_index - testequal "W: Hashsum mismatch $ROOTDIR/var/lib/apt/lists/${APTARCHIVE_LISTS}_dists_unstable_main_source_Sources -W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease - + testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease + W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch +W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/binary-i386/Packages + E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq testfailure ls rootdir/var/lib/apt/lists/*_InRelease @@ -177,4 +178,4 @@ test_inrelease_to_broken_hash_reverts_all test_inreleae_to_valid_release test_inreleae_to_release_reverts_all -#test_unauthenticated_to_invalid_inrelease +test_unauthenticated_to_invalid_inrelease -- cgit v1.2.3 From c5fced388848b967f0ce076656cad5366517f981 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 31 Jul 2014 18:40:05 +0200 Subject: ensure InRelease->Release is transactional as well --- test/integration/test-apt-update-rollback | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index 9771f0edc..c16e4f480 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -150,6 +150,22 @@ E: Some index files failed to download. They have been ignored, or old ones used E: There are problems and -y was used without --force-yes" aptget install -qq -y old } +test_inrelease_to_unauth_inrelease() { + msgmsg "Test InRelease to InRelease without sig" + create_fresh_archive + signreleasefiles 'Marvin Paranoid' + avoid_ims_hit + + testsuccess aptget update -qq + + testequal "WARNING: The following packages cannot be authenticated! + old +E: There are problems and -y was used without --force-yes" aptget install -qq -y old + + testfailure ls rootdir/var/lib/apt/lists/*_InRelease + testsuccess ls rootdir/var/lib/apt/lists/*_Release +} + TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework @@ -179,3 +195,5 @@ test_inreleae_to_valid_release test_inreleae_to_release_reverts_all test_unauthenticated_to_invalid_inrelease + +test_inrelease_to_unauth_inrelease -- cgit v1.2.3 From 21638c3af355b3997fadd169495551568af6acfe Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 31 Jul 2014 19:24:36 +0200 Subject: fail early (again) on gpg sig failures --- test/integration/test-apt-update-rollback | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index c16e4f480..a6297792e 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -156,14 +156,13 @@ test_inrelease_to_unauth_inrelease() { signreleasefiles 'Marvin Paranoid' avoid_ims_hit - testsuccess aptget update -qq + testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 - testequal "WARNING: The following packages cannot be authenticated! - old -E: There are problems and -y was used without --force-yes" aptget install -qq -y old +W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease - testfailure ls rootdir/var/lib/apt/lists/*_InRelease - testsuccess ls rootdir/var/lib/apt/lists/*_Release +W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + + testsuccess ls rootdir/var/lib/apt/lists/*_InRelease } TESTDIR=$(readlink -f $(dirname $0)) -- cgit v1.2.3 From 80976dd5452a9cfbe0c4f6229c729711ba685a5f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 1 Aug 2014 11:06:47 +0200 Subject: mve MetaKey into pkgAcqBaseIndex --- test/integration/test-apt-update-rollback | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index a6297792e..d7078d217 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -44,7 +44,9 @@ test_inrelease_to_new_inrelease() { testequal "old/unstable 1.0 all" apt list -q add_new_package - testsuccess aptget update + aptget update -o Debug::Acquire::Transaction=1 + + testsuccess aptget update -o Debug::Acquire::Transaction=1 testequal "new/unstable 1.0 all old/unstable 1.0 all" apt list -q -- cgit v1.2.3 From 81273628cc3022641756b05e78256d59b7bd7c51 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 1 Aug 2014 11:46:16 +0200 Subject: fix transactionid passing --- test/integration/test-apt-update-rollback | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index d7078d217..4eef2aecf 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -44,7 +44,6 @@ test_inrelease_to_new_inrelease() { testequal "old/unstable 1.0 all" apt list -q add_new_package - aptget update -o Debug::Acquire::Transaction=1 testsuccess aptget update -o Debug::Acquire::Transaction=1 -- cgit v1.2.3 From 7abcfdde365d2f1110b1f1189e3fce04abdac98c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 1 Aug 2014 17:13:15 +0200 Subject: check hashes of compressed files as well --- test/integration/test-apt-update-rollback | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index 4eef2aecf..b8a2b0791 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -61,9 +61,7 @@ test_inrelease_to_broken_hash_reverts_all() { # test the error condition testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease -W: Failed to fetch copy:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch - -W: Failed to fetch copy:${APTARCHIVE}/dists/unstable/main/binary-i386/Packages +W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure that the Packages file is also rolled back @@ -108,9 +106,7 @@ W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release.gpg -W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch - -W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/binary-i386/Packages +W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # -o Debug::acquire::transaction=1 @@ -139,9 +135,7 @@ E: There are problems and -y was used without --force-yes" aptget install -qq -y testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease -W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch - -W: Failed to fetch copy:$APTARCHIVE/dists/unstable/main/binary-i386/Packages +W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq @@ -166,6 +160,19 @@ W: Some index files failed to download. They have been ignored, or old ones used testsuccess ls rootdir/var/lib/apt/lists/*_InRelease } +test_inrelease_to_broken_gzip() { + msgmsg "Test InRelease to broken gzip" + create_fresh_archive + # append junk at the end of the gzip, this + echo "lala" >> $APTARCHIVE/dists/unstable/main/source/Sources.gz + # remove uncompressed file, otherwise apt will just fallback fetching + # that + rm $APTARCHIVE/dists/unstable/main/source/Sources + avoid_ims_hit + + testfailure aptget update +} + TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework @@ -190,10 +197,8 @@ APTARCHIVE_LISTS="$(echo $APTARCHIVE | tr "/" "_" )" test_inrelease_to_new_inrelease test_inrelease_to_broken_hash_reverts_all - test_inreleae_to_valid_release test_inreleae_to_release_reverts_all - test_unauthenticated_to_invalid_inrelease - test_inrelease_to_unauth_inrelease +test_inrelease_to_broken_gzip -- cgit v1.2.3 From 183160cb20cd4aa86e78657bf060bf688edce703 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 1 Aug 2014 17:15:53 +0200 Subject: make errors more consistent --- test/integration/test-apt-update-rollback | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index b8a2b0791..24027787e 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -59,9 +59,7 @@ test_inrelease_to_broken_hash_reverts_all() { break_repository_sources_index # test the error condition - testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease - -W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch + testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure that the Packages file is also rolled back @@ -100,13 +98,7 @@ test_inreleae_to_release_reverts_all() { break_repository_sources_index # ensure error - testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease - -W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release - -W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release.gpg - -W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch + testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # -o Debug::acquire::transaction=1 @@ -133,9 +125,7 @@ E: There are problems and -y was used without --force-yes" aptget install -qq -y add_new_package break_repository_sources_index - testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease - -W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch + testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq -- cgit v1.2.3 From 67f2f9e2ed2f48833926abb7c31cca4a57ebfec1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 1 Aug 2014 17:20:19 +0200 Subject: add gzip test and todo --- test/integration/test-apt-update-rollback | 4 ++++ test/integration/test-hashsum-verification | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index 24027787e..ccd7f57ff 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -185,6 +185,10 @@ APTARCHIVE_LISTS="$(echo $APTARCHIVE | tr "/" "_" )" # going from Release/Release.gpg -> InRelease and vice versa # - unauthenticated -> invalid InRelease +# stuff to do: +# - ims-hit +# - gzip-index tests + test_inrelease_to_new_inrelease test_inrelease_to_broken_hash_reverts_all test_inreleae_to_valid_release diff --git a/test/integration/test-hashsum-verification b/test/integration/test-hashsum-verification index e77efb46e..70bf1b476 100755 --- a/test/integration/test-hashsum-verification +++ b/test/integration/test-hashsum-verification @@ -75,5 +75,13 @@ runtest() { } -runtest - +for COMPRESSEDINDEXES in 'false' 'true'; do + echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes + if $COMPRESSEDINDEXES; then + msgmsg 'Run tests with GzipIndexes enabled' + else + msgmsg 'Run tests with GzipIndexes disabled' + fi + + runtest +done -- cgit v1.2.3 From 63d0f85391839a666957add1833e67f7638c8a83 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 1 Aug 2014 19:25:00 +0200 Subject: make i-m-s work again --- test/integration/test-apt-update-ims | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 test/integration/test-apt-update-ims (limited to 'test') diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims new file mode 100755 index 000000000..cf2b28bb5 --- /dev/null +++ b/test/integration/test-apt-update-ims @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' + +setupaptarchive +changetowebserver + +testsuccess aptget update + +# check that I-M-S header is kept in redirections +testequal "Hit http://localhost:8080 unstable InRelease +Hit http://localhost:8080 unstable/main Sources +Hit http://localhost:8080 unstable/main amd64 Packages +Hit http://localhost:8080 unstable/main Translation-en +Reading package lists..." aptget update + -- cgit v1.2.3 From 63b7249e6930c1bcb69bac32f10108119eeacc2a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 2 Aug 2014 05:37:43 +0200 Subject: add ims check verify --- test/integration/test-apt-update-ims | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index cf2b28bb5..3bd6e843c 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -20,3 +20,6 @@ Hit http://localhost:8080 unstable/main amd64 Packages Hit http://localhost:8080 unstable/main Translation-en Reading package lists..." aptget update +# ensure that we still do a hash check on ims hit +msgtest 'Test I-M-S reverify' +aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A1 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail -- cgit v1.2.3 From 09475bebba5554481a7cb05995ded92cf30063fa Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 24 Aug 2014 21:30:44 -0700 Subject: all tests pass --- test/integration/test-ubuntu-bug-346386-apt-get-update-paywall | 10 +++++----- .../test-ubuntu-bug-784473-InRelease-one-message-only | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall index 8e50843f3..388c2bfdb 100755 --- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -37,8 +37,8 @@ ensure_n_canary_strings_in_dir() { LISTS='rootdir/var/lib/apt/lists' rm -rf rootdir/var/lib/apt/lists -msgtest 'Got expected NODATA failure in' 'apt-get update' -aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail +msgtest 'Got expected failure message' 'apt-get update' +aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 testequal 'partial' ls $LISTS @@ -48,8 +48,8 @@ for f in Release Release.gpg main_binary-amd64_Packages main_source_Sources; do echo 'peng neee-wom' > $LISTS/localhost:8080_dists_stable_${f} done -msgtest 'Got expected NODATA failure in' 'apt-get update' -aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail +msgtest 'Got expected failure message in' 'apt-get update' +aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail ensure_n_canary_strings_in_dir $LISTS 'peng neee-wom' 4 ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 @@ -58,7 +58,7 @@ ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 echo 'peng neee-wom' > $LISTS/localhost:8080_dists_stable_InRelease rm -f $LISTS/localhost:8080_dists_stable_Release $LISTS/localhost:8080_dists_stable_Release.gpg msgtest 'excpected failure of' 'apt-get update' -aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail +aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail ensure_n_canary_strings_in_dir $LISTS 'peng neee-wom' 3 ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 diff --git a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only index 50ca2bf57..09315868b 100755 --- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only +++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only @@ -28,12 +28,10 @@ MD5Sum: done msgtest 'The unsigned garbage before signed block is' 'ignored' -testsuccess --nomsg aptget update +aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail ROOTDIR="$(readlink -f .)" testequal "Package files: 100 ${ROOTDIR}/rootdir/var/lib/dpkg/status release a=now - 500 file:${ROOTDIR}/aptarchive/ unstable/main i386 Packages - release a=unstable,n=sid,c=main Pinned packages:" aptcache policy -- cgit v1.2.3 From 40faab46c4d5fa766c80090f0fdb54120dbb37f2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 16 Aug 2014 16:33:46 +0200 Subject: support versioned provides as implemented by dpkg APT supported versioned provides for a long while in an attempt to get it working with rpm. While this support is old, we can be relatively sure that it works as versioned provides are used internally to make Multi-Arch:foreign work. Previous versions of apt will print a warning indicating that the versioned provides is ignored, so that something which "Provides: foo (= 2)" doesn't provide anything. Note that dpkg does allow only a equals-relation in the provides line as anything else is deemed too complex. apt doesn't support anything else either and such a support would require potentially big changes. Closes: 758153 --- .../test-bug-758153-versioned-provides-support | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100755 test/integration/test-bug-758153-versioned-provides-support (limited to 'test') diff --git a/test/integration/test-bug-758153-versioned-provides-support b/test/integration/test-bug-758153-versioned-provides-support new file mode 100755 index 000000000..2904ae5a1 --- /dev/null +++ b/test/integration/test-bug-758153-versioned-provides-support @@ -0,0 +1,137 @@ +#!/bin/sh +set -e + +# dpkg implements versioned provides in commit 5bb02fe80e9f40dcad9703a72f67cf615ff217b5 +# but previous versions seem to allow parsing, working and ignoring it. + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'webapp' 'all' '1' 'Depends: httpd' +insertinstalledpackage 'webserver' 'all' '1' 'Provides: httpd' + +insertpackage 'unstable' 'webapp' 'all' '2' 'Depends: httpd (>= 2)' +insertpackage 'unstable' 'webserver' 'amd64' '2' 'Provides: httpd (= 2)' +insertpackage 'unstable' 'foreign-webserver' 'i386' '2' 'Multi-Arch: foreign +Provides: httpd (= 2)' + +insertpackage 'experimental' 'webapp' 'all' '3' 'Depends: httpd (>= 1.5)' +insertpackage 'experimental' 'webserver' 'amd64' '3' 'Provides: httpd (= 3)' + +insertpackage 'experimental' 'foreign-webserver' 'i386' '4' 'Multi-Arch: foreign +Provides: httpd (= 4)' +insertpackage 'experimental' 'cool-webapp' 'all' '4' 'Depends: httpd (>= 4)' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + webapp webserver +2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst webserver [1] (2 unstable [amd64]) +Inst webapp [1] (2 unstable [all]) +Conf webserver (2 unstable [amd64]) +Conf webapp (2 unstable [all])' aptget dist-upgrade -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + webapp webserver +2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst webserver [1] (2 unstable [amd64]) +Inst webapp [1] (2 unstable [all]) +Conf webserver (2 unstable [amd64]) +Conf webapp (2 unstable [all])' aptget install webapp webserver -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + webapp webserver +2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst webserver [1] (2 unstable [amd64]) +Inst webapp [1] (3 experimental [all]) +Conf webserver (2 unstable [amd64]) +Conf webapp (3 experimental [all])' aptget install webapp=3 webserver -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + webapp webserver +2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst webserver [1] (3 experimental [amd64]) +Inst webapp [1] (2 unstable [all]) +Conf webserver (3 experimental [amd64]) +Conf webapp (2 unstable [all])' aptget install webapp webserver=3 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foreign-webserver:i386 +The following packages will be upgraded: + webapp +1 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst foreign-webserver:i386 (2 unstable [i386]) +Inst webapp [1] (2 unstable [all]) +Conf foreign-webserver:i386 (2 unstable [i386]) +Conf webapp (2 unstable [all])' aptget install webapp foreign-webserver:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foreign-webserver:i386 +The following packages will be upgraded: + webapp +1 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst foreign-webserver:i386 (2 unstable [i386]) +Inst webapp [1] (3 experimental [all]) +Conf foreign-webserver:i386 (2 unstable [i386]) +Conf webapp (3 experimental [all])' aptget install webapp=3 foreign-webserver:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foreign-webserver:i386 +The following packages will be upgraded: + webapp +1 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst foreign-webserver:i386 (4 experimental [i386]) +Inst webapp [1] (2 unstable [all]) +Conf foreign-webserver:i386 (4 experimental [i386]) +Conf webapp (2 unstable [all])' aptget install webapp foreign-webserver:i386=4 -s + +testequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + cool-webapp : Depends: httpd (>= 4) +E: Unable to correct problems, you have held broken packages.' aptget install cool-webapp -s + +testequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + cool-webapp : Depends: httpd (>= 4) +E: Unable to correct problems, you have held broken packages.' aptget install cool-webapp foreign-webserver:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + cool-webapp foreign-webserver:i386 +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst foreign-webserver:i386 (4 experimental [i386]) +Inst cool-webapp (4 experimental [all]) +Conf foreign-webserver:i386 (4 experimental [i386]) +Conf cool-webapp (4 experimental [all])' aptget install cool-webapp foreign-webserver:i386=4 -s -- cgit v1.2.3 From c6ee61eab54edf6cc3fbe118d304d72a860e1451 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 2 Sep 2014 15:50:19 +0200 Subject: Make Proxy-Auto-Detect check for each host When doing Acquire::http{,s}::Proxy-Auto-Detect, run the auto-detect command for each host instead of only once. This should make using "proxy" from libproxy-tools feasible which can then be used for PAC style or other proxy configurations. Closes: #759264 --- test/integration/test-apt-helper | 80 +++++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index 6505b5956..c749224ca 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -9,31 +9,67 @@ configarchitecture "i386" changetohttpswebserver -echo "foo" > aptarchive/foo +test_apt_helper_download() { + echo "foo" > aptarchive/foo -msgtest 'apt-file download-file md5sum' -apthelper -qq download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail -testfileequal foo2 'foo' + msgtest 'apt-file download-file md5sum' + apthelper -qq download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail + testfileequal foo2 'foo' -msgtest 'apt-file download-file sha1' -apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail -testfileequal foo1 'foo' + msgtest 'apt-file download-file sha1' + apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail + testfileequal foo1 'foo' -msgtest 'apt-file download-file sha256' -apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail -testfileequal foo3 'foo' + msgtest 'apt-file download-file sha256' + apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail + testfileequal foo3 'foo' -msgtest 'apt-file download-file no-hash' -apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail -testfileequal foo4 'foo' - -msgtest 'apt-file download-file wrong hash' -if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then - msgpass -else - msgfail -fi -testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch + msgtest 'apt-file download-file no-hash' + apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail + testfileequal foo4 'foo' + + msgtest 'apt-file download-file wrong hash' + if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then + msgpass + else + msgfail + fi + testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch E: Download Failed' -testfileequal foo5.FAILED 'foo' + testfileequal foo5.FAILED 'foo' +} + +test_apt_helper_detect_proxy() { + # no proxy + testequal "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 + + testequal "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 + + testequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com + + + +} + +test_apt_helper_download +test_apt_helper_detect_proxy + -- cgit v1.2.3 From 6763aaec8ddded31057733f53c63f15e6b949bd9 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Tue, 2 Sep 2014 16:34:05 +0200 Subject: Avoid yielding blank lines with APT::Cmd::use-format=true --- test/integration/test-apt-cli-list | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list index 40bf81a39..aae74c022 100755 --- a/test/integration/test-apt-cli-list +++ b/test/integration/test-apt-cli-list @@ -68,4 +68,7 @@ testequal "Listing... baz/unstable 2.0 all [upgradable from: 0.1] N: There are 2 additional versions. Please use the '-a' switch to see them." apt list baz -o quiet=0 - +# test format strings for machine parseable output +apt list -qq bar baz -o APT::Cmd::use-format=true -o APT::Cmd::format="\${Package} - \${installed:Version} - \${candidate:Version}" > output.txt +testequal "bar - 1.0 - 1.0 +baz - 0.1 - 2.0" cat output.txt -- cgit v1.2.3 From 165760012d624ffcf098e1fd08fecde78f808fa7 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 2 Sep 2014 16:36:32 +0200 Subject: Add testcase for apt list --all-versions Dch-Ignore: true --- test/integration/test-apt-cli-list | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list index aae74c022..1487afd55 100755 --- a/test/integration/test-apt-cli-list +++ b/test/integration/test-apt-cli-list @@ -49,9 +49,11 @@ baz/now 0.1 all [installed,upgradable to: 2.0] foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed testequal "Listing... +bar/now 1.0 i386 [installed,local] + foobar/unstable 2.0 i386 [upgradable from: 1.0] foobar/now 1.0 i386 [installed,upgradable to: 2.0] -" apt list foobar --all-versions +" apt list bar foobar --all-versions testequal "Listing... bar/now 1.0 i386 [installed,local] -- cgit v1.2.3 From 3b5607fc31371190470074371793cb8500b5139e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 3 Sep 2014 16:54:16 +0200 Subject: test/integration/test-ubuntu-bug-346386-apt-get-update-paywall: use downloadfile() --- .../test-ubuntu-bug-346386-apt-get-update-paywall | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall index 7112d2b45..a773660d2 100755 --- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -16,13 +16,11 @@ setupaptarchive changetowebserver -o 'aptwebserver::overwrite::.*::filename=/knights' msgtest 'Acquire test file from the webserver to check' 'overwrite' -echo '601 Configuration -Config-Item: Acquire::http::DependOnSTDIN=0 - -600 Acquire URI -URI: http://localhost:8080/holygrail -Filename: knights-talking -' | ${METHODSDIR}/http >/dev/null 2>&1 && msgpass || msgfail +if downloadfile http://localhost:8080/holygrail ./knights-talking >/dev/null; then + msgpass +else + msgfail +fi testfileequal knights-talking 'ni ni ni' ensure_n_canary_strings_in_dir() { -- cgit v1.2.3 From d059cc2668f284a7db77a15d1d742326d464e963 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 5 Sep 2014 12:03:28 +0200 Subject: Fix incorrect upgradable listing in "apt list" (thanks to Michael Musenbrock) The "apt list" command was using only the pkgDepCache but not the pkgPolicy to figure out if a package is upgradable. This lead to incorrect display of upgradable package when the user used the policy to pin-down packages. Thanks to Michael Musenbrock for the initial patch. Closes: #753297 --- test/integration/test-bug-753297-upgradable | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 test/integration/test-bug-753297-upgradable (limited to 'test') diff --git a/test/integration/test-bug-753297-upgradable b/test/integration/test-bug-753297-upgradable new file mode 100755 index 000000000..068704b3e --- /dev/null +++ b/test/integration/test-bug-753297-upgradable @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +cat > rootdir/etc/apt/preferences < Date: Sat, 30 Aug 2014 11:29:45 +0200 Subject: support regular expressions in 'apt search' apt-cache search supported this since ever and in the code for apt was a fixme indicating this should be added here as well, so here we go. --- test/integration/framework | 8 +++++++- test/integration/test-apt-cli-search | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 3bbf440c8..fde74f55d 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1019,7 +1019,13 @@ testfileequal() { testempty() { msgtest "Test for no output of" "$*" - test -z "$($* 2>&1)" && msgpass || msgfail + local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" + if $* >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then + msgpass + else + cat $COMPAREFILE + msgfail + fi } testequal() { diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search index 58613717b..3ac074952 100755 --- a/test/integration/test-apt-cli-search +++ b/test/integration/test-apt-cli-search @@ -33,16 +33,31 @@ foo/unstable 1.0 all testequal "foo/unstable 1.0 all $DESCR " apt search -qq xxyyzz +testempty apt search -qq --names-only xxyyzz + +# search name +testequal "foo/unstable 1.0 all + $DESCR +" apt search -qq foo +testequal "foo/unstable 1.0 all + $DESCR +" apt search -qq --names-only foo # search with multiple words is a AND search testequal "foo/unstable 1.0 all $DESCR " apt search -qq aabbcc xxyyzz +testequal "foo/unstable 1.0 all + $DESCR +" apt search -qq 'a+b+c+' 'i*xxy{0,2}zz' # search is not case-sensitive by default testequal "foo/unstable 1.0 all $DESCR " apt search -qq uppercase +testequal "foo/unstable 1.0 all + $DESCR +" apt search -qq 'up[pP]erc[Aa]se' # output is sorted and search word finds both package testequal "bar/testing 2.0 i386 -- cgit v1.2.3 From 1a68655de92fd036ebc7c920bc2e5e88c54eb34e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 2 Sep 2014 14:32:48 +0200 Subject: implement --full in apt search --- test/integration/test-apt-cli-search | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search index 3ac074952..8f009d57c 100755 --- a/test/integration/test-apt-cli-search +++ b/test/integration/test-apt-cli-search @@ -15,7 +15,10 @@ fi DESCR='Some description that has a unusual word xxyyzz and aabbcc and a UPPERCASE' DESCR2='Some other description with the unusual aabbcc only' -insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR" +insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR + Long description of stuff and such, with lines + . + and paragraphs and everything." insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2" setupaptarchive @@ -59,6 +62,17 @@ testequal "foo/unstable 1.0 all $DESCR " apt search -qq 'up[pP]erc[Aa]se' +# search is done in the long description +testequal "foo/unstable 1.0 all + $DESCR +" apt search -qq 'long description' +testequal "foo/unstable 1.0 all + $DESCR + Long description of stuff and such, with lines + . + and paragraphs and everything. +" apt search --full -qq 'long description' + # output is sorted and search word finds both package testequal "bar/testing 2.0 i386 $DESCR2 -- cgit v1.2.3 From e9bb097c914ff4fb1cdeda8a2843644dca184c56 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 7 Sep 2014 19:28:21 +0200 Subject: do use an 'unknown' arch-specification in test Using 'kfreebsd' here makes the test fail on a kfreebsd system (obviously), so we just use something totally madeup in the hope that this is less like to conflict in the future. Git-Dch: Ignore --- test/integration/test-architecture-specification-parsing | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-architecture-specification-parsing b/test/integration/test-architecture-specification-parsing index a43354871..d1f6011de 100755 --- a/test/integration/test-architecture-specification-parsing +++ b/test/integration/test-architecture-specification-parsing @@ -13,10 +13,10 @@ buildsimplenativepackage 'pkg-arch-foo' "$NATIVE" '1.0' 'stable' "Build-Depends: Depends: foo [${NATIVE} !${NATIVE}]" buildsimplenativepackage 'pkg-arch-no-foo' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [!${NATIVE} ${NATIVE}] Depends: foo [!${NATIVE} ${NATIVE}]" -buildsimplenativepackage 'pkg-arch-foo-unrelated-no' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [!kfreebsd-any ${NATIVE}] -Depends: foo [!kfreebsd-any ${NATIVE}]" -buildsimplenativepackage 'pkg-arch-foo-unrelated-no2' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [${NATIVE} !kfreebsd-any] -Depends: foo [${NATIVE} !kfreebsd-any]" +buildsimplenativepackage 'pkg-arch-foo-unrelated-no' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [!someos-any ${NATIVE}] +Depends: foo [!someos-any ${NATIVE}]" +buildsimplenativepackage 'pkg-arch-foo-unrelated-no2' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [${NATIVE} !someos-any] +Depends: foo [${NATIVE} !someos-any]" buildsimplenativepackage 'no-depends' 'armel' '1.0' 'stable' 'Build-Depends: foo [armeb], bar [arm] Depends: foo [armeb], bar [arm]' -- cgit v1.2.3 From 27cb4f6c919921b04f3dddff069620ced250a94f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 7 Sep 2014 19:30:33 +0200 Subject: detect terminal output with 'test -t' in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of trying to inspect /proc and the fds inside we use "test -t 1" instead as this is available and working on kfreebsd as well – not that something breaks if we wouldn't, but we like color. Git-Dch: Ignore --- test/integration/framework | 2 +- test/integration/run-tests | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index fde74f55d..ff010a5c4 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -4,7 +4,7 @@ EXIT_CODE=0 # we all like colorful messages if [ "$MSGCOLOR" != 'NO' ]; then - if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then + if [ ! -t 1 ]; then # but check that we output to a terminal export MSGCOLOR='NO' fi fi diff --git a/test/integration/run-tests b/test/integration/run-tests index 9dd550aa2..c39a2ac68 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -22,7 +22,7 @@ done export MSGLEVEL="${MSGLEVEL:-3}" if [ "$MSGCOLOR" != 'NO' ]; then - if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then + if [ ! -t 1 ]; then # but check that we output to a terminal export MSGCOLOR='NO' fi fi -- cgit v1.2.3 From b578738870e83db4e61d6f6591bc73884108b7d4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 7 Sep 2014 21:27:57 +0200 Subject: strip everything spacey in APT::String::Strip Git-Dch: Ignore --- test/libapt/strutil_test.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index e9b778c6b..194c9c074 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -19,6 +19,21 @@ TEST(StrUtilTest,DeEscapeString) EXPECT_EQ("foo\\ x", DeEscapeString("foo\\\\ x")); EXPECT_EQ("\\foo\\", DeEscapeString("\\\\foo\\\\")); } +TEST(StrUtilTest,StringStrip) +{ + EXPECT_EQ("", APT::String::Strip("")); + EXPECT_EQ("foobar", APT::String::Strip("foobar")); + EXPECT_EQ("foo bar", APT::String::Strip("foo bar")); + + EXPECT_EQ("", APT::String::Strip(" ")); + EXPECT_EQ("", APT::String::Strip(" \r\n \t ")); + + EXPECT_EQ("foo bar", APT::String::Strip("foo bar ")); + EXPECT_EQ("foo bar", APT::String::Strip("foo bar \r\n \t ")); + EXPECT_EQ("foo bar", APT::String::Strip("\r\n \t foo bar")); + EXPECT_EQ("bar foo", APT::String::Strip("\r\n \t bar foo \r\n \t ")); + EXPECT_EQ("bar \t\r\n foo", APT::String::Strip("\r\n \t bar \t\r\n foo \r\n \t ")); +} TEST(StrUtilTest,StringSplitBasic) { std::vector result = StringSplit("", ""); -- cgit v1.2.3 From f920cbe8527ce523974da2563ca1165790c1d40e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 7 Sep 2014 22:08:01 +0200 Subject: fix and non-silent fail dpkg-overwrite error test Commit cbcdd3ee9d86379d1b3a44e41ae8b17dc23111d0 removes the space at the end of the debfile name dpkg send to us and we previously had included in the pmerror message we printed on the statusfd. Git-Dch: Ignore --- test/integration/test-apt-progress-fd-error | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-progress-fd-error b/test/integration/test-apt-progress-fd-error index 96d66371a..a47095b9b 100755 --- a/test/integration/test-apt-progress-fd-error +++ b/test/integration/test-apt-progress-fd-error @@ -18,5 +18,10 @@ setupaptarchive exec 3> apt-progress.log testfailure aptget install foo1 foo2 -y -o APT::Status-Fd=3 msgtest "Ensure correct error message" -grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb :40:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log && msgpass || (cat apt-progress.log && msgfail) +if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:40:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then + msgpass +else + cat apt-progress.log + msgfail +fi -- cgit v1.2.3 From 4c559e97ba4cc0d3a2995b7c451e606539d2f1be Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 8 Sep 2014 17:14:17 +0200 Subject: fix progress report for upgrade and reinstall APT treats upgrades like installs and dpkg is very similar in this, but prints still a slightly different processing message indicating that it is really an upgrade which we hadn't parsed so far, but this wasn't really visible as we quickly moved on to a 'known' state. More problematic was the reinstall case as apt hadn't recognized this for the package name detection, so that reinstalls had no progress since we introduced MultiArch. --- test/integration/test-apt-progress-fd | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd index 9d250e949..d72e7e72d 100755 --- a/test/integration/test-apt-progress-fd +++ b/test/integration/test-apt-progress-fd @@ -33,6 +33,22 @@ testsuccess aptget install testing=0.8.15 -y -o APT::Status-Fd=3 testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:0:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg +pmstatus:testing:0:Installing testing (amd64) +pmstatus:testing:20:Preparing testing (amd64) +pmstatus:testing:40:Unpacking testing (amd64) +pmstatus:testing:60:Preparing to configure testing (amd64) +pmstatus:dpkg-exec:60:Running dpkg +pmstatus:testing:60:Configuring testing (amd64) +pmstatus:testing:80:Configuring testing (amd64) +pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log + +# reinstall +exec 3> apt-progress.log +testsuccess aptget install testing=0.8.15 --reinstall -y -o APT::Status-Fd=3 +testequal "dlstatus:1:0:Retrieving file 1 of 1 +dlstatus:1:0:Retrieving file 1 of 1 +pmstatus:dpkg-exec:0:Running dpkg +pmstatus:testing:0:Installing testing (amd64) pmstatus:testing:20:Preparing testing (amd64) pmstatus:testing:40:Unpacking testing (amd64) pmstatus:testing:60:Preparing to configure testing (amd64) -- cgit v1.2.3 From 22da5c135a74eee8ed998806136e25b8ed038bd0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 9 Sep 2014 13:52:32 +0200 Subject: don't call pager in non-terminals for changelog Most pagers are nice and default to running non-interactively if they aren't connected to a terminal and we relied on that. On ci.debian.net the configured pager is printing a header out of nowhere though, so if we are printing to a non-terminal we call "cat" instead. In the rework we also "remove" the dependency on sensible-utils in sofar as we call some alternatives if calling the utils fail. This seems to be the last problem preventing a "PASS" status on ci.debian.net, so we close the associated bugreport. Closes: 755040 --- test/integration/test-apt-get-changelog | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index a73c3e249..4ee113482 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -28,9 +28,8 @@ testsuccess aptget changelog apt -d testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" rm apt.changelog aptarchive/pool/apt_1.0/changelog -aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' > apt.changelog -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" -rm apt.changelog +testequal "$(cat aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ + -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' testsuccess aptget changelog apt -d testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" -- cgit v1.2.3 From ca7fd76c2f30c100dcf1c12e717ce397cccd690b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 16 Sep 2014 20:23:43 +0200 Subject: SECURITY UPDATE for CVE-2014-{0488,0487,0489} incorrect invalidating of unauthenticated data (CVE-2014-0488) incorect verification of 304 reply (CVE-2014-0487) incorrect verification of Acquire::Gzip indexes (CVE-2014-0489) --- test/integration/test-apt-update-stale | 46 ++++++++++++++++++++++++++++ test/integration/test-apt-update-unauth | 48 ++++++++++++++++++++++++++++++ test/integration/test-hashsum-verification | 14 +++++++-- 3 files changed, 105 insertions(+), 3 deletions(-) create mode 100755 test/integration/test-apt-update-stale create mode 100755 test/integration/test-apt-update-unauth (limited to 'test') diff --git a/test/integration/test-apt-update-stale b/test/integration/test-apt-update-stale new file mode 100755 index 000000000..780ff79af --- /dev/null +++ b/test/integration/test-apt-update-stale @@ -0,0 +1,46 @@ +#!/bin/sh +# +# Ensure that a MITM can not stale the Packages/Sources without +# raising a error message. Note that the Release file is protected +# via the "Valid-Until" header +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '1.0' + +setupaptarchive +changetowebserver +aptget update -qq + +# insert new version +mkdir aptarchive/dists/unstable/main/binary-i386/saved +cp -p aptarchive/dists/unstable/main/binary-i386/Packages* \ + aptarchive/dists/unstable/main/binary-i386/saved +insertpackage 'unstable' 'foo' 'all' '2.0' + +# not using compressfile for compat with older apt releases +gzip -c aptarchive/dists/unstable/main/binary-i386/Packages > \ + aptarchive/dists/unstable/main/binary-i386/Packages.gz +generatereleasefiles +signreleasefiles + +# ensure that we do not get a I-M-S hit for the Release file +touch -d "+1hour" aptarchive/dists/unstable/*Release* + +# but now only deliver the previous Packages file instead of the new one +# (simulating a stale attack) +cp -p aptarchive/dists/unstable/main/binary-i386/saved/Packages* \ + aptarchive/dists/unstable/main/binary-i386/ + +# ensure this raises a error +testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Hash Sum mismatch + +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + + diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth new file mode 100755 index 000000000..13487603c --- /dev/null +++ b/test/integration/test-apt-update-unauth @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Ensure that when going from unauthenticated to authenticated all +# files are checked again +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'foo' 'all' '1.0' +insertsource 'unstable' 'foo' 'all' '1.0' + +setupaptarchive +changetowebserver + +runtest() { + # start unauthenticated + find rootdir/var/lib/apt/lists/ -type f | xargs rm -f + rm -f aptarchive/dists/unstable/*Release* + aptget update -qq + + # become authenticated + generatereleasefiles + signreleasefiles + + # and ensure we do download the data again + msgtest "Check that the data is check when going to authenticated" + if aptget update |grep -q Hit; then + msgfail + else + msgpass + fi +} + +for COMPRESSEDINDEXES in 'false' 'true'; do + echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes + if $COMPRESSEDINDEXES; then + msgmsg 'Run tests with GzipIndexes enabled' + else + msgmsg 'Run tests with GzipIndexes disabled' + fi + + runtest +done diff --git a/test/integration/test-hashsum-verification b/test/integration/test-hashsum-verification index e77efb46e..2a400dcb4 100755 --- a/test/integration/test-hashsum-verification +++ b/test/integration/test-hashsum-verification @@ -64,7 +64,7 @@ runtest() { msgtest 'No package from the source available' [ "$(aptcache show apt 2>&1)" = "E: No packages found" ] && msgpass || msgfail msgtest 'No Packages file in /var/lib/apt/lists' - [ "$(ls rootdir/var/lib/apt/lists/*Package* 2>/dev/null)" = "" ] && msgpass || msgfail + [ "$(ls rootdir/var/lib/apt/lists/*Package* 2>/dev/null | grep -v FAILED 2>/dev/null)" = "" ] && msgpass || msgfail # now with the unsigned Release file rm -rf rootdir/var/lib/apt/lists @@ -75,5 +75,13 @@ runtest() { } -runtest - +for COMPRESSEDINDEXES in 'false' 'true'; do + echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes + if $COMPRESSEDINDEXES; then + msgmsg 'Run tests with GzipIndexes enabled' + else + msgmsg 'Run tests with GzipIndexes disabled' + fi + + runtest +done -- cgit v1.2.3 From daff4aa356128310f022370f7825bdc369c66ba8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 17 Sep 2014 14:57:05 +0200 Subject: Fix regression for file:/// uris from CVE-2014-0487 Do not run ReverifyAfterIMS() for local file URIs as this will causes apt to mess around in the file:/// uri space. This is wrong in itself, but it will also cause a incorrect verification failure when the archive and the lists directory are on different partitions as rename(). --- test/integration/test-apt-update-file | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 test/integration/test-apt-update-file (limited to 'test') diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file new file mode 100755 index 000000000..069f8ba2f --- /dev/null +++ b/test/integration/test-apt-update-file @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Ensure that we do not modify file:/// uris (regression test for +# CVE-2014-0487 +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "amd64" +configcompression 'bz2' 'gz' + +insertpackage 'unstable' 'foo' 'all' '1.0' + +umask 022 +setupaptarchive --no-update + +# ensure the archive is not writable +chmod 550 aptarchive/dists/unstable/main/binary-amd64 + +testsuccess aptget update -qq +testsuccess aptget update -qq + +# the cleanup should still work +chmod 750 aptarchive/dists/unstable/main/binary-amd64 -- cgit v1.2.3 From 23d0a6fbee9e8880107481502e14411961c44a7b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 17 Sep 2014 17:48:27 +0200 Subject: improve test for commit daff4a --- test/integration/test-apt-update-file | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file index 069f8ba2f..e267c71da 100755 --- a/test/integration/test-apt-update-file +++ b/test/integration/test-apt-update-file @@ -22,6 +22,13 @@ chmod 550 aptarchive/dists/unstable/main/binary-amd64 testsuccess aptget update -qq testsuccess aptget update -qq +aptget update -qq -o Debug::pkgAcquire::Auth=1 2> output.log + +# ensure that the hash of the uncompressed file was verified even on a local +# ims hit +canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" +grep -q "RecivedHash: $canary" output.log + # the cleanup should still work chmod 750 aptarchive/dists/unstable/main/binary-amd64 -- cgit v1.2.3 From 8b451962751298876d1f399e4de492d8adbb135a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 19 Sep 2014 16:41:50 +0200 Subject: test/integration/test-apt-update-file: improve test --- test/integration/test-apt-update-file | 2 ++ test/integration/test-bug-762160-relpath | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100755 test/integration/test-bug-762160-relpath (limited to 'test') diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file index e267c71da..fbcd473cc 100755 --- a/test/integration/test-apt-update-file +++ b/test/integration/test-apt-update-file @@ -29,6 +29,8 @@ aptget update -qq -o Debug::pkgAcquire::Auth=1 2> output.log canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" grep -q "RecivedHash: $canary" output.log +# foo is still available +testsuccess aptget install -s foo # the cleanup should still work chmod 750 aptarchive/dists/unstable/main/binary-amd64 diff --git a/test/integration/test-bug-762160-relpath b/test/integration/test-bug-762160-relpath new file mode 100755 index 000000000..0af71f57b --- /dev/null +++ b/test/integration/test-bug-762160-relpath @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +# dpkg implements versioned provides in commit 5bb02fe80e9f40dcad9703a72f67cf615ff217b5 +# but previous versions seem to allow parsing, working and ignoring it. + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertpackage 'unstable' 'foo' 'all' '1' +setupaptarchive + +aptget update -o Dir=./apt -- cgit v1.2.3 From 9da539c5aff025aab99537be1c75e8c6a853fd83 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 19 Sep 2014 16:41:55 +0200 Subject: Fix regression when copy: is used for a relative path When we do a ReverifyAfterIMS() we use the copy: method to verify the hashes again. If the user uses -o Dir=./something/relative this fails because we use the URI class in copy.cc that strips away the leading relative part. By not using URI this is fixed. Closes: #762160 --- test/integration/test-bug-762160-relpath | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-762160-relpath b/test/integration/test-bug-762160-relpath index 0af71f57b..204587727 100755 --- a/test/integration/test-bug-762160-relpath +++ b/test/integration/test-bug-762160-relpath @@ -1,9 +1,9 @@ #!/bin/sh +# regresion test for bug #762160 where apt-get update fails when a +# relative directory is given +# set -e -# dpkg implements versioned provides in commit 5bb02fe80e9f40dcad9703a72f67cf615ff217b5 -# but previous versions seem to allow parsing, working and ignoring it. - TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment @@ -11,5 +11,7 @@ configarchitecture 'amd64' insertpackage 'unstable' 'foo' 'all' '1' setupaptarchive +changetowebserver -aptget update -o Dir=./apt +testsuccess aptget update -o Dir=./rootdir +testsuccess aptget update -o Dir=./rootdir \ No newline at end of file -- cgit v1.2.3 From 2bd6be8ad24583ed9935f5c5d57c04ba7344111e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 20 Sep 2014 00:12:13 +0200 Subject: relax grep to support newer curl output format Git-Dch: Ignore --- test/integration/test-apt-https-no-redirect | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect index 73352a28c..bc744d6f2 100755 --- a/test/integration/test-apt-https-no-redirect +++ b/test/integration/test-apt-https-no-redirect @@ -25,6 +25,11 @@ msgtest 'download of a file does not work if' 'https redirected to http' downloadfile 'https://localhost:4433/redirectme/working' redirectfile >curloutput 2>&1 && msgfail || msgpass msgtest 'libcurl has forbidden access in last request to' 'http resource' -grep -q -- 'Protocol http not supported or disabled in libcurl' curloutput && msgpass || msgfail +if grep -q -E -- 'Protocol "?http"? not supported or disabled in libcurl' curloutput; then + msgpass +else + cat curloutput + msgfail +fi -- cgit v1.2.3 From b0f4b486e6850c5f98520ccf19da71d0ed748ae4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 21 Sep 2014 10:18:03 +0200 Subject: generalize Acquire::GzipIndex --- .../test-bug-595691-empty-and-broken-archive-files | 2 +- test/integration/test-compressed-indexes | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files index a05ed5fa6..23a638801 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -121,7 +121,7 @@ Reading package lists..." "empty archive Packages.$COMPRESS over http" testaptgetupdate "Get: http://localhost:8080 Packages Err http://localhost:8080 Packages Empty files can't be valid archives -W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages) Empty files can't be valid archives +W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages.${COMPRESS}) Empty files can't be valid archives E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over http" } diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 6671dd75a..819cbd35e 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -5,7 +5,7 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configcompression '.' 'gz' # only gz is supported for this, so ensure it is used +configcompression '.' 'xz' 'gz' configarchitecture "i386" buildsimplenativepackage "testpkg" "i386" "1.0" @@ -32,13 +32,13 @@ testrun() { if [ "$1" = "compressed" ]; then ! test -e rootdir/var/lib/apt/lists/*_Packages || F=1 ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1 - test -e rootdir/var/lib/apt/lists/*_Packages.gz || F=1 - test -e rootdir/var/lib/apt/lists/*_Sources.gz || F=1 + test -e rootdir/var/lib/apt/lists/*_Packages.xz || F=1 + test -e rootdir/var/lib/apt/lists/*_Sources.xz || F=1 else test -e rootdir/var/lib/apt/lists/*_Packages || F=1 test -e rootdir/var/lib/apt/lists/*_Sources || F=1 - ! test -e rootdir/var/lib/apt/lists/*_Packages.gz || F=1 - ! test -e rootdir/var/lib/apt/lists/*_Sources.gz || F=1 + ! test -e rootdir/var/lib/apt/lists/*_Packages.xz || F=1 + ! test -e rootdir/var/lib/apt/lists/*_Sources.xz || F=1 fi if [ -n "$F" ]; then ls -laR rootdir/var/lib/apt/lists/ @@ -84,10 +84,9 @@ msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)" testrun rm -rf rootdir/var/lib/apt/lists -echo 'Acquire::CompressionTypes::Order:: "gz"; -Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex +echo 'Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex -testsuccess aptget update +testsuccess aptget update -o Debug::pkgAcquire::worker=1 msgmsg "File: Test with compressed indexes" testrun "compressed" @@ -118,14 +117,13 @@ msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)" testrun rm -rf rootdir/var/lib/apt/lists -echo 'Acquire::CompressionTypes::Order:: "gz"; -Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex +echo 'Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex testsuccess aptget update msgmsg "HTTP: Test with compressed indexes" testrun "compressed" -testsuccess aptget update -o Acquire::Pdiffs=1 +testsuccess aptget update -o Acquire::Pdiffs=1 -o debug::pkgAcquire::Worker=1 -o debug::pkgAcquire::Auth=1 msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)" testrun "compressed" -- cgit v1.2.3 From a1380a5c52062b25c9ed260b721239ed57929503 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 23 Sep 2014 14:57:10 +0200 Subject: fix tests --- test/integration/test-apt-progress-fd | 2 +- test/integration/test-apt-update-file | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd index c147c4517..af022f582 100755 --- a/test/integration/test-apt-progress-fd +++ b/test/integration/test-apt-progress-fd @@ -46,7 +46,7 @@ pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log exec 3> apt-progress.log testsuccess aptget install testing=0.8.15 --reinstall -y -o APT::Status-Fd=3 testequal "dlstatus:1:0:Retrieving file 1 of 1 -dlstatus:1:0:Retrieving file 1 of 1 +dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) pmstatus:testing:20:Preparing testing (amd64) diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file index fbcd473cc..e6332dc3b 100755 --- a/test/integration/test-apt-update-file +++ b/test/integration/test-apt-update-file @@ -14,7 +14,6 @@ configcompression 'bz2' 'gz' insertpackage 'unstable' 'foo' 'all' '1.0' -umask 022 setupaptarchive --no-update # ensure the archive is not writable @@ -27,10 +26,12 @@ aptget update -qq -o Debug::pkgAcquire::Auth=1 2> output.log # ensure that the hash of the uncompressed file was verified even on a local # ims hit canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" -grep -q "RecivedHash: $canary" output.log +grep -q -- "- $canary" output.log # foo is still available testsuccess aptget install -s foo # the cleanup should still work chmod 750 aptarchive/dists/unstable/main/binary-amd64 + + -- cgit v1.2.3 From c8aa88aa2c3139584cfabb1ce4619c773e9f2b99 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 23 Sep 2014 18:08:53 +0200 Subject: cleanup, fix test-apt-update-unauth as the behavior of apt changed --- test/integration/test-apt-update-unauth | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth index 13487603c..4e08b5e35 100755 --- a/test/integration/test-apt-update-unauth +++ b/test/integration/test-apt-update-unauth @@ -17,23 +17,41 @@ insertsource 'unstable' 'foo' 'all' '1.0' setupaptarchive changetowebserver +# FIXME: +# - also check the unauth -> auth success case, i.e. that all files are +# reverified runtest() { # start unauthenticated find rootdir/var/lib/apt/lists/ -type f | xargs rm -f rm -f aptarchive/dists/unstable/*Release* + # remove uncompressed version + find aptarchive/ -name Packages | xargs rm -f aptget update -qq # become authenticated generatereleasefiles signreleasefiles - # and ensure we do download the data again - msgtest "Check that the data is check when going to authenticated" - if aptget update |grep -q Hit; then - msgfail - else + # and ensure we re-check the downloaded data + msgtest "Check rollback on going from unauth -> auth" + + # change the local packages file + PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*) + echo "meep" > $PKGS + ls -l rootdir/var/lib/apt/lists > lists.before + + # update and ensure all is reverted on the hashsum failure + aptget update -o Debug::Acquire::Transaction=1 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 > output.log 2>&1 || true + + # ensure we have before what we have after + ls -l rootdir/var/lib/apt/lists > lists.after + if diff -u lists.before lists.after; then msgpass + else + #cat output.log + msgfail fi + } for COMPRESSEDINDEXES in 'false' 'true'; do -- cgit v1.2.3 From 03bfbc965443393b92b2d6d82613472fa3a5067f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 23 Sep 2014 23:48:19 +0200 Subject: make pdiff transactional (but at the cost of a CopyFile() --- test/integration/test-pdiff-usage | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 74749d6ab..e86963f28 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -159,6 +159,7 @@ SHA1-Patches: " aptcache show apt newstuff } echo 'Debug::pkgAcquire::Diffs "true"; +Debug::Acquire::Transaction "true"; Debug::pkgAcquire::rred "true";' > rootdir/etc/apt/apt.conf.d/rreddebug.conf testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=1 -- cgit v1.2.3 From 5f982b9d903b38bb5549479f0111d31e2695090c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 25 Sep 2014 11:52:41 +0200 Subject: rewrite compressed indexes test to check with all compressors Git-Dch: Ignore --- test/integration/framework | 30 ++++ .../test-bug-595691-empty-and-broken-archive-files | 33 +--- test/integration/test-compressed-indexes | 194 +++++++++++---------- 3 files changed, 135 insertions(+), 122 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index ff010a5c4..7923e23d9 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -339,6 +339,36 @@ configcompression() { done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf } +forcecompressor() { + COMPRESSOR="$1" + COMPRESSOR_CMD="$1" + case $COMPRESSOR in + gzip) COMPRESS='gz';; + bzip2) COMPRESS='bz2';; + lzma) COMPRESS='lzma';; + xz) COMPRESS='xz';; + *) msgdie "Compressor $COMPRESSOR is unknown to framework, so can't be forced by forcecompressor!";; + esac + local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" + echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; +Dir::Bin::uncompressed \"/does/not/exist\"; +Dir::Bin::gzip \"/does/not/exist\"; +Dir::Bin::bzip2 \"/does/not/exist\"; +Dir::Bin::lzma \"/does/not/exist\"; +Dir::Bin::xz \"/does/not/exist\";" > "$CONFFILE" + if [ -e "/bin/${COMPRESSOR}" ]; then + echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> "$CONFFILE" + elif [ -e "/usr/bin/${COMPRESSOR}" ]; then + echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> "$CONFFILE" + elif [ "${COMPRESSOR}" = 'lzma' ]; then + echo 'Dir::Bin::xz "/usr/bin/xz";' >> "$CONFFILE" + COMPRESSOR_CMD='xz --format=lzma' + else + msgtest 'Test for availability of compressor' "${COMPRESSOR}" + msgfail + fi +} + setupsimplenativepackage() { local NAME="$1" local ARCH="$2" diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files index 23a638801..aea340203 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -48,37 +48,8 @@ createemptyfile() { rm -f aptarchive/Packages } -setupcompressor() { - COMPRESSOR="$1" - COMPRESSOR_CMD="$1" - case $COMPRESSOR in - gzip) COMPRESS="gz";; - bzip2) COMPRESS="bz2";; - lzma) COMPRESS="lzma";; - xz) COMPRESS="xz";; - esac - echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; -Dir::Bin::uncompressed \"/does/not/exist\"; -Dir::Bin::gzip \"/does/not/exist\"; -Dir::Bin::bzip2 \"/does/not/exist\"; -Dir::Bin::lzma \"/does/not/exist\"; -Dir::Bin::xz \"/does/not/exist\";" > rootdir/etc/apt/apt.conf.d/00compressor - if [ -e "/bin/${COMPRESSOR}" ]; then - echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> rootdir/etc/apt/apt.conf.d/00compressor - elif [ -e "/usr/bin/${COMPRESSOR}" ]; then - echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> rootdir/etc/apt/apt.conf.d/00compressor - elif [ "${COMPRESSOR}" = 'lzma' ]; then - echo "Dir::Bin::xz \"/usr/bin/xz\";" >> rootdir/etc/apt/apt.conf.d/00compressor - COMPRESSOR_CMD='xz --format=lzma' - else - msgtest "Test for availability of compressor" "${COMPRESSOR}" - msgfail - #exit 1 - fi -} - testoverfile() { - setupcompressor "$1" + forcecompressor "$1" createemptyfile 'en' testaptgetupdate 'Reading package lists...' "empty file en.$COMPRESS over file" @@ -100,7 +71,7 @@ E: Some index files failed to download. They have been ignored, or old ones used } testoverhttp() { - setupcompressor "$1" + forcecompressor "$1" createemptyfile 'en' testaptgetupdate "Get: http://localhost:8080 Packages [] diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 819cbd35e..805ed5964 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -5,53 +5,68 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configcompression '.' 'xz' 'gz' -configarchitecture "i386" - -buildsimplenativepackage "testpkg" "i386" "1.0" -setupaptarchive - -GOODSHOW="$(aptcache show testpkg) -" -GOODPOLICY="$(aptcache policy testpkg)" -GOODSHOWSRC="$(aptcache showsrc testpkg) -" - -test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken' -testequal "$GOODSHOW" aptcache show testpkg -test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken' -testequal "$GOODPOLICY" aptcache policy testpkg -test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken' -testequal "$GOODSHOWSRC" aptcache showsrc testpkg - +configcompression '.' 'xz' 'bz2' 'lzma' 'gz' +configarchitecture 'i386' + +buildsimplenativepackage 'testpkg' 'i386' '1.0' + +buildaptarchive +setupdistsaptarchive +# fake a pdiff setup as apt wouldn't try pdiffs otherwise +find aptarchive -name 'Packages' -o -name 'Sources' | while read file; do + mkdir "${file}.diff" + PATCHINDEX="${file}.diff/Index" + echo 'SHA1-Current: adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 0 +SHA1-History: + adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 33053002 2010-08-18-2013.28 + ecfd1b19e793491b1c6ea123eabdcd9f32e592fc 33053001 2010-08-18-2013.29 +SHA1-Patches: + abc1fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 + dfe3444ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.29' > $PATCHINDEX +done +generatereleasefiles +signreleasefiles testrun() { local F - if [ -e rootdir/var/lib/apt/lists/*localhost*Release ]; then - msgtest "Check if all index files are" "${1:-uncompressed}" - if [ "$1" = "compressed" ]; then - ! test -e rootdir/var/lib/apt/lists/*_Packages || F=1 - ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1 - test -e rootdir/var/lib/apt/lists/*_Packages.xz || F=1 - test -e rootdir/var/lib/apt/lists/*_Sources.xz || F=1 - else - test -e rootdir/var/lib/apt/lists/*_Packages || F=1 - test -e rootdir/var/lib/apt/lists/*_Sources || F=1 - ! test -e rootdir/var/lib/apt/lists/*_Packages.xz || F=1 - ! test -e rootdir/var/lib/apt/lists/*_Sources.xz || F=1 - fi - if [ -n "$F" ]; then - ls -laR rootdir/var/lib/apt/lists/ - msgfail - else - msgpass - fi - msgtest "Check if package is downloadable" - testsuccess --nomsg aptget install -d testpkg - msgtest "\tdeb file is present"; testsuccess --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb - aptget clean - msgtest "\tdeb file is gone"; testfailure --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb + msgtest 'Check if all index files are' "${1:-uncompressed}" + if [ "$1" = 'compressed' ]; then + ! test -e rootdir/var/lib/apt/lists/*_Packages || F=1 + ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1 + ! test -e rootdir/var/lib/apt/lists/*_Translation-en || F=1 + test -e rootdir/var/lib/apt/lists/*_Packages.${COMPRESS} || F=1 + test -e rootdir/var/lib/apt/lists/*_Sources.${COMPRESS} || F=1 + test -e rootdir/var/lib/apt/lists/*_Translation-en.${COMPRESS} || F=1 + # there is no point in trying pdiff if we have compressed indexes + # as we can't patch compressed files (well, we can, but what is the point?) + ! test -e rootdir/var/lib/apt/lists/*.IndexDiff || F=1 + else + # clear the faked pdiff indexes so the glob below works + rm -f rootdir/var/lib/apt/lists/*.IndexDiff + test -e rootdir/var/lib/apt/lists/*_Packages || F=1 + test -e rootdir/var/lib/apt/lists/*_Sources || F=1 + test -e rootdir/var/lib/apt/lists/*_Translation-en || F=1 + ! test -e rootdir/var/lib/apt/lists/*_Packages.* || F=1 + ! test -e rootdir/var/lib/apt/lists/*_Sources.* || F=1 + ! test -e rootdir/var/lib/apt/lists/*_Translation-en.* || F=1 fi + if [ -n "$F" ]; then + ls -laR rootdir/var/lib/apt/lists/ + msgfail + else + msgpass + fi + msgtest 'Check if package is downloadable' + testsuccess --nomsg aptget download testpkg + msgtest '\tdeb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb + rm testpkg_1.0_i386.deb + testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + testpkg +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst testpkg (1.0 unstable [i386]) +Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin testequal "$GOODSHOW" aptcache show testpkg testequal "$GOODSHOW" aptcache show testpkg @@ -62,71 +77,68 @@ testrun() { testequal "$GOODSHOWSRC" aptcache showsrc testpkg testequal "$GOODSHOWSRC" aptcache showsrc testpkg aptget clean - msgtest "Check if the source is aptgetable" + msgtest 'Check if the source is aptgetable' testsuccess --nomsg aptget source testpkg - msgtest "\tdsc file is present"; testsuccess --nomsg test -f testpkg_1.0.dsc - msgtest "\tdirectory is present"; testsuccess --nomsg test -d testpkg-1.0 - rm -rf testpkg-1.0 + msgtest '\tdsc file is present'; testsuccess --nomsg test -f testpkg_1.0.dsc + msgtest '\tdirectory is present'; testsuccess --nomsg test -d testpkg-1.0 + rm -rf testpkg-1.0* testequal "$(aptcache show testpkg -o Acquire::Languages=none) " aptcache dumpavail } -echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex -msgmsg "File: Test with uncompressed indexes" -testrun +echo 'Debug::pkgAcquire::worker "true"; +debug::pkgAcquire::Auth "true"; +Debug::pkgAcquire::Diffs "true";' > rootdir/etc/apt/apt.conf.d/99debugconf -testsuccess aptget update -o Acquire::Pdiffs=1 -msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)" -testrun +testovermethod() { + forcecompressor $2 -testsuccess aptget update -o Acquire::Pdiffs=0 -msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)" -testrun + for INDEX in 'false' 'true'; do + rm -rf rootdir/var/lib/apt/lists + echo "Acquire::GzipIndexes \"${INDEX}\";" > rootdir/etc/apt/apt.conf.d/02compressindex + local INDCOMP + if [ "$INDEX" = 'false' ]; then + INDCOMP='uncompressed' + else + INDCOMP='compressed' + fi -rm -rf rootdir/var/lib/apt/lists -echo 'Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex + testsuccess aptget update + msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes" + testrun "$INDCOMP" -testsuccess aptget update -o Debug::pkgAcquire::worker=1 -msgmsg "File: Test with compressed indexes" -testrun "compressed" + testsuccess aptget update -o Acquire::Pdiffs=1 + msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes (update unchanged with pdiffs)" + testrun "$INDCOMP" -testsuccess aptget update -o Acquire::Pdiffs=1 -msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)" -testrun "compressed" + testsuccess aptget update -o Acquire::Pdiffs=0 + msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes (update unchanged without pdiffs)" + testrun "$INDCOMP" -testsuccess aptget update -o Acquire::Pdiffs=0 -msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)" -testrun "compressed" + rm rootdir/etc/apt/apt.conf.d/02compressindex + done +} -rm rootdir/etc/apt/apt.conf.d/02compressindex -changetowebserver testsuccess aptget update +GOODSHOW="$(aptcache show testpkg) +" +test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken' +testequal "$GOODSHOW" aptcache show testpkg +GOODSHOWSRC="$(aptcache showsrc testpkg) +" +test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken' +testequal "$GOODSHOWSRC" aptcache showsrc testpkg GOODPOLICY="$(aptcache policy testpkg)" -test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 +test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken' testequal "$GOODPOLICY" aptcache policy testpkg -msgmsg "HTTP: Test with uncompressed indexes" -testrun - -testsuccess aptget update -o Acquire::Pdiffs=1 -msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)" -testrun - -testsuccess aptget update -o Acquire::Pdiffs=0 -msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)" -testrun +for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'file' $COMPRESSOR; done +changetowebserver rm -rf rootdir/var/lib/apt/lists -echo 'Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex - testsuccess aptget update -msgmsg "HTTP: Test with compressed indexes" -testrun "compressed" - -testsuccess aptget update -o Acquire::Pdiffs=1 -o debug::pkgAcquire::Worker=1 -o debug::pkgAcquire::Auth=1 -msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)" -testrun "compressed" +GOODPOLICY="$(aptcache policy testpkg)" +test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 'policy is broken' +testequal "$GOODPOLICY" aptcache policy testpkg -testsuccess aptget update -o Acquire::Pdiffs=0 -msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)" -testrun "compressed" +for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'http' $COMPRESSOR; done -- cgit v1.2.3 From c4ffa0428b617cd844f0f9dfd5d16ae0553675ac Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 26 Sep 2014 20:59:56 +0200 Subject: Print warning for unauthenticated repositories --- .../integration/test-apt-get-update-unauth-warning | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 test/integration/test-apt-get-update-unauth-warning (limited to 'test') diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning new file mode 100755 index 000000000..4411a7430 --- /dev/null +++ b/test/integration/test-apt-get-update-unauth-warning @@ -0,0 +1,30 @@ +#!/bin/sh +# +# ensure we print warnings for unauthenticated repositories +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# a "normal" package with source and binary +buildsimplenativepackage 'foo' 'all' '2.0' + +setupaptarchive --no-update + +APTARCHIVE=$(readlink -f ./aptarchive) +rm -f $APTARCHIVE/dists/unstable/*Release* + +# update without authenticated InRelease file +testequal "Ign file: unstable InRelease +Ign file: unstable Release +Reading package lists... +W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated." aptget update + +# ensure we can not install the package +testequal "WARNING: The following packages cannot be authenticated! + foo +E: There are problems and -y was used without --force-yes" aptget install -qq -y foo -- cgit v1.2.3 From 631a7dc7906a10ccd5f14dcfe42224e6107e11f6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 26 Sep 2014 20:59:31 +0200 Subject: Do not allow going from authenticated to unauthenticated repo Also rework the way we load the Release file, so it only after Release.gpg verified the Release file. The rational is that we never want to load untrusted data into our parsers. Only stuff verified with gpg or by its hashes get loaded. To load untrusted data you now need to use apt-get update --allow-unauthenticated. --- test/integration/test-apt-update-nofallback | 207 ++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100755 test/integration/test-apt-update-nofallback (limited to 'test') diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback new file mode 100755 index 000000000..4e8ea9916 --- /dev/null +++ b/test/integration/test-apt-update-nofallback @@ -0,0 +1,207 @@ +#!/bin/sh +# +# ensure we never fallback from a signed to a unsigned repo +# +# hash checks are done in +# +set -e + +simulate_mitm_and_inject_evil_package() +{ + rm -f $APTARCHIVE/dists/unstable/InRelease + rm -f $APTARCHIVE/dists/unstable/Release.gpg + inject_evil_package +} + +inject_evil_package() +{ + cat > $APTARCHIVE/dists/unstable/main/binary-i386/Packages < +Architecture: all +Version: 1.0 +Filename: pool/evil_1.0_all.deb +Size: 1270 +Description: an autogenerated evil package +EOF + # avoid ims hit + touch -d '+1hour' aptarchive/dists/unstable/main/binary-i386/Packages +} + +assert_update_is_refused_and_last_good_state_used() +{ + testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq + + assert_repo_is_intact +} + +assert_repo_is_intact() +{ + testequal "foo/unstable 2.0 all" apt list -q + testsuccess "" aptget install -y -s foo + testfailure "" aptget install -y evil + + LISTDIR=rootdir/var/lib/apt/lists + if ! ( ls $LISTDIR/*InRelease >/dev/null 2>&1 || + ls $LISTDIR/*Release.gpg >/dev/null 2>&1 ); then + echo "Can not find InRelease/Release.gpg in $(ls $LISTDIR)" + msgfail + fi +} + +setupaptarchive_with_lists_clean() +{ + setupaptarchive --no-update + rm -f rootdir/var/lib/apt/lists/_* + #rm -rf rootdir/var/lib/apt/lists +} + +test_from_inrelease_to_unsigned() +{ + # setup archive with InRelease file + setupaptarchive_with_lists_clean + testsuccess aptget update + + simulate_mitm_and_inject_evil_package + assert_update_is_refused_and_last_good_state_used +} + +test_from_release_gpg_to_unsigned() +{ + # setup archive with Release/Release.gpg (but no InRelease) + setupaptarchive_with_lists_clean + rm $APTARCHIVE/dists/unstable/InRelease + testsuccess aptget update + + simulate_mitm_and_inject_evil_package + assert_update_is_refused_and_last_good_state_used +} + +test_cve_2012_0214() +{ + # see https://bugs.launchpad.net/ubuntu/+source/apt/+bug/947108 + # + # it was possible to MITM the download so that InRelease/Release.gpg + # are not delivered (404) and a altered Release file was send + # + # apt left the old InRelease file in /var/lib/apt/lists and downloaded + # the unauthenticated Release file too giving the false impression that + # Release was authenticated + # + # Note that this is pretty much impossible nowdays because: + # a) InRelease is left as is, not split to InRelease/Release as it was + # in the old days + # b) we refuse to go from signed->unsigned + # + # Still worth having a regression test the simulates the condition + + # setup archive with InRelease + setupaptarchive_with_lists_clean + testsuccess aptget update + + # do what CVE-2012-0214 did + rm $APTARCHIVE/dists/unstable/InRelease + rm $APTARCHIVE/dists/unstable/Release.gpg + inject_evil_package + # build valid Release file + aptftparchive -qq release ./aptarchive > aptarchive/dists/unstable/Release + + assert_update_is_refused_and_last_good_state_used + + # ensure there is no _Release file downloaded + testfailure ls rootdir/var/lib/apt/lists/*_Release +} + +test_subvert_inrelease() +{ + # setup archive with InRelease + setupaptarchive_with_lists_clean + testsuccess aptget update + + # replace InRelease with something else + mv $APTARCHIVE/dists/unstable/Release $APTARCHIVE/dists/unstable/InRelease + + testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Does not start with a cleartext signature + +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + + # ensure we keep the repo + assert_repo_is_intact +} + +test_inrelease_to_invalid_inrelease() +{ + # setup archive with InRelease + setupaptarchive_with_lists_clean + testsuccess aptget update + + # now remove InRelease and subvert Release do no longer verify + sed -i 's/Codename.*/Codename: evil!'/ $APTARCHIVE/dists/unstable/InRelease + inject_evil_package + + testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) + +W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease + +W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + + # ensure we keep the repo + assert_repo_is_intact + testfailure grep "evil" rootdir/var/lib/apt/lists/*InRelease +} + +test_release_gpg_to_invalid_release_release_gpg() +{ + # setup archive with InRelease + setupaptarchive_with_lists_clean + rm $APTARCHIVE/dists/unstable/InRelease + testsuccess aptget update + + # now subvert Release do no longer verify + echo "Some evil data" >> $APTARCHIVE/dists/unstable/Release + inject_evil_package + + testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq + + assert_repo_is_intact + testfailure grep "evil" rootdir/var/lib/apt/lists/*Release +} + + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# a "normal" package with source and binary +buildsimplenativepackage 'foo' 'all' '2.0' + +# setup the archive and ensure we have a single package that installs fine +setupaptarchive +APTARCHIVE=$(readlink -f ./aptarchive) +assert_repo_is_intact + +# test the various cases where a repo may go from signed->unsigned +msgmsg "test_from_inrelease_to_unsigned" +test_from_inrelease_to_unsigned + +msgmsg "test_from_release_gpg_to_unsigned" +test_from_release_gpg_to_unsigned + +# ensure we do not regress on CVE-2012-0214 +msgmsg "test_cve_2012_0214" +test_cve_2012_0214 + +# ensure InRelase can not be subverted +msgmsg "test_subvert_inrelease" +test_subvert_inrelease + +# ensure we revert to last good state if InRelease does not verify +msgmsg "test_inrelease_to_invalid_inrelease" +test_inrelease_to_invalid_inrelease + +# ensure we revert to last good state if Release/Release.gpg does not verify +msgmsg "test_release_gpg_to_invalid_release_release_gpg" +test_release_gpg_to_invalid_release_release_gpg -- cgit v1.2.3 From bca84917c326fa3158e120147c8aecebe0789b47 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 26 Sep 2014 22:45:18 +0200 Subject: test fixes --- test/integration/test-apt-get-source-authenticated | 2 +- test/integration/test-apt-get-update-unauth-warning | 14 ++++++++++++-- test/integration/test-apt-update-rollback | 16 +++++++--------- test/integration/test-apt-update-unauth | 2 +- .../integration/test-bug-717891-abolute-uris-for-proxies | 2 +- test/integration/test-bug-738785-switch-protocol | 2 +- test/integration/test-policy-pinning | 3 ++- 7 files changed, 25 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated index 2cee13923..d73097b54 100755 --- a/test/integration/test-apt-get-source-authenticated +++ b/test/integration/test-apt-get-source-authenticated @@ -21,7 +21,7 @@ APTARCHIVE=$(readlink -f ./aptarchive) rm -f $APTARCHIVE/dists/unstable/*Release* # update without authenticated InRelease file -testsuccess aptget update +testsuccess aptget update --allow-unauthenticated # this all should fail testfailure aptget install -y foo diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index 4411a7430..b1c676738 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -18,11 +18,21 @@ setupaptarchive --no-update APTARCHIVE=$(readlink -f ./aptarchive) rm -f $APTARCHIVE/dists/unstable/*Release* -# update without authenticated InRelease file +# update without authenticated files leads to warning testequal "Ign file: unstable InRelease Ign file: unstable Release Reading package lists... -W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated." aptget update +W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated. +W: Use --allow-unauthenticated to force the update" aptget update + +# no package foo +testequal "Listing..." apt list foo + +# allow override +testequal "Ign file: unstable InRelease +Ign file: unstable Release +Reading package lists... +W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated." aptget update --allow-unauthenticated # ensure we can not install the package testequal "WARNING: The following packages cannot be authenticated! diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index ccd7f57ff..a88b0042b 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -75,15 +75,14 @@ test_inreleae_to_valid_release() { rm $APTARCHIVE/dists/unstable/Release.gpg avoid_ims_hit - # update works - testsuccess aptget update -o Debug::Acquire::Transaction=1 + # update fails + testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # test that we can install the new packages but do no longer have a sig testsuccess aptget install old -s - testsuccess aptget install new -s - testfailure ls $ROOTDIR/var/lib/apt/lists/*_InRelease - testfailure ls $ROOTDIR/var/lib/apt/lists/*_Release.gpg - testsuccess ls $ROOTDIR/var/lib/apt/lists/*_Release + testfailure aptget install new -s + testsuccess ls $ROOTDIR/var/lib/apt/lists/*_InRelease + testfailure ls $ROOTDIR/var/lib/apt/lists/*_Release } test_inreleae_to_release_reverts_all() { @@ -98,9 +97,7 @@ test_inreleae_to_release_reverts_all() { break_repository_sources_index # ensure error - testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch - -E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # -o Debug::acquire::transaction=1 + testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 # ensure that the Packages file is also rolled back testsuccess aptget install old -s @@ -112,6 +109,7 @@ E: Some index files failed to download. They have been ignored, or old ones used test_unauthenticated_to_invalid_inrelease() { msgmsg "Test UnAuthenticated to invalid InRelease reverts everything" create_fresh_archive + rm -rf rootdir/var/lib/apt/lists/* rm $APTARCHIVE/dists/unstable/InRelease rm $APTARCHIVE/dists/unstable/Release.gpg avoid_ims_hit diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth index 4e08b5e35..2e46e3ace 100755 --- a/test/integration/test-apt-update-unauth +++ b/test/integration/test-apt-update-unauth @@ -26,7 +26,7 @@ runtest() { rm -f aptarchive/dists/unstable/*Release* # remove uncompressed version find aptarchive/ -name Packages | xargs rm -f - aptget update -qq + aptget update -qq --allow-unauthenticated # become authenticated generatereleasefiles diff --git a/test/integration/test-bug-717891-abolute-uris-for-proxies b/test/integration/test-bug-717891-abolute-uris-for-proxies index ac1d6ec11..a8947b5e2 100755 --- a/test/integration/test-bug-717891-abolute-uris-for-proxies +++ b/test/integration/test-bug-717891-abolute-uris-for-proxies @@ -12,7 +12,7 @@ setupaptarchive changetowebserver --request-absolute='uri' msgtest 'Check that absolute paths are' 'not accepted' -testfailure --nomsg aptget update +testfailure --nomsg aptget update --allow-unauthenticated echo 'Acquire::http::Proxy "http://localhost:8080";' > rootdir/etc/apt/apt.conf.d/99proxy diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index 1e5748eae..4ff044515 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -60,4 +60,4 @@ mv rootdir/${COPYMETHODS}.bak rootdir/${COPYMETHODS} # check that downgrades from https to http are not allowed webserverconfig 'aptwebserver::support::http' 'true' sed -i -e 's#:8080/redirectme#:4433/downgrademe#' -e 's# http:# https:#' rootdir/etc/apt/sources.list.d/* -testfailure aptget update +testfailure aptget update --allow-unauthenticated diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning index 8eb4bcbad..2281d7a1d 100755 --- a/test/integration/test-policy-pinning +++ b/test/integration/test-policy-pinning @@ -28,7 +28,7 @@ Pinned packages:" aptcache policy $* aptgetupdate() { # just to be sure that no old files are used rm -rf rootdir/var/lib/apt - if aptget update -qq 2>&1 | grep '^E: '; then + if aptget update --allow-unauthenticated -qq 2>&1 | grep '^E: '; then msgwarn 'apt-get update failed with an error' fi } @@ -36,6 +36,7 @@ aptgetupdate() { ### not signed archive aptgetupdate + testequalpolicy 100 500 testequalpolicy 990 500 -t now -- cgit v1.2.3 From 2a884c612b10b27f4be2cc6dd689bfe448d9361a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 17 Aug 2014 12:30:21 +0200 Subject: fix progress output for (dist-)upgrade calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, we had a start and a done of the calculation printed by higher-level code, but this got intermixed by progress reporting from an external solver or the output of autoremove code… The higherlevel code is now only responsible for instantiating a progress object of its choosing (if it wants progress after all) and the rest will be handled by the upgrade code. Either it is used to show the progress of the external solver or the internal solver will give some hints about its overall progress. The later isn't really a proper progress as it will jump forward after each substep, but that is at least a bit better than before without any progress indication. Fixes also the 'strange' non-display of this progress line in -q=1, while all others are shown, which is reflected by all testcase changes. --- test/integration/test-allow-scores-for-all-dependency-types | 6 ++++++ test/integration/test-apt-get-upgrade | 3 +++ test/integration/test-bug-507998-dist-upgrade-recommends | 1 + test/integration/test-bug-591882-conkeror | 2 ++ test/integration/test-bug-605394-versioned-or-groups | 1 + test/integration/test-bug-612099-multiarch-conflicts | 2 ++ test/integration/test-bug-64141-install-dependencies-for-on-hold | 2 ++ test/integration/test-bug-657695-resolver-breaks-on-virtuals | 1 + test/integration/test-bug-675449-essential-are-protected | 1 + test/integration/test-bug-680041-apt-mark-holds-correctly | 4 ++++ test/integration/test-bug-686346-package-missing-architecture | 1 + test/integration/test-bug-735967-lib32-to-i386-unavailable | 2 ++ test/integration/test-bug-740843-versioned-up-down-breaks | 2 ++ test/integration/test-bug-758153-versioned-provides-support | 1 + test/integration/test-conflicts-loop | 1 + test/integration/test-pin-non-existent-package | 3 +++ .../test-prevent-markinstall-multiarch-same-versionscrew | 1 + test/integration/test-provides-gone-with-upgrade | 1 + test/integration/test-resolve-by-keep-new-recommends | 1 + test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard | 2 ++ .../test-ubuntu-bug-985852-pre-depends-or-group-ordering | 1 + .../test-very-tight-loop-configure-with-unpacking-new-packages | 1 + test/integration/test-xorg-break-providers | 2 ++ 23 files changed, 42 insertions(+) (limited to 'test') diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types index a5c98f3d6..d1bcf1130 100755 --- a/test/integration/test-allow-scores-for-all-dependency-types +++ b/test/integration/test-allow-scores-for-all-dependency-types @@ -39,6 +39,7 @@ insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev' insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7' testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: libdb5.1-dev The following NEW packages will be installed: @@ -53,6 +54,7 @@ Conf libdb5.3-dev (5.3.28-3 unversioned [amd64]) Conf libdb-dev (5.3.0 unversioned [amd64])' aptget dist-upgrade -st unversioned testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: libdb5.1-dev The following NEW packages will be installed: @@ -71,21 +73,25 @@ insertinstalledpackage 'foo' 'amd64' '1' insertinstalledpackage 'bar' 'amd64' '1' testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: bar foo 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st unversioned testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: bar foo 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st versioned testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: bar foo 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st multipleno testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: foo The following packages will be upgraded: diff --git a/test/integration/test-apt-get-upgrade b/test/integration/test-apt-get-upgrade index 23446299c..5335c243a 100755 --- a/test/integration/test-apt-get-upgrade +++ b/test/integration/test-apt-get-upgrade @@ -31,6 +31,7 @@ setupaptarchive # Test if normal upgrade works as expected testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: upgrade-with-conflict upgrade-with-new-dep The following packages will be upgraded: @@ -42,6 +43,7 @@ Conf upgrade-simple (2.0 unstable [all])' aptget -s upgrade # Test if apt-get upgrade --with-new-pkgs works testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following NEW packages will be installed: new-dep The following packages have been kept back: @@ -59,6 +61,7 @@ Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s upgrade --with-new-pkg # Test if apt-get dist-upgrade works testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: conflicting-dep The following NEW packages will be installed: diff --git a/test/integration/test-bug-507998-dist-upgrade-recommends b/test/integration/test-bug-507998-dist-upgrade-recommends index 513421a94..f3b4e04fb 100755 --- a/test/integration/test-bug-507998-dist-upgrade-recommends +++ b/test/integration/test-bug-507998-dist-upgrade-recommends @@ -16,6 +16,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: tshark wireshark-common 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/integration/test-bug-591882-conkeror b/test/integration/test-bug-591882-conkeror index e1c0b42d1..891ddb8b7 100755 --- a/test/integration/test-bug-591882-conkeror +++ b/test/integration/test-bug-591882-conkeror @@ -9,6 +9,7 @@ setupaptarchive UPGRADEFAIL="Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: conkeror libdatrie0 libkrb53 libxcb-xlib0 xulrunner-1.9 The following NEW packages will be installed: @@ -40,6 +41,7 @@ E: Trivial Only specified but this is not a trivial operation." UPGRADESUCCESS="Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: libdatrie0 libkrb53 libxcb-xlib0 xulrunner-1.9 The following NEW packages will be installed: diff --git a/test/integration/test-bug-605394-versioned-or-groups b/test/integration/test-bug-605394-versioned-or-groups index 0f09d2927..bb72d59e3 100755 --- a/test/integration/test-bug-605394-versioned-or-groups +++ b/test/integration/test-bug-605394-versioned-or-groups @@ -9,6 +9,7 @@ setupaptarchive testequal "Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: php5 php5-cgi 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts index 20dc3a7e5..c32600037 100755 --- a/test/integration/test-bug-612099-multiarch-conflicts +++ b/test/integration/test-bug-612099-multiarch-conflicts @@ -70,6 +70,7 @@ Conf foobar (1.0 stable [i386])' aptget install foobar/stable libc6 -st testing testequal 'Reading package lists... Building dependency tree... Reading state information... +Calculating upgrade... The following packages will be upgraded: libc6 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. @@ -168,6 +169,7 @@ Conf libc6-same:amd64 (1.0 stable [amd64])' aptget install libc6-same:amd64 -s - testequal 'Reading package lists... Building dependency tree... Reading state information... +Calculating upgrade... The following packages will be upgraded: libc6-same 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/integration/test-bug-64141-install-dependencies-for-on-hold b/test/integration/test-bug-64141-install-dependencies-for-on-hold index 9a9e7be10..9e6c223a8 100755 --- a/test/integration/test-bug-64141-install-dependencies-for-on-hold +++ b/test/integration/test-bug-64141-install-dependencies-for-on-hold @@ -21,6 +21,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: oldcrap The following NEW packages will be installed: @@ -35,6 +36,7 @@ testsuccess aptmark hold apt testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: apt The following packages will be upgraded: diff --git a/test/integration/test-bug-657695-resolver-breaks-on-virtuals b/test/integration/test-bug-657695-resolver-breaks-on-virtuals index e9b27cfcd..1b92a04fe 100755 --- a/test/integration/test-bug-657695-resolver-breaks-on-virtuals +++ b/test/integration/test-bug-657695-resolver-breaks-on-virtuals @@ -18,6 +18,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: xserver-xorg-video-driver1 xserver-xorg-video-driver10 xserver-xorg-video-driver11 xserver-xorg-video-driver12 diff --git a/test/integration/test-bug-675449-essential-are-protected b/test/integration/test-bug-675449-essential-are-protected index 7d8cc3484..2a27c62b1 100755 --- a/test/integration/test-bug-675449-essential-are-protected +++ b/test/integration/test-bug-675449-essential-are-protected @@ -69,6 +69,7 @@ Purg pkg-none-foreign:i386 [1]' aptget purge pkg-none-foreign:i386 -s testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following NEW packages will be installed: pkg-depends-new:i386 pkg-none-new The following packages will be upgraded: diff --git a/test/integration/test-bug-680041-apt-mark-holds-correctly b/test/integration/test-bug-680041-apt-mark-holds-correctly index 2e5e39c8e..3f40c23dc 100755 --- a/test/integration/test-bug-680041-apt-mark-holds-correctly +++ b/test/integration/test-bug-680041-apt-mark-holds-correctly @@ -19,6 +19,7 @@ runtests() { testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: pkgall pkgarch 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. @@ -30,6 +31,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgr testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: pkgarch The following packages will be upgraded: @@ -43,6 +45,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgr testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: pkgall pkgarch 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. @@ -54,6 +57,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgr testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: pkgall The following packages will be upgraded: diff --git a/test/integration/test-bug-686346-package-missing-architecture b/test/integration/test-bug-686346-package-missing-architecture index dc51861ab..8024f81da 100755 --- a/test/integration/test-bug-686346-package-missing-architecture +++ b/test/integration/test-bug-686346-package-missing-architecture @@ -53,6 +53,7 @@ testnopackage pkge:* # this difference seems so important that it has to be maintained … testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade -s # pkgd has no update with an architecture diff --git a/test/integration/test-bug-735967-lib32-to-i386-unavailable b/test/integration/test-bug-735967-lib32-to-i386-unavailable index e9f3bf96d..826931fe4 100755 --- a/test/integration/test-bug-735967-lib32-to-i386-unavailable +++ b/test/integration/test-bug-735967-lib32-to-i386-unavailable @@ -33,6 +33,7 @@ testsuccess aptget update testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: lib32nss-mdns The following packages will be upgraded: @@ -60,6 +61,7 @@ testsuccess aptget update testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following NEW packages will be installed: libnss-mdns:i386 libnss-mdns-i386:i386 The following packages will be upgraded: diff --git a/test/integration/test-bug-740843-versioned-up-down-breaks b/test/integration/test-bug-740843-versioned-up-down-breaks index cb035a71f..9426ffad1 100755 --- a/test/integration/test-bug-740843-versioned-up-down-breaks +++ b/test/integration/test-bug-740843-versioned-up-down-breaks @@ -24,6 +24,7 @@ setupaptarchive testequalor2 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. @@ -38,6 +39,7 @@ Conf libgl1-foo-glx:i386 (2 stable [i386]) Conf libgl1-foo-glx (2 stable [amd64]) Conf foo-driver (2 stable [amd64])' 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/integration/test-bug-758153-versioned-provides-support b/test/integration/test-bug-758153-versioned-provides-support index 2904ae5a1..21f9123c9 100755 --- a/test/integration/test-bug-758153-versioned-provides-support +++ b/test/integration/test-bug-758153-versioned-provides-support @@ -28,6 +28,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: webapp webserver 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop index a2c411aaf..0906ef8fa 100755 --- a/test/integration/test-conflicts-loop +++ b/test/integration/test-conflicts-loop @@ -17,6 +17,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/integration/test-pin-non-existent-package b/test/integration/test-pin-non-existent-package index 35de22115..c567e5285 100755 --- a/test/integration/test-pin-non-existent-package +++ b/test/integration/test-pin-non-existent-package @@ -26,6 +26,7 @@ testcandidate rapt '0.8.15' testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only echo 'Package: rapt @@ -36,6 +37,7 @@ testcandidate rapt '(none)' testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only echo ' @@ -55,6 +57,7 @@ testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only echo 'Package: arch:amd64 diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index d647856cb..9d2ea2d5d 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -43,6 +43,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: out-of-sync-gone-foreign:i386 out-of-sync-gone-native The following packages have been kept back: diff --git a/test/integration/test-provides-gone-with-upgrade b/test/integration/test-provides-gone-with-upgrade index 70384ce29..3b4bc2d04 100755 --- a/test/integration/test-provides-gone-with-upgrade +++ b/test/integration/test-provides-gone-with-upgrade @@ -15,6 +15,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following NEW packages will be installed: libapt-pkg4.10 The following packages will be upgraded: diff --git a/test/integration/test-resolve-by-keep-new-recommends b/test/integration/test-resolve-by-keep-new-recommends index 8134b76aa..6b1772877 100755 --- a/test/integration/test-resolve-by-keep-new-recommends +++ b/test/integration/test-resolve-by-keep-new-recommends @@ -13,6 +13,7 @@ setupaptarchive UPGRADE_KEEP="Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: foo 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." diff --git a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard index 2f2d384e1..45f70a898 100755 --- a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard +++ b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard @@ -27,6 +27,7 @@ setupaptarchive # discourage keeping obsolete high-priority packages … testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be REMOVED: not-downloadable The following packages will be upgraded: @@ -43,6 +44,7 @@ done testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages have been kept back: upgradable 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.' aptget -s dist-upgrade diff --git a/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering index 462acad00..d2b6b9bad 100755 --- a/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering +++ b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering @@ -14,6 +14,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: custom 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages index c1d454f88..202716636 100755 --- a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages +++ b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages @@ -28,6 +28,7 @@ setupaptarchive testequalor2 'Reading package lists... Building dependency tree... +Calculating upgrade... The following NEW packages will be installed: ure The following packages will be upgraded: diff --git a/test/integration/test-xorg-break-providers b/test/integration/test-xorg-break-providers index 139d2c915..0be57d979 100755 --- a/test/integration/test-xorg-break-providers +++ b/test/integration/test-xorg-break-providers @@ -26,6 +26,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget install x testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: xserver-xorg-core xserver-xorg-video-intel 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. @@ -35,6 +36,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget upgrade - testequal 'Reading package lists... Building dependency tree... +Calculating upgrade... The following packages will be upgraded: xserver-xorg-core xserver-xorg-video-intel 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. -- cgit v1.2.3 From 12841e8320aa499554ac50b102b222900bb1b879 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 24 Jan 2014 23:48:11 +0100 Subject: use apt-key adv (+ gnupg) instead of gpgv for verify apt-key does the keyring merge as we need it, so we just call it instead of reimplementing it to do the merging before gpgv. This means we don't use gpgv anymore (we never depended on it explicitly - bad style), but it also means that the message in apt-cdrom add is a bit less friendly as it says loudly "untrusted key", but for a one-time command its okay. --- test/integration/framework | 1 + test/integration/test-apt-cdrom | 2 +- test/integration/test-apt-key-net-update | 7 +++++- .../integration/test-bug-733028-gpg-resource-limit | 27 ++++++++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 test/integration/test-bug-733028-gpg-resource-limit (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 7cf4d8a6d..a9ba0014f 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -223,6 +223,7 @@ setupenvironment() { echo "Debug::NoLocking \"true\";" >> aptconfig.conf echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf + echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 8d8fdf167..9fbc4288d 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -29,7 +29,7 @@ aptcdromlog() { test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 aptkey.list +testfileequal ./aptkey.list 'pub 1024R/F68C85A3 2013-12-19 +pub 2048R/DBAC8DAE 2010-08-18' # now try a different one # setup archive-keyring @@ -40,4 +43,6 @@ echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf testequal "Checking for new archive signing keys now Key 'E8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update - +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 1024R/F68C85A3 2013-12-19 +pub 2048R/DBAC8DAE 2010-08-18' diff --git a/test/integration/test-bug-733028-gpg-resource-limit b/test/integration/test-bug-733028-gpg-resource-limit new file mode 100755 index 000000000..f9c804963 --- /dev/null +++ b/test/integration/test-bug-733028-gpg-resource-limit @@ -0,0 +1,27 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +insertpackage 'unstable' 'foobar' 'all' '1' + +setupaptarchive --no-update + +for i in $(seq 1 50); do + touch rootdir/etc/apt/trusted.gpg.d/emptykey-${i}.gpg +done + +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + +msgtest 'Test for no gpg errors/warnings in' 'apt-get update' +aptget update > update.log 2>&1 +if grep -iq 'GPG' update.log; then + msgfail + cat update.log +else + msgpass +fi -- cgit v1.2.3 From 93d0d08cdd6854f9bfb779c13b5b78cd6ed263aa Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 26 Jan 2014 18:28:50 +0100 Subject: support gnupg2 as drop-in replacement for gnupg If both are available APT will still prefer gpg over gpg2 as it is a bit more lightweight, but it shouldn't be a problem to use one or the other (at least at the moment, who knows what will happen in the future). --- test/integration/test-apt-key | 191 ++++++++++++++++++++++++------------------ 1 file changed, 108 insertions(+), 83 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index 68b3f9710..99ce855d4 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -7,101 +7,126 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' -msgtest 'Check that paths in list output are not' 'double-slashed' -aptkey list 2>&1 | grep -q '//' && msgfail || msgpass - -msgtest 'Check that paths in finger output are not' 'double-slashed' -aptkey finger 2>&1 | grep -q '//' && msgfail || msgpass +# start from a clean plate again +cleanplate() { + rm -rf rootdir/etc/apt/trusted.gpg.d/ rootdir/etc/apt/trusted.gpg + mkdir rootdir/etc/apt/trusted.gpg.d/ +} echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub"; APT::Key::RemovedKeys "./keys/rexexpired.pub";' > rootdir/etc/apt/apt.conf.d/aptkey.conf -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' +testrun() { + cleanplate + ln -sf ${TMPWORKINGDIRECTORY}/keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg -testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) " not changed -gpg: Total number processed: 1 -gpg: unchanged: 1' aptkey --fakeroot update + msgtest 'Check that paths in list output are not' 'double-slashed' + aptkey list 2>&1 | grep -q '//' && msgfail || msgpass -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + msgtest 'Check that paths in finger output are not' 'double-slashed' + aptkey finger 2>&1 | grep -q '//' && msgfail || msgpass -testsuccess aptkey --fakeroot add ./keys/rexexpired.pub - -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] -pub 2048R/DBAC8DAE 2010-08-18' + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' -msgtest 'Execute update again to trigger removal of' 'Rex Expired key' -testsuccess --nomsg aptkey --fakeroot update + testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) " not changed +gpg: Total number processed: 1 +gpg: unchanged: 1' aptkey --fakeroot update -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' -msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring' -testsuccess --nomsg aptkey --fakeroot --keyring rootdir/etc/apt/trusted.gpg del DBAC8DAE + testsuccess aptkey --fakeroot add ./keys/rexexpired.pub -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] +pub 2048R/DBAC8DAE 2010-08-18' -testsuccess aptkey --fakeroot del DBAC8DAE -testempty aptkey list + msgtest 'Execute update again to trigger removal of' 'Rex Expired key' + testsuccess --nomsg aptkey --fakeroot update + + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + + msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring' + testsuccess --nomsg aptkey --fakeroot --keyring rootdir/etc/apt/trusted.gpg del DBAC8DAE + + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + + testsuccess aptkey --fakeroot del DBAC8DAE + testempty aptkey list + + msgtest 'Test key removal with' 'single key in real file' + cleanplate + cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess --nomsg aptkey --fakeroot del DBAC8DAE + testempty aptkey list + testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + + msgtest 'Test key removal with' 'single key in softlink' + cleanplate + ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess --nomsg aptkey --fakeroot del DBAC8DAE + testempty aptkey list + testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess test -L rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + + cleanplate + testsuccess aptkey --fakeroot add ./keys/joesixpack.pub + testsuccess aptkey --fakeroot add ./keys/marvinparanoid.pub + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18 +pub 2048R/528144E2 2011-01-16' + cp -a rootdir/etc/apt/trusted.gpg keys/testcase-multikey.pub # store for reuse + + msgtest 'Test key removal with' 'multi key in real file' + cleanplate + cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg + testsuccess --nomsg aptkey --fakeroot del DBAC8DAE + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' + testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ + + msgtest 'Test key removal with' 'multi key in softlink' + cleanplate + ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir/etc/apt/trusted.gpg.d/multikey.gpg + testsuccess --nomsg aptkey --fakeroot del DBAC8DAE + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' + testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ + testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg + testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ + + msgtest 'Test key removal with' 'multiple files including key' + cleanplate + cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg + testsuccess --nomsg aptkey --fakeroot del DBAC8DAE + aptkey list | grep '^pub' > aptkey.list + testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' + testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ +} -# start from a clean plate again -cleanplate() { - rm -rf rootdir/etc/apt/trusted.gpg.d/ rootdir/etc/apt/trusted.gpg - mkdir rootdir/etc/apt/trusted.gpg.d/ +setupgpgcommand() { + echo "APT::Key::GPGCommand \"$1\";" > rootdir/etc/apt/apt.conf.d/00gpgcmd + msgtest 'Test that apt-key uses for the following tests command' "$1" + aptkey adv --version >aptkey.version 2>&1 + if grep -q "^Executing: $1 --" aptkey.version; then + msgpass + else + cat aptkey.version + msgfail + fi } -msgtest 'Test key removal with' 'single key in real file' -cleanplate -cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg -testsuccess --nomsg aptkey --fakeroot del DBAC8DAE -testempty aptkey list -testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg -testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ - -msgtest 'Test key removal with' 'single key in softlink' -cleanplate -ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg -testsuccess --nomsg aptkey --fakeroot del DBAC8DAE -testempty aptkey list -testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg -testsuccess test -L rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ - -cleanplate -testsuccess aptkey --fakeroot add ./keys/joesixpack.pub -testsuccess aptkey --fakeroot add ./keys/marvinparanoid.pub -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18 -pub 2048R/528144E2 2011-01-16' -cp -a rootdir/etc/apt/trusted.gpg keys/testcase-multikey.pub # store for reuse - -msgtest 'Test key removal with' 'multi key in real file' -cleanplate -cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg -testsuccess --nomsg aptkey --fakeroot del DBAC8DAE -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' -testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ - -msgtest 'Test key removal with' 'multi key in softlink' -cleanplate -ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir/etc/apt/trusted.gpg.d/multikey.gpg -testsuccess --nomsg aptkey --fakeroot del DBAC8DAE -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' -testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ -testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg -testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ - -msgtest 'Test key removal with' 'multiple files including key' -cleanplate -cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg -cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg -testsuccess --nomsg aptkey --fakeroot del DBAC8DAE -aptkey list | grep '^pub' > aptkey.list -testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' -testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg -testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ -testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ +# run with default (whatever this is) +testrun +# run with … +setupgpgcommand 'gpg' +testrun +setupgpgcommand 'gpg2' +testrun -- cgit v1.2.3 From f1e1abd88a2a7f147c79b99956f88d37ab14e038 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 26 Jan 2014 19:23:58 +0100 Subject: use apt-key to wrap gpg calls in testcases beside testing apt-key a bit it also avoids duplicating gpghome setup code in apt-key and the test framework Git-Dch: Ignore --- test/integration/framework | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index a9ba0014f..1ab01b20a 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -133,13 +133,6 @@ gdb() { shift runapt command gdb --quiet -ex run "${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@" } -gpg() { - # see apt-key for the whole trickery. Setup is done in setupenvironment - command gpg --ignore-time-conflict --no-options --no-default-keyring \ - --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \ - --no-auto-check-trustdb --trust-model always \ - "$@" -} exitwithstatus() { # error if we about to overflow, but ... @@ -239,19 +232,6 @@ setupenvironment() { echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary configcompression '.' 'gz' #'bz2' 'lzma' 'xz' - # gpg needs a trustdb to function, but it can't be invalid (not even empty) - # see also apt-key where this trickery comes from: - local TRUSTDBDIR="${TMPWORKINGDIRECTORY}/gnupghome" - mkdir "$TRUSTDBDIR" - chmod 700 "$TRUSTDBDIR" - # We also don't use a secret keyring, of course, but gpg panics and - # implodes if there isn't one available - and writeable for imports - local SECRETKEYRING="${TRUSTDBDIR}/secring.gpg" - touch $SECRETKEYRING - # now create the trustdb with an (empty) dummy keyring - # newer gpg versions are fine without it, but play it safe for now - gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1 - # cleanup the environment a bit # prefer our apt binaries over the system apt binaries export PATH="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin" @@ -449,8 +429,8 @@ Package: $NAME" >> ${BUILDDIR}/debian/control | while read SRC; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then -# gpg --yes --secret-keyring ./keys/joesixpack.sec \ -# --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \ +# aptkey --keyring ./keys/joesixpack.pub --quiet adv --yes \ +# --secret-keyring ./keys/joesixpack.sec --default-key 'Joe Sixpack' \ # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" # fi @@ -835,8 +815,9 @@ setupaptarchive() { signreleasefiles() { local SIGNER="${1:-Joe Sixpack}" - local GPG="gpg --batch --yes" - msgninfo "\tSign archive with $SIGNER key… " + local KEY="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | sed 's# ##g')" + local GPG="aptkey --quiet --keyring ${KEY}.pub adv --batch --yes --secret-keyring ${KEY}.sec" + msgninfo "\tSign archive with $SIGNER key $KEY… " local REXKEY='keys/rexexpired' local SECEXPIREBAK="${REXKEY}.sec.bak" local PUBEXPIREBAK="${REXKEY}.pub.bak" @@ -852,17 +833,14 @@ signreleasefiles() { cp $SECUNEXPIRED ${REXKEY}.sec cp $PUBUNEXPIRED ${REXKEY}.pub else - printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub --secret-keyring ${REXKEY}.sec --command-fd 0 --edit-key "${SIGNER}" >/dev/null 2>&1 || true + if ! printf "expire\n1w\nsave\n" | $GPG --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then + cat setexpire.gpg + exit 1 + fi cp ${REXKEY}.sec $SECUNEXPIRED cp ${REXKEY}.pub $PUBUNEXPIRED fi fi - for KEY in $(find keys/ -name '*.sec'); do - GPG="$GPG --secret-keyring $KEY" - done - for KEY in $(find keys/ -name '*.pub'); do - GPG="$GPG --keyring $KEY" - done for RELEASE in $(find aptarchive/ -name Release); do $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg ${RELEASE} local INRELEASE="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" -- cgit v1.2.3 From 38005d8b24bb81f4862d2c2a228e4a49a2af4ccd Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 27 Jan 2014 16:59:46 +0100 Subject: add a test for apt-key export{,all} Git-Dch: Ignore --- test/integration/test-apt-key | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index 99ce855d4..e863e54a4 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -42,6 +42,13 @@ gpg: unchanged: 1' aptkey --fakeroot update testfileequal ./aptkey.list 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] pub 2048R/DBAC8DAE 2010-08-18' + msgtest 'Check that Sixpack key can be' 'exported' + aptkey export 'Sixpack' > aptkey.export + aptkey --keyring rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg exportall > aptkey.exportall + testsuccess --nomsg cmp aptkey.export aptkey.exportall + testsuccess test -s aptkey.export + testsuccess test -s aptkey.exportall + msgtest 'Execute update again to trigger removal of' 'Rex Expired key' testsuccess --nomsg aptkey --fakeroot update -- cgit v1.2.3 From ba72845c07b2682f251dc7661869d20095260f8f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 27 Jan 2014 17:04:53 +0100 Subject: allow to specify fingerprints in 'apt-key del' --- test/integration/test-apt-key | 8 ++++++++ test/integration/test-apt-key-net-update | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index e863e54a4..6bece40d7 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -72,6 +72,14 @@ pub 2048R/DBAC8DAE 2010-08-18' testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + msgtest 'Test key removal with' 'fingerprint' + cleanplate + cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess --nomsg aptkey --fakeroot del 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE + testempty aptkey list + testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + msgtest 'Test key removal with' 'single key in softlink' cleanplate ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg diff --git a/test/integration/test-apt-key-net-update b/test/integration/test-apt-key-net-update index b5fb796d0..b3c118555 100755 --- a/test/integration/test-apt-key-net-update +++ b/test/integration/test-apt-key-net-update @@ -41,7 +41,7 @@ echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf # test against the "real" webserver testequal "Checking for new archive signing keys now -Key 'E8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update +Key 'DE66AECA9151AFA1877EC31DE8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update aptkey list | grep '^pub' > aptkey.list testfileequal ./aptkey.list 'pub 1024R/F68C85A3 2013-12-19 -- cgit v1.2.3 From bd7fb5aa31f58917e8630f2981e78d190d465198 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 27 Jan 2014 18:26:44 +0100 Subject: add --secret-keyring option for apt-key For some advanced usecases it might be handy to specify the secret keyring to be used (e.g. as it is used in the testcases), but specifying it via a normal option for gnupg might not be available forever: http://lists.gnupg.org/pipermail/gnupg-users/2013-August/047180.html Git-Dch: Ignore --- test/integration/framework | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 1ab01b20a..50f16fb46 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -429,8 +429,8 @@ Package: $NAME" >> ${BUILDDIR}/debian/control | while read SRC; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then -# aptkey --keyring ./keys/joesixpack.pub --quiet adv --yes \ -# --secret-keyring ./keys/joesixpack.sec --default-key 'Joe Sixpack' \ +# aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet \ +# adv --yes --default-key 'Joe Sixpack' \ # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" # fi @@ -816,7 +816,7 @@ setupaptarchive() { signreleasefiles() { local SIGNER="${1:-Joe Sixpack}" local KEY="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | sed 's# ##g')" - local GPG="aptkey --quiet --keyring ${KEY}.pub adv --batch --yes --secret-keyring ${KEY}.sec" + local GPG="aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec adv --batch --yes" msgninfo "\tSign archive with $SIGNER key $KEY… " local REXKEY='keys/rexexpired' local SECEXPIREBAK="${REXKEY}.sec.bak" -- cgit v1.2.3 From 0dae96a2b5e8ecd80a1b6e44961f1692ad4aec15 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 27 Jan 2014 22:07:16 +0100 Subject: use only one --keyring in gpg interactions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were down to at most two keyrings before, but gnupg upstream plans dropping support for multiple keyrings in the longrun, so with a single keyring we hope to be future proof – and 'apt-key adv' isn't a problem anymore as every change to the keys is merged back, so we have now the same behavior as before, but support an unlimited amount of trusted.gpg.d keyrings. --- test/integration/test-apt-key | 57 +++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index 6bece40d7..337b16a59 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -13,6 +13,13 @@ cleanplate() { mkdir rootdir/etc/apt/trusted.gpg.d/ } +testaptkeys() { + if ! aptkey list | grep '^pub' > aptkey.list; then + echo -n > aptkey.list + fi + testequal "$1" cat ./aptkey.list +} + echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub"; APT::Key::RemovedKeys "./keys/rexexpired.pub";' > rootdir/etc/apt/apt.conf.d/aptkey.conf @@ -26,20 +33,17 @@ testrun() { msgtest 'Check that paths in finger output are not' 'double-slashed' aptkey finger 2>&1 | grep -q '//' && msgfail || msgpass - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) " not changed gpg: Total number processed: 1 gpg: unchanged: 1' aptkey --fakeroot update - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' testsuccess aptkey --fakeroot add ./keys/rexexpired.pub - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] + testaptkeys 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] pub 2048R/DBAC8DAE 2010-08-18' msgtest 'Check that Sixpack key can be' 'exported' @@ -52,14 +56,12 @@ pub 2048R/DBAC8DAE 2010-08-18' msgtest 'Execute update again to trigger removal of' 'Rex Expired key' testsuccess --nomsg aptkey --fakeroot update - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring' testsuccess --nomsg aptkey --fakeroot --keyring rootdir/etc/apt/trusted.gpg del DBAC8DAE - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' testsuccess aptkey --fakeroot del DBAC8DAE testempty aptkey list @@ -91,8 +93,7 @@ pub 2048R/DBAC8DAE 2010-08-18' cleanplate testsuccess aptkey --fakeroot add ./keys/joesixpack.pub testsuccess aptkey --fakeroot add ./keys/marvinparanoid.pub - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18 + testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18 pub 2048R/528144E2 2011-01-16' cp -a rootdir/etc/apt/trusted.gpg keys/testcase-multikey.pub # store for reuse @@ -100,16 +101,14 @@ pub 2048R/528144E2 2011-01-16' cleanplate cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' + testaptkeys 'pub 2048R/528144E2 2011-01-16' testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ msgtest 'Test key removal with' 'multi key in softlink' cleanplate ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' + testaptkeys 'pub 2048R/528144E2 2011-01-16' testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ @@ -119,11 +118,33 @@ pub 2048R/528144E2 2011-01-16' cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE - aptkey list | grep '^pub' > aptkey.list - testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' + testaptkeys 'pub 2048R/528144E2 2011-01-16' testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ + + cleanplate + cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg + testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18 +pub 2048R/DBAC8DAE 2010-08-18 +pub 2048R/528144E2 2011-01-16' + msgtest 'Test merge-back of' 'added keys' + testsuccess --nomsg aptkey adv --batch --yes --import keys/rexexpired.pub + testaptkeys 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] +pub 2048R/DBAC8DAE 2010-08-18 +pub 2048R/DBAC8DAE 2010-08-18 +pub 2048R/528144E2 2011-01-16' + + msgtest 'Test merge-back of' 'removed keys' + testsuccess --nomsg aptkey adv --batch --yes --delete-keys 27CE74F9 + testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18 +pub 2048R/DBAC8DAE 2010-08-18 +pub 2048R/528144E2 2011-01-16' + + msgtest 'Test merge-back of' 'removed duplicate keys' + testsuccess --nomsg aptkey adv --batch --yes --delete-keys DBAC8DAE + testaptkeys 'pub 2048R/528144E2 2011-01-16' } setupgpgcommand() { -- cgit v1.2.3 From 33a2267214eed2a11281c9f93b8cf10b4c436d94 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Feb 2014 17:56:28 +0100 Subject: add --readonly option for apt-key adv Some advanced commands can be executed without the keyring being modified like --verify, so this adds an option to disable the mergeback and uses it for our gpg calling code. Git-Dch: Ignore --- test/integration/framework | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 50f16fb46..fcdca34ce 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -429,7 +429,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control | while read SRC; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then -# aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet \ +# aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ # adv --yes --default-key 'Joe Sixpack' \ # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" @@ -816,7 +816,7 @@ setupaptarchive() { signreleasefiles() { local SIGNER="${1:-Joe Sixpack}" local KEY="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | sed 's# ##g')" - local GPG="aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec adv --batch --yes" + local GPG="aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly adv --batch --yes" msgninfo "\tSign archive with $SIGNER key $KEY… " local REXKEY='keys/rexexpired' local SECEXPIREBAK="${REXKEY}.sec.bak" -- cgit v1.2.3 From 29f1b977100aeb6d6ebd38923eeb7a623e264ffe Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 18 Aug 2014 12:54:19 +0200 Subject: ensure apt-key del handles 16-byte key ids The original patch does not apply against the rewritten apt-key, but an additional test doesn't hurt. Closes: 754436 --- test/integration/test-apt-key | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index 337b16a59..d5adec5bd 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -74,6 +74,14 @@ pub 2048R/DBAC8DAE 2010-08-18' testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + msgtest 'Test key removal with' 'long key ID' + cleanplate + cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE + testempty aptkey list + testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + msgtest 'Test key removal with' 'fingerprint' cleanplate cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg -- cgit v1.2.3 From 98f0d7b3d9d7ed0a5cf11d8f9327a021954816b6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 26 Sep 2014 23:09:01 +0200 Subject: add gnupg and gnupg2 as test-dependency apt can work with both, so it has an or-dependency on them, but the tests want to play with both of them. Git-Dch: Ignore --- .../test-very-tight-loop-configure-with-unpacking-new-packages | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages index 202716636..409d1212c 100755 --- a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages +++ b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages @@ -45,6 +45,7 @@ Conf libreoffice-core (4 sid [amd64]) Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice (4 sid [amd64])' 'Reading package lists... Building dependency tree... +Calculating upgrade... The following NEW packages will be installed: ure The following packages will be upgraded: -- cgit v1.2.3 From 43acd01979039b248cb7f033b82e36d778d0ebec Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 27 Sep 2014 19:45:30 +0200 Subject: allow fetcher setup without directory creation apt-get download and changelog as well as apt-helper reuse the acquire system for their own proposes without requiring the directories the fetcher wants to create, which is a problem if you run them as non-root and the directories do not exist as it greets you with: E: Archives directory /var/cache/apt/archives/partial is missing. - Acquire (13: Permission denied) Closes: 762898 --- test/integration/test-apt-get-changelog | 6 ++++++ test/integration/test-apt-get-download | 27 +++++++++++++++++++++++++-- test/integration/test-apt-helper | 14 +++++++------- 3 files changed, 38 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 4ee113482..02d6c39ab 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -13,6 +13,12 @@ setupaptarchive --no-update changetowebserver testsuccess aptget update +# simulate normal user with non-existent root-owned directories +rm -rf rootdir/var/cache/apt/archives/ +mkdir rootdir/var/cache/apt/archives/ +addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;" +chmod -R -w rootdir/var/cache/apt/archives + echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index be3144e1f..58ed44f8f 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -20,10 +20,19 @@ testdownload() { fi msgtest "Test download of package file $1 with" "$APT" testsuccess --nomsg aptget download ${APT} - testsuccess test -f $1 - rm $1 + testsuccess test -f "$1" + rm -f "$1" } +# normal case as "root" +testdownload apt_2.0_all.deb apt + +# simulate normal user with non-existent root-owned directories +rm -rf rootdir/var/cache/apt/archives/ +mkdir rootdir/var/cache/apt/archives/ +addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;" +chmod -R -w rootdir/var/cache/apt/archives + # normal case(es) testdownload apt_1.0_all.deb apt stable testdownload apt_2.0_all.deb apt @@ -45,3 +54,17 @@ rm -f apt_1.0_all.deb apt_2.0_all.deb testsuccess aptget download apt apt apt/unstable apt=2.0 testsuccess test -s apt_2.0_all.deb +# restore "root" rights +chmod -f -R +w $PWD/rootdir/var/cache/apt/archives +rm -rf rootdir/var/cache/apt/archives/ + +# file: debs aren't copied to archives, so change to http which obviously are +changetowebserver +testsuccess aptget update + +# test with already stored deb +testsuccess aptget install -d apt +testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb +mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone +testdownload apt_2.0_all.deb apt +mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index c749224ca..42c40bb9e 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -5,30 +5,30 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' changetohttpswebserver test_apt_helper_download() { - echo "foo" > aptarchive/foo + echo 'foo' > aptarchive/foo - msgtest 'apt-file download-file md5sum' + msgtest 'apt-file download-file' 'md5sum' apthelper -qq download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail testfileequal foo2 'foo' - msgtest 'apt-file download-file sha1' + msgtest 'apt-file download-file' 'sha1' apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail testfileequal foo1 'foo' - msgtest 'apt-file download-file sha256' + msgtest 'apt-file download-file' 'sha256' apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail testfileequal foo3 'foo' - msgtest 'apt-file download-file no-hash' + msgtest 'apt-file download-file' 'no-hash' apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail testfileequal foo4 'foo' - msgtest 'apt-file download-file wrong hash' + msgtest 'apt-file download-file' 'wrong hash' if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then msgpass else -- cgit v1.2.3 From 20e6965ad6388b964b59b89c31ff8b81cbcb8f8c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 27 Sep 2014 20:09:44 +0200 Subject: cleanup partial directory of lists in apt-get clean Not really the intended usecase for apt-get clean, but users expect it to help them in recovery and it can't really hurt as this directory should be empty if everything was fine and proper anyway. Closes: #762889 --- test/integration/test-apt-get-clean | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 test/integration/test-apt-get-clean (limited to 'test') diff --git a/test/integration/test-apt-get-clean b/test/integration/test-apt-get-clean new file mode 100755 index 000000000..646ea31be --- /dev/null +++ b/test/integration/test-apt-get-clean @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +insertpackage 'testing' 'foo' 'all' '1' +insertpackage 'unstable' 'foo' 'all' '2' +insertinstalledpackage 'foo' 'all' '3' + +setupaptarchive + +# nothing to do always works +testsuccess aptget clean + +# generate some dirt and clean it up +touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en +touch rootdir/var/cache/apt/archives/foo_1_all.deb +touch rootdir/var/cache/apt/archives/foo_2_all.deb +touch rootdir/var/cache/apt/archives/foo_3_all.deb +touch rootdir/var/cache/apt/archives/foo_4_all.deb + +testsuccess aptget clean + +testsuccess test ! -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en +testsuccess test ! -e rootdir/var/cache/apt/archives/foo_1_all.deb +testsuccess test ! -e rootdir/var/cache/apt/archives/foo_2_all.deb +testsuccess test ! -e rootdir/var/cache/apt/archives/foo_3_all.deb +testsuccess test ! -e rootdir/var/cache/apt/archives/foo_4_all.deb + + -- cgit v1.2.3 From c4b91cbe7cd24126ead1c3fd4b89ff7069bcc148 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 28 Sep 2014 01:25:21 +0200 Subject: allow options between command and -- on commandline This used to work before we implemented a stricter commandline parser and e.g. the dd-schroot-cmd command constructs commandlines like this. Reported-By: Helmut Grohne --- test/libapt/commandline_test.cc | 68 +++++++++++++++++++++++++++++++++++++++++ test/libapt/makefile | 4 +-- 2 files changed, 70 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc index e403a28c8..627f1b486 100644 --- a/test/libapt/commandline_test.cc +++ b/test/libapt/commandline_test.cc @@ -2,6 +2,7 @@ #include #include +#include #include @@ -85,3 +86,70 @@ TEST(CommandLineTest, BoolParsing) } } + +bool DoVoid(CommandLine &) { return false; } + +TEST(CommandLineTest,GetCommand) +{ + CommandLine::Dispatch Cmds[] = { {"install",&DoVoid}, {"remove", &DoVoid}, {0,0} }; + { + char const * argv[] = { "apt-get", "-t", "unstable", "remove", "-d", "foo" }; + char const * com = CommandLine::GetCommand(Cmds, sizeof(argv)/sizeof(argv[0]), argv); + EXPECT_STREQ("remove", com); + std::vector Args = getCommandArgs("apt-get", com); + ::Configuration c; + CommandLine CmdL(Args.data(), &c); + ASSERT_TRUE(CmdL.Parse(sizeof(argv)/sizeof(argv[0]), argv)); + EXPECT_EQ(c.Find("APT::Default-Release"), "unstable"); + EXPECT_TRUE(c.FindB("APT::Get::Download-Only")); + ASSERT_EQ(2, CmdL.FileSize()); + EXPECT_EQ(std::string(CmdL.FileList[0]), "remove"); + EXPECT_EQ(std::string(CmdL.FileList[1]), "foo"); + } + { + char const * argv[] = {"apt-get", "-t", "unstable", "remove", "--", "-d", "foo" }; + char const * com = CommandLine::GetCommand(Cmds, sizeof(argv)/sizeof(argv[0]), argv); + EXPECT_STREQ("remove", com); + std::vector Args = getCommandArgs("apt-get", com); + ::Configuration c; + CommandLine CmdL(Args.data(), &c); + ASSERT_TRUE(CmdL.Parse(sizeof(argv)/sizeof(argv[0]), argv)); + EXPECT_EQ(c.Find("APT::Default-Release"), "unstable"); + EXPECT_FALSE(c.FindB("APT::Get::Download-Only")); + ASSERT_EQ(3, CmdL.FileSize()); + EXPECT_EQ(std::string(CmdL.FileList[0]), "remove"); + EXPECT_EQ(std::string(CmdL.FileList[1]), "-d"); + EXPECT_EQ(std::string(CmdL.FileList[2]), "foo"); + } + { + char const * argv[] = {"apt-get", "-t", "unstable", "--", "remove", "-d", "foo" }; + char const * com = CommandLine::GetCommand(Cmds, sizeof(argv)/sizeof(argv[0]), argv); + EXPECT_STREQ("remove", com); + std::vector Args = getCommandArgs("apt-get", com); + ::Configuration c; + CommandLine CmdL(Args.data(), &c); + ASSERT_TRUE(CmdL.Parse(sizeof(argv)/sizeof(argv[0]), argv)); + EXPECT_EQ(c.Find("APT::Default-Release"), "unstable"); + EXPECT_FALSE(c.FindB("APT::Get::Download-Only")); + ASSERT_EQ(CmdL.FileSize(), 3); + EXPECT_EQ(std::string(CmdL.FileList[0]), "remove"); + EXPECT_EQ(std::string(CmdL.FileList[1]), "-d"); + EXPECT_EQ(std::string(CmdL.FileList[2]), "foo"); + } + { + char const * argv[] = {"apt-get", "install", "-t", "unstable", "--", "remove", "-d", "foo" }; + char const * com = CommandLine::GetCommand(Cmds, sizeof(argv)/sizeof(argv[0]), argv); + EXPECT_STREQ("install", com); + std::vector Args = getCommandArgs("apt-get", com); + ::Configuration c; + CommandLine CmdL(Args.data(), &c); + ASSERT_TRUE(CmdL.Parse(sizeof(argv)/sizeof(argv[0]), argv)); + EXPECT_EQ(c.Find("APT::Default-Release"), "unstable"); + EXPECT_FALSE(c.FindB("APT::Get::Download-Only")); + ASSERT_EQ(CmdL.FileSize(), 4); + EXPECT_EQ(std::string(CmdL.FileList[0]), "install"); + EXPECT_EQ(std::string(CmdL.FileList[1]), "remove"); + EXPECT_EQ(std::string(CmdL.FileList[2]), "-d"); + EXPECT_EQ(std::string(CmdL.FileList[3]), "foo"); + } +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 69a13fd92..7f23ace46 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -14,8 +14,8 @@ test: $(BIN)/gtest$(BASENAME) $(BIN)/gtest$(BASENAME): $(LIB)/gtest.a PROGRAM = gtest${BASENAME} -SLIBS = -lapt-pkg -pthread $(LIB)/gtest.a -LIB_MAKES = apt-pkg/makefile +SLIBS = -lapt-pkg -lapt-private -pthread $(LIB)/gtest.a +LIB_MAKES = apt-pkg/makefile apt-private/makefile SOURCE = gtest_runner.cc $(wildcard *-helpers.cc *_test.cc) include $(PROGRAM_H) -- cgit v1.2.3 From e1bd768b762bd74221f9089133883723a7307f9b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 29 Sep 2014 11:03:02 +0200 Subject: test fixes --- test/integration/test-apt-update-rollback | 2 +- test/integration/test-apt-update-unauth | 2 ++ .../test-bug-617690-allow-unauthenticated-makes-all-untrusted | 5 ++++- test/integration/test-bug-728500-tempdir | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index a88b0042b..e37be9554 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -114,7 +114,7 @@ test_unauthenticated_to_invalid_inrelease() { rm $APTARCHIVE/dists/unstable/Release.gpg avoid_ims_hit - testsuccess aptget update -qq + testsuccess aptget update -qq --allow-unauthenticated testequal "WARNING: The following packages cannot be authenticated! old E: There are problems and -y was used without --force-yes" aptget install -qq -y old diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth index 2e46e3ace..5db8a3c16 100755 --- a/test/integration/test-apt-update-unauth +++ b/test/integration/test-apt-update-unauth @@ -8,6 +8,8 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework +umask 022 + setupenvironment configarchitecture "i386" diff --git a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted index f93510fd7..276e10564 100755 --- a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted +++ b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted @@ -24,15 +24,18 @@ testfilemissing() { testrun() { rm -rf rootdir/var/lib/apt - testsuccess aptget update if [ "$1" = 'trusted' ]; then + testsuccess aptget update + testsuccess aptget download cool testfileexists 'cool_1.0_i386.deb' testsuccess aptget download cool --allow-unauthenticated testfileexists 'cool_1.0_i386.deb' else + testsuccess aptget update --allow-unauthenticated + testfailure aptget download cool testfilemissing 'cool_1.0_i386.deb' diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir index 0451fc1ed..e9df0a709 100755 --- a/test/integration/test-bug-728500-tempdir +++ b/test/integration/test-bug-728500-tempdir @@ -17,7 +17,7 @@ msgtest 'Test apt-get update with incorrect' 'TMPDIR' OUTPUT=$(mktemp) addtrap "rm $OUTPUT;" export TMPDIR=/does-not-exists -if aptget update >${OUTPUT} 2>&1; then +if aptget update -o Debug::Acquire::gpg=1 >${OUTPUT} 2>&1; then msgpass else echo -- cgit v1.2.3 From 7ffac4c10144a8458fec6de03c58f3b49d081e5c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 29 Sep 2014 11:43:37 +0200 Subject: Test if TMPDIR is a directory in apt-key and if not unset it This prevents a failure in mktemp -d - it will blindly trust TMPDIR and not use something else if the dir is not there. --- test/integration/test-bug-728500-tempdir | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir index 0451fc1ed..bdc38c3ca 100755 --- a/test/integration/test-bug-728500-tempdir +++ b/test/integration/test-bug-728500-tempdir @@ -27,3 +27,4 @@ fi unset TMPDIR testequal 'coolstuff' aptcache pkgnames +testsuccess ls rootdir/var/lib/apt/lists/*InRelease -- cgit v1.2.3 From c292cc32b3ab0d70c63e68f7c94446932217c0ec Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 29 Sep 2014 11:47:03 +0200 Subject: more test fixes --- test/integration/test-bug-596498-trusted-unsigned-repo | 2 +- test/integration/test-hashsum-verification | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo index 06c9c8285..973520a97 100755 --- a/test/integration/test-bug-596498-trusted-unsigned-repo +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -12,7 +12,7 @@ setupaptarchive aptgetupdate() { rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin - aptget update -qq + aptget update -qq --allow-unauthenticated } PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)" diff --git a/test/integration/test-hashsum-verification b/test/integration/test-hashsum-verification index 2a400dcb4..2db2bab0f 100755 --- a/test/integration/test-hashsum-verification +++ b/test/integration/test-hashsum-verification @@ -70,9 +70,13 @@ runtest() { rm -rf rootdir/var/lib/apt/lists rm aptarchive/InRelease aptarchive/Release.gpg msgtest 'unsigned apt-get update gets the expected hashsum mismatch' - aptget update 2>&1 | grep "Hash Sum mismatch" > /dev/null && msgpass || msgfail - - + aptget update --allow-unauthenticated >output.log 2>&1 || true + if grep -q "Hash Sum mismatch" output.log; then + msgpass + else + cat output.log + msgfail + fi } for COMPRESSEDINDEXES in 'false' 'true'; do -- cgit v1.2.3 From f6d4ab9ad8a2cfe52737ab620dd252cf8ceec43d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 29 Sep 2014 22:45:52 +0200 Subject: support parsing of all hashes for pdiff The fileformat of a pdiff index stores currently only SHA1 hashes. With this change, we look for all other hashes we support as well and take what we get, so that we can work after the release of jessie to get right of SHA1 if we want to. Note that the completely patched file is and was checked against the hashes collected from the Release file, so this transition isn't mission critical. --- test/integration/test-pdiff-usage | 48 ++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 74749d6ab..0d5261429 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -76,8 +76,15 @@ SHA1-History: 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28 $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) SHA1-Patches: - 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 - $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX + 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28 + $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE) +SHA256-Current: $(sha256sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) +SHA256-History: + 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28 + $(sha256sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) +SHA256-Patches: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 + $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX generatereleasefiles '+1hour' signreleasefiles find aptarchive -name 'Packages*' -type f -delete @@ -119,9 +126,18 @@ SHA1-History: $(sha1sum ${PKGFILE} | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}) $(basename ${PATCHFILE}) $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) $(basename ${PATCHFILE2}) SHA1-Patches: - 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 + 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28 $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE) - $(sha1sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX + $(sha1sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2}) +SHA256-Current: $(sha256sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages) +SHA256-History: + 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28 + $(sha256sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) + $(sha256sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) $(basename ${PATCHFILE2}) +SHA256-Patches: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 + $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE) + $(sha256sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX generatereleasefiles '+2hour' signreleasefiles cp -a aptarchive/Packages Packages-future @@ -147,8 +163,15 @@ SHA1-History: 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28 $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) SHA1-Patches: - 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 - $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX + 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28 + $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE) +SHA256-Current: $(sha256sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) +SHA256-History: + 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28 + $(sha256sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) +SHA256-Patches: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 + $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX echo 'I am Mallory and I change files' >> $PATCHFILE cat $PATCHFILE | gzip > ${PATCHFILE}.gz generatereleasefiles '+1hour' @@ -165,3 +188,16 @@ testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=1 testrun -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=1 testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=0 testrun -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=0 + +sha256sum() { + echo '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b -' +} +testrun -o Acquire::PDiffs::Merge=0 -o Acquire::ForceHash=SHA1 +testrun -o Acquire::PDiffs::Merge=1 -o Acquire::ForceHash=SHA1 + +unset -f sha256sum +sha1sum() { + echo 'adc83b19e793491b1c6ea0fd8b46cd9f32e592fc -' +} +testrun -o Acquire::PDiffs::Merge=0 -o Acquire::ForceHash=SHA256 +testrun -o Acquire::PDiffs::Merge=1 -o Acquire::ForceHash=SHA256 -- cgit v1.2.3 From c99fe2e169243fc6e1a3278ce3768f0f521e260b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 1 Oct 2014 12:21:55 +0200 Subject: Use Acquire::Allow{InsecureRepositories,DowngradeToInsecureRepositories} The configuration key Acquire::AllowInsecureRepositories controls if apt allows loading of unsigned repositories at all. The configuration Acquire::AllowDowngradeToInsecureRepositories controls if a signed repository can ever become unsigned. This should really never be needed but we provide it to avoid having to mess around in /var/lib/apt/lists if there is a use-case for this (which I can't think of right now). --- test/integration/test-apt-get-source-authenticated | 2 +- .../integration/test-apt-get-update-unauth-warning | 4 ++-- test/integration/test-apt-update-nofallback | 23 ++++++++++++++++++++++ test/integration/test-apt-update-rollback | 2 +- test/integration/test-apt-update-unauth | 2 +- .../test-bug-596498-trusted-unsigned-repo | 2 +- ...17690-allow-unauthenticated-makes-all-untrusted | 4 ++-- .../test-bug-717891-abolute-uris-for-proxies | 2 +- test/integration/test-bug-738785-switch-protocol | 2 +- test/integration/test-hashsum-verification | 2 +- test/integration/test-policy-pinning | 2 +- 11 files changed, 35 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated index d73097b54..d833ddd85 100755 --- a/test/integration/test-apt-get-source-authenticated +++ b/test/integration/test-apt-get-source-authenticated @@ -21,7 +21,7 @@ APTARCHIVE=$(readlink -f ./aptarchive) rm -f $APTARCHIVE/dists/unstable/*Release* # update without authenticated InRelease file -testsuccess aptget update --allow-unauthenticated +testsuccess aptget update --allow-insecure-repositories # this all should fail testfailure aptget install -y foo diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index b1c676738..510249747 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -23,7 +23,7 @@ testequal "Ign file: unstable InRelease Ign file: unstable Release Reading package lists... W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated. -W: Use --allow-unauthenticated to force the update" aptget update +W: Use --allow-insecure-repositories to force the update" aptget update # no package foo testequal "Listing..." apt list foo @@ -32,7 +32,7 @@ testequal "Listing..." apt list foo testequal "Ign file: unstable InRelease Ign file: unstable Release Reading package lists... -W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated." aptget update --allow-unauthenticated +W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated." aptget update --allow-insecure-repositories # ensure we can not install the package testequal "WARNING: The following packages cannot be authenticated! diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index 4e8ea9916..a53226e18 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -78,6 +78,25 @@ test_from_release_gpg_to_unsigned() assert_update_is_refused_and_last_good_state_used } +test_from_inrelease_to_unsigned_with_override() +{ + # setup archive with InRelease file + setupaptarchive_with_lists_clean + testsuccess aptget update + + # simulate moving to a unsigned but otherwise valid repo + simulate_mitm_and_inject_evil_package + generatereleasefiles + + # and ensure we can update to it (with enough force) + testsuccess aptget update --allow-insecure-repositories \ + -o Acquire::AllowDowngradeToInsecureRepositories=1 + # but that the individual packages are still considered untrusted + testequal "WARNING: The following packages cannot be authenticated! + evil +E: There are problems and -y was used without --force-yes" aptget install -qq -y evil +} + test_cve_2012_0214() { # see https://bugs.launchpad.net/ubuntu/+source/apt/+bug/947108 @@ -205,3 +224,7 @@ test_inrelease_to_invalid_inrelease # ensure we revert to last good state if Release/Release.gpg does not verify msgmsg "test_release_gpg_to_invalid_release_release_gpg" test_release_gpg_to_invalid_release_release_gpg + +# ensure we can ovveride the downgrade error +msgmsg "test_from_inrelease_to_unsigned" +test_from_inrelease_to_unsigned_with_override diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index e37be9554..ee8bc6926 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -114,7 +114,7 @@ test_unauthenticated_to_invalid_inrelease() { rm $APTARCHIVE/dists/unstable/Release.gpg avoid_ims_hit - testsuccess aptget update -qq --allow-unauthenticated + testsuccess aptget update -qq --allow-insecure-repositories testequal "WARNING: The following packages cannot be authenticated! old E: There are problems and -y was used without --force-yes" aptget install -qq -y old diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth index 5db8a3c16..ade523ea7 100755 --- a/test/integration/test-apt-update-unauth +++ b/test/integration/test-apt-update-unauth @@ -28,7 +28,7 @@ runtest() { rm -f aptarchive/dists/unstable/*Release* # remove uncompressed version find aptarchive/ -name Packages | xargs rm -f - aptget update -qq --allow-unauthenticated + aptget update -qq --allow-insecure-repositories # become authenticated generatereleasefiles diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo index 973520a97..3104a70c2 100755 --- a/test/integration/test-bug-596498-trusted-unsigned-repo +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -12,7 +12,7 @@ setupaptarchive aptgetupdate() { rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin - aptget update -qq --allow-unauthenticated + aptget update -qq --allow-insecure-repositories } PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)" diff --git a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted index 276e10564..0736bb6dc 100755 --- a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted +++ b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted @@ -26,7 +26,7 @@ testrun() { rm -rf rootdir/var/lib/apt if [ "$1" = 'trusted' ]; then - testsuccess aptget update + testsuccess aptget update testsuccess aptget download cool testfileexists 'cool_1.0_i386.deb' @@ -34,7 +34,7 @@ testrun() { testsuccess aptget download cool --allow-unauthenticated testfileexists 'cool_1.0_i386.deb' else - testsuccess aptget update --allow-unauthenticated + testsuccess aptget update --allow-insecure-repositories testfailure aptget download cool testfilemissing 'cool_1.0_i386.deb' diff --git a/test/integration/test-bug-717891-abolute-uris-for-proxies b/test/integration/test-bug-717891-abolute-uris-for-proxies index a8947b5e2..54a616686 100755 --- a/test/integration/test-bug-717891-abolute-uris-for-proxies +++ b/test/integration/test-bug-717891-abolute-uris-for-proxies @@ -12,7 +12,7 @@ setupaptarchive changetowebserver --request-absolute='uri' msgtest 'Check that absolute paths are' 'not accepted' -testfailure --nomsg aptget update --allow-unauthenticated +testfailure --nomsg aptget update --allow-insecure-repositories echo 'Acquire::http::Proxy "http://localhost:8080";' > rootdir/etc/apt/apt.conf.d/99proxy diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index 4ff044515..f81bba4b9 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -60,4 +60,4 @@ mv rootdir/${COPYMETHODS}.bak rootdir/${COPYMETHODS} # check that downgrades from https to http are not allowed webserverconfig 'aptwebserver::support::http' 'true' sed -i -e 's#:8080/redirectme#:4433/downgrademe#' -e 's# http:# https:#' rootdir/etc/apt/sources.list.d/* -testfailure aptget update --allow-unauthenticated +testfailure aptget update --allow-insecure-repositories diff --git a/test/integration/test-hashsum-verification b/test/integration/test-hashsum-verification index 2db2bab0f..5f88110b3 100755 --- a/test/integration/test-hashsum-verification +++ b/test/integration/test-hashsum-verification @@ -70,7 +70,7 @@ runtest() { rm -rf rootdir/var/lib/apt/lists rm aptarchive/InRelease aptarchive/Release.gpg msgtest 'unsigned apt-get update gets the expected hashsum mismatch' - aptget update --allow-unauthenticated >output.log 2>&1 || true + aptget update --allow-insecure-repositories >output.log 2>&1 || true if grep -q "Hash Sum mismatch" output.log; then msgpass else diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning index 2281d7a1d..c08a2f103 100755 --- a/test/integration/test-policy-pinning +++ b/test/integration/test-policy-pinning @@ -28,7 +28,7 @@ Pinned packages:" aptcache policy $* aptgetupdate() { # just to be sure that no old files are used rm -rf rootdir/var/lib/apt - if aptget update --allow-unauthenticated -qq 2>&1 | grep '^E: '; then + if aptget update --allow-insecure-repositories -qq 2>&1 | grep '^E: '; then msgwarn 'apt-get update failed with an error' fi } -- cgit v1.2.3 From e8b1db38cca29cbdc0116e567f0aa7a28034287b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 1 Oct 2014 14:06:01 +0200 Subject: update test/integration/test-releasefile-verification --- test/integration/test-releasefile-verification | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index e558b83e8..3765a4b1f 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -235,10 +235,21 @@ runtest2() { " aptcache show apt failaptnew } -runtest2 +# diable some protection by default and ensure we still do the verification +# correctly +cat > rootdir/etc/apt/apt.conf.d/weaken-security < Date: Wed, 1 Oct 2014 14:22:46 +0200 Subject: fix test-apt-update-nofallback test --- test/integration/test-apt-update-nofallback | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index a53226e18..c400dcc36 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -181,7 +181,11 @@ test_release_gpg_to_invalid_release_release_gpg() echo "Some evil data" >> $APTARCHIVE/dists/unstable/Release inject_evil_package - testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq + testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release.gpg: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) + +W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg + +W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq assert_repo_is_intact testfailure grep "evil" rootdir/var/lib/apt/lists/*Release -- cgit v1.2.3 From 0b844e23f014bd3ce95e27fe5fa81138e9ae4879 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 1 Oct 2014 17:13:33 +0200 Subject: hack around test-apt-update-unauth failure --- test/integration/test-apt-update-unauth | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth index ade523ea7..cf5195024 100755 --- a/test/integration/test-apt-update-unauth +++ b/test/integration/test-apt-update-unauth @@ -26,34 +26,43 @@ runtest() { # start unauthenticated find rootdir/var/lib/apt/lists/ -type f | xargs rm -f rm -f aptarchive/dists/unstable/*Release* - # remove uncompressed version - find aptarchive/ -name Packages | xargs rm -f + aptget update -qq --allow-insecure-repositories + # FIXME: this really shouldn't be needed + rm -f rootdir/var/lib/apt/lists/partial/* + # become authenticated generatereleasefiles signreleasefiles + # move uncompressed away + mv aptarchive/dists/unstable/main/binary-i386/Packages \ + aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed + # and ensure we re-check the downloaded data msgtest "Check rollback on going from unauth -> auth" # change the local packages file PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*) echo "meep" > $PKGS - ls -l rootdir/var/lib/apt/lists > lists.before + ls rootdir/var/lib/apt/lists/ > lists.before # update and ensure all is reverted on the hashsum failure - aptget update -o Debug::Acquire::Transaction=1 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 > output.log 2>&1 || true + aptget update -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 -o Debug::acquire::http=0 > output.log 2>&1 || true # ensure we have before what we have after - ls -l rootdir/var/lib/apt/lists > lists.after + ls rootdir/var/lib/apt/lists/ > lists.after if diff -u lists.before lists.after; then msgpass else - #cat output.log + cat output.log msgfail fi + # move uncompressed back for release file + mv aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed \ + aptarchive/dists/unstable/main/binary-i386/Packages } for COMPRESSEDINDEXES in 'false' 'true'; do -- cgit v1.2.3 From 47450dea0904298c8d5ea06b15ea26368da5a4ee Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 1 Oct 2014 18:01:14 +0200 Subject: fix leftover files from Acquire::GzipIndex --- test/integration/test-apt-update-ims | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 3bd6e843c..946dfc7af 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -11,15 +11,30 @@ buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' setupaptarchive changetowebserver -testsuccess aptget update +runtest() { + rm -f rootdir/var/lib/apt/lists/localhost* -# check that I-M-S header is kept in redirections -testequal "Hit http://localhost:8080 unstable InRelease + testsuccess aptget update + + # ensure no leftovers in partial + testfailure ls "rootdir/var/lib/apt/lists/partial/*" + + # check that I-M-S header is kept in redirections + testequal "Hit http://localhost:8080 unstable InRelease Hit http://localhost:8080 unstable/main Sources Hit http://localhost:8080 unstable/main amd64 Packages Hit http://localhost:8080 unstable/main Translation-en -Reading package lists..." aptget update +Reading package lists..." aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 + + # ensure that we still do a hash check on ims hit + msgtest 'Test I-M-S reverify' + aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A1 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail + + # ensure no leftovers in partial + testfailure ls "rootdir/var/lib/apt/lists/partial/*" +} + +runtest -# ensure that we still do a hash check on ims hit -msgtest 'Test I-M-S reverify' -aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A1 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail +echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex +runtest -- cgit v1.2.3 From 1e8ba0d4087f72a930a588ce5fbf0c22dddb9403 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 2 Oct 2014 00:38:35 +0200 Subject: donkults fixes --- test/integration/test-apt-by-hash-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index 23282bf86..6e1ecdaff 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -34,7 +34,7 @@ Building dependency tree... E: Unable to locate package foo" aptget install -q -s foo # ensure we can apt-get update by hash -testsuccess aptget update -o APT::Acquire::By-Hash=1 +testsuccess aptget update -o APT::Acquire::By-Hash=1 # ensure it works testequal "Inst foo (1.0 unstable [all]) -- cgit v1.2.3 From 8b32e72c6f7143de4ec02f44e362b0df9e21e024 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 1 Oct 2014 23:58:05 +0200 Subject: ensure world-readability for trusted.gpg in postinst apt-key creates trusted.gpg if it needs it with 644 nowadays, but before it ensured this, it was gpg creating it, which gives it by default 600. Not a problem as long as our gpgv is run as root, but now that we drop privileges we have to ensure that we can also read trusted.gpg files created by earlier apt-key versions. Closes: 647001 --- test/integration/test-apt-key | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index d5adec5bd..e6ac530a6 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -41,7 +41,14 @@ gpg: unchanged: 1' aptkey --fakeroot update testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' + testsuccess test ! -e rootdir/etc/apt/trusted.gpg testsuccess aptkey --fakeroot add ./keys/rexexpired.pub + msgtest 'Check if trusted.gpg is created with permissions set to' '0644' + if [ "$(stat -c '%a' rootdir/etc/apt/trusted.gpg )" = '644' ]; then + msgpass + else + msgfail + fi testaptkeys 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] pub 2048R/DBAC8DAE 2010-08-18' -- cgit v1.2.3 From 1ce243188c2ba218f5dce8ec8b40556d58ed8ec2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 2 Oct 2014 18:28:55 +0200 Subject: cleanup around pkgAcqMetaSig and improved tests --- test/integration/test-apt-update-ims | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 946dfc7af..38dcd73fd 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -20,11 +20,7 @@ runtest() { testfailure ls "rootdir/var/lib/apt/lists/partial/*" # check that I-M-S header is kept in redirections - testequal "Hit http://localhost:8080 unstable InRelease -Hit http://localhost:8080 unstable/main Sources -Hit http://localhost:8080 unstable/main amd64 Packages -Hit http://localhost:8080 unstable/main Translation-en -Reading package lists..." aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 + testequal "$EXPECT" aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 # ensure that we still do a hash check on ims hit msgtest 'Test I-M-S reverify' @@ -34,6 +30,34 @@ Reading package lists..." aptget update -o Debug::pkgAcquire::Worker=0 -o Debug testfailure ls "rootdir/var/lib/apt/lists/partial/*" } +EXPECT="Hit http://localhost:8080 unstable InRelease +Hit http://localhost:8080 unstable/main Sources +Hit http://localhost:8080 unstable/main amd64 Packages +Hit http://localhost:8080 unstable/main Translation-en +Reading package lists..." +# with InRelease +runtest + +# with gzip +echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex +runtest + +# FIXME: how can we get rid of this extra line +# "Get:1 http://localhost:8080 unstable Release.gpg" +# +# with Release/Release.gpg +EXPECT="Ign http://localhost:8080 unstable InRelease +Hit http://localhost:8080 unstable Release +Hit http://localhost:8080 unstable Release.gpg +Get:1 http://localhost:8080 unstable Release.gpg +Hit http://localhost:8080 unstable/main Sources +Hit http://localhost:8080 unstable/main amd64 Packages +Hit http://localhost:8080 unstable/main Translation-en +Reading package lists..." + +find aptarchive -name "InRelease" | xargs rm -f + +echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex runtest echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex -- cgit v1.2.3 From 0f56b51e125d24cf5af68459077ad1b682743bc2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Oct 2014 09:34:06 +0200 Subject: update test --- test/integration/test-apt-get-update-unauth-warning | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index 510249747..75863615e 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -20,13 +20,17 @@ rm -f $APTARCHIVE/dists/unstable/*Release* # update without authenticated files leads to warning testequal "Ign file: unstable InRelease -Ign file: unstable Release -Reading package lists... +Err file: unstable Release + W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated. -W: Use --allow-insecure-repositories to force the update" aptget update +W: Use --allow-insecure-repositories to force the update +W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release + +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update # no package foo testequal "Listing..." apt list foo +testequal "partial" ls rootdir/var/lib/apt/lists # allow override testequal "Ign file: unstable InRelease -- cgit v1.2.3 From f30976478e684fc19e48d71881805454ceb6ecae Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Oct 2014 11:45:42 +0200 Subject: Rework pkgAcqMeta{Index,Sig,ClearSig}::Done() for readability Move common code out but do not use subclassing for ::Done to make it easier to understand what each class is doing when its done --- test/integration/test-apt-update-ims | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 38dcd73fd..61b808b0f 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -30,6 +30,7 @@ runtest() { testfailure ls "rootdir/var/lib/apt/lists/partial/*" } +msgmsg "InRelease" EXPECT="Hit http://localhost:8080 unstable InRelease Hit http://localhost:8080 unstable/main Sources Hit http://localhost:8080 unstable/main amd64 Packages @@ -42,14 +43,11 @@ runtest echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex runtest -# FIXME: how can we get rid of this extra line -# "Get:1 http://localhost:8080 unstable Release.gpg" -# +msgmsg "Release/Release.gpg" # with Release/Release.gpg EXPECT="Ign http://localhost:8080 unstable InRelease Hit http://localhost:8080 unstable Release Hit http://localhost:8080 unstable Release.gpg -Get:1 http://localhost:8080 unstable Release.gpg Hit http://localhost:8080 unstable/main Sources Hit http://localhost:8080 unstable/main amd64 Packages Hit http://localhost:8080 unstable/main Translation-en @@ -62,3 +60,23 @@ runtest echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex runtest + + +# no Release.gpg or InRelease +msgmsg "Release only" +EXPECT="Ign http://localhost:8080 unstable InRelease +Hit http://localhost:8080 unstable Release +Ign http://localhost:8080 unstable Release.gpg +Hit http://localhost:8080 unstable/main Sources +Hit http://localhost:8080 unstable/main amd64 Packages +Hit http://localhost:8080 unstable/main Translation-en +Reading package lists..." + +find aptarchive -name "Release.gpg" | xargs rm -f + +echo 'Acquire::AllowInsecureRepositories "1";' > rootdir/etc/apt/apt.conf.d/insecure.conf +echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex +runtest + +echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex +runtest -- cgit v1.2.3 From 673c9469abd656a92c7e8f1f91f919cad09f391e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Oct 2014 14:34:38 +0200 Subject: cleanup pkgAcq*::Failed() --- test/integration/test-apt-get-update-unauth-warning | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index 75863615e..37bcea623 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -22,7 +22,7 @@ rm -f $APTARCHIVE/dists/unstable/*Release* testequal "Ign file: unstable InRelease Err file: unstable Release -W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated. +W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository. W: Use --allow-insecure-repositories to force the update W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release -- cgit v1.2.3 From 42299a28ac40721f6cf29c9b786924c2cd4a210f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Oct 2014 14:43:05 +0200 Subject: fix test --- test/integration/test-apt-get-update-unauth-warning | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index 37bcea623..27160b5f9 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -36,8 +36,7 @@ testequal "partial" ls rootdir/var/lib/apt/lists testequal "Ign file: unstable InRelease Ign file: unstable Release Reading package lists... -W: The data from 'file: unstable Release' is not signed. Packages from that repository can not be authenticated." aptget update --allow-insecure-repositories - +W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." aptget update --allow-insecure-repositories # ensure we can not install the package testequal "WARNING: The following packages cannot be authenticated! foo -- cgit v1.2.3 From ac81c0f9b79351258d3a29212f7fda312e5afeb5 Mon Sep 17 00:00:00 2001 From: josch Date: Tue, 19 Aug 2014 10:29:29 +0200 Subject: implement the updated build profile spec --- .../test-bug-661537-build-profiles-support | 86 +++++++++++----------- test/libapt/parsedepends_test.cc | 29 +++++--- 2 files changed, 63 insertions(+), 52 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-661537-build-profiles-support b/test/integration/test-bug-661537-build-profiles-support index ae1403f71..6c850fdf9 100755 --- a/test/integration/test-bug-661537-build-profiles-support +++ b/test/integration/test-bug-661537-build-profiles-support @@ -11,18 +11,16 @@ insertinstalledpackage 'build-essential' 'all' '0' 'Multi-Arch: foreign' insertpackage 'unstable' 'foo' 'all' '1.0' insertpackage 'unstable' 'bar' 'all' '1.0' -insertsource 'unstable' 'buildprofiles' 'any' '1' 'Build-Depends: foo (>= 1.0) [i386 arm] , bar' +insertsource 'unstable' 'buildprofiles' 'any' '1' 'Build-Depends: foo (>= 1.0) [i386 arm] , bar' # table from https://wiki.debian.org/BuildProfileSpec -insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo ' -insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo ' -insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo ' -insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo ' -insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo ' -insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo ' -# multiple stanzas not supported: error out -insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo ' -insertsource 'unstable' 'spec-8' 'any' '1' 'Build-Depends: foo ' +insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo ' +insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo ' +insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo ' +insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo ' +insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo ' +insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo ' +insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo ' setupaptarchive @@ -72,7 +70,7 @@ Building dependency tree... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support' -if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.2'; then +if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.14'; then msgpass testwithdpkg() { msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" @@ -113,35 +111,37 @@ testprofile() { testwithdpkg "$2" "$3" "$4" } -testprofile 'spec-1' 'foo ' '' "$KEEP" -testprofile 'spec-1' 'foo ' 'stage1' "$DROP" -testprofile 'spec-1' 'foo ' 'notest' "$KEEP" -testprofile 'spec-1' 'foo ' 'stage1,notest' "$DROP" - -testprofile 'spec-2' 'foo ' '' "$DROP" -testprofile 'spec-2' 'foo ' 'stage1' "$KEEP" -testprofile 'spec-2' 'foo ' 'notest' "$DROP" -testprofile 'spec-2' 'foo ' 'stage1,notest' "$KEEP" - -testprofile 'spec-3' 'foo ' '' "$KEEP" -testprofile 'spec-3' 'foo ' 'stage1' "$DROP" -testprofile 'spec-3' 'foo ' 'notest' "$DROP" -testprofile 'spec-3' 'foo ' 'stage1,notest' "$DROP" - -testprofile 'spec-4' 'foo ' '' "$DROP" -testprofile 'spec-4' 'foo ' 'stage1' "$KEEP" -testprofile 'spec-4' 'foo ' 'notest' "$KEEP" -testprofile 'spec-4' 'foo ' 'stage1,notest' "$KEEP" - -testprofile 'spec-5' 'foo ' '' "$KEEP" -testprofile 'spec-5' 'foo ' 'stage1' "$DROP" -testprofile 'spec-5' 'foo ' 'notest' "$KEEP" -testprofile 'spec-5' 'foo ' 'stage1,notest' "$DROP" - -testprofile 'spec-6' 'foo ' '' "$KEEP" -testprofile 'spec-6' 'foo ' 'stage1' "$KEEP" -testprofile 'spec-6' 'foo ' 'notest' "$DROP" -testprofile 'spec-6' 'foo ' 'stage1,notest' "$KEEP" - -testfailure aptget build-dep spec-7 -s -testfailure aptget build-dep spec-8 -s +testprofile 'spec-1' 'foo ' '' "$KEEP" +testprofile 'spec-1' 'foo ' 'stage1' "$DROP" +testprofile 'spec-1' 'foo ' 'notest' "$KEEP" +testprofile 'spec-1' 'foo ' 'stage1,notest' "$DROP" + +testprofile 'spec-2' 'foo ' '' "$DROP" +testprofile 'spec-2' 'foo ' 'stage1' "$KEEP" +testprofile 'spec-2' 'foo ' 'notest' "$DROP" +testprofile 'spec-2' 'foo ' 'stage1,notest' "$KEEP" + +testprofile 'spec-3' 'foo ' '' "$KEEP" +testprofile 'spec-3' 'foo ' 'stage1' "$DROP" +testprofile 'spec-3' 'foo ' 'notest' "$DROP" +testprofile 'spec-3' 'foo ' 'stage1,notest' "$DROP" + +testprofile 'spec-4' 'foo ' '' "$DROP" +testprofile 'spec-4' 'foo ' 'stage1' "$DROP" +testprofile 'spec-4' 'foo ' 'notest' "$DROP" +testprofile 'spec-4' 'foo ' 'stage1,notest' "$KEEP" + +testprofile 'spec-5' 'foo ' '' "$DROP" +testprofile 'spec-5' 'foo ' 'stage1' "$DROP" +testprofile 'spec-5' 'foo ' 'notest' "$KEEP" +testprofile 'spec-5' 'foo ' 'stage1,notest' "$DROP" + +testprofile 'spec-6' 'foo ' '' "$DROP" +testprofile 'spec-6' 'foo ' 'stage1' "$KEEP" +testprofile 'spec-6' 'foo ' 'notest' "$DROP" +testprofile 'spec-6' 'foo ' 'stage1,notest' "$DROP" + +testprofile 'spec-7' 'foo ' '' "$KEEP" +testprofile 'spec-7' 'foo ' 'stage1' "$KEEP" +testprofile 'spec-7' 'foo ' 'notest' "$DROP" +testprofile 'spec-7' 'foo ' 'stage1,notest' "$KEEP" diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc index 52eac8232..f644599bd 100644 --- a/test/libapt/parsedepends_test.cc +++ b/test/libapt/parsedepends_test.cc @@ -33,9 +33,10 @@ static void parseDependency(bool const StripMultiArch, bool const ParseArchFlag "os-for-me [ linux-any ], " "cpu-not-for-me [ any-armel ], " "os-not-for-me [ kfreebsd-any ], " - "not-in-stage1 , " - "not-in-stage1-or-nodoc , " - "only-in-stage1 , " + "not-in-stage1 , " + "not-stage1-and-not-nodoc , " + "not-stage1-or-not-nodoc , " + "unknown-profile , " "overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), " ; @@ -184,7 +185,7 @@ static void parseDependency(bool const StripMultiArch, bool const ParseArchFlag if (ParseRestrictionsList == true) { Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); - EXPECT_EQ("", Package); // not-in-stage1-or-in-nodoc + EXPECT_EQ("", Package); // not-stage1-and-not-nodoc } else { EXPECT_EQ(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); @@ -193,7 +194,16 @@ static void parseDependency(bool const StripMultiArch, bool const ParseArchFlag if (ParseRestrictionsList == true) { Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); - EXPECT_EQ("only-in-stage1", Package); + EXPECT_EQ("not-stage1-or-not-nodoc", Package); + } else { + EXPECT_EQ(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); + Start = strstr(Start, ","); + Start++; + } + + if (ParseRestrictionsList == true) { + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); + EXPECT_EQ("", Package); // unknown-profile } else { EXPECT_EQ(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); @@ -232,10 +242,11 @@ test: SCOPED_TRACE(std::string("ParseRestrictionsList: ") + (ParseRestrictionsList ? "true" : "false")); parseDependency(StripMultiArch, ParseArchFlags, ParseRestrictionsList); } - if (StripMultiArch == false) - if (ParseArchFlags == false) - ParseRestrictionsList = !ParseRestrictionsList; - ParseArchFlags = !ParseArchFlags; + if (StripMultiArch == false) { + if (ParseArchFlags == false) + ParseRestrictionsList = !ParseRestrictionsList; + ParseArchFlags = !ParseArchFlags; + } StripMultiArch = !StripMultiArch; runner++; -- cgit v1.2.3 From 04a54261afd1c99686109f102afc83346c01c930 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 6 Oct 2014 11:15:03 +0200 Subject: ensure partial dirs are 0700 and owned by _apt:root Reworks the API involved in creating and setting up the fetcher to be a bit more pleasent to look at and work with as e.g. an empty string for no lock isn't very nice. With the lock we can also stop creating all our partial directories "just in case". This way we can also be a bit more aggressive with the partial directory itself as with a lock, we know we will gone need it. --- test/integration/test-apt-get-clean | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/integration/test-apt-get-clean b/test/integration/test-apt-get-clean index 646ea31be..98f7c84d0 100755 --- a/test/integration/test-apt-get-clean +++ b/test/integration/test-apt-get-clean @@ -18,6 +18,7 @@ testsuccess aptget clean # generate some dirt and clean it up touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en +mkdir -p rootdir/var/cache/apt/archives touch rootdir/var/cache/apt/archives/foo_1_all.deb touch rootdir/var/cache/apt/archives/foo_2_all.deb touch rootdir/var/cache/apt/archives/foo_3_all.deb -- cgit v1.2.3 From 5684f71fa0f6c1b765aa53e22ca3b024c578b9c9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 6 Oct 2014 14:29:53 +0200 Subject: use _apt:root only for partial directories Using a different user for calling methods is intended to protect us from methods running amok (via remotely exploited bugs) by limiting what can be done by them. By using root:root for the final directories and just have the files in partial writeable by the methods we enhance this in sofar as a method can't modify already verified data in its parent directory anymore. As a side effect, this also clears most of the problems you could have if the final directories are shared without user-sharing or if these directories disappear as they are now again root owned and only the partial directories contain _apt owned files (usually none if apt isn't running) and the directory itself is autocreated with the right permissions. --- test/integration/framework | 22 +++++++++++++++++----- test/integration/test-apt-get-download | 16 ++++++++++++++++ test/integration/test-apt-update-unauth | 20 +++++++++++--------- 3 files changed, 44 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index e83606fae..688a1abf2 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -164,9 +164,10 @@ addtrap() { setupenvironment() { TMPWORKINGDIRECTORY=$(mktemp -d) - TESTDIRECTORY=$(readlink -f $(dirname $0)) + addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " + TESTDIRECTORY=$(readlink -f $(dirname $0)) # allow overriding the default BUILDDIR location BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"} LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"} @@ -177,7 +178,6 @@ setupenvironment() { test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" # ----- - addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" cd $TMPWORKINGDIRECTORY mkdir rootdir aptarchive keys cd rootdir @@ -210,6 +210,7 @@ setupenvironment() { cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources fi cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys/ + chmod 644 $(find keys -name '*.pub' -o -name '*.sec') ln -s ${TMPWORKINGDIRECTORY}/keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf @@ -837,9 +838,7 @@ setupaptarchive() { fi signreleasefiles if [ "$1" != '--no-update' ]; then - msgninfo "\tSync APT's cache with the archive… " - aptget update -qq - msgdone "info" + testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true fi } @@ -1175,6 +1174,19 @@ testfailure() { fi } +testaccessrights() { + msgtest "Test that file $1 has access rights set to" "$2" + if [ "$2" = "$(stat --format '%a' "$1")" ]; then + msgpass + else + echo >&2 + ls -l >&2 "$1" + echo -n >&2 "stat(1) reports access rights: " + stat --format '%a' "$1" + msgfail + fi +} + testwebserverlaststatuscode() { local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log' local STATUS='rootdir/tmp/webserverstatus-statusfile.log' diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 58ed44f8f..0514542b3 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -11,8 +11,23 @@ buildsimplenativepackage 'apt' 'all' '1.0' 'stable' buildsimplenativepackage 'apt' 'all' '2.0' 'unstable' insertinstalledpackage 'vrms' 'all' '1.0' +umask 0027 + setupaptarchive +# apt-ftparchive knows how to chmod files +find aptarchive/dists -name '*Packages*' -type f | while read file; do + testaccessrights "$file" '644' +done +# created by the framework without special care +find aptarchive/dists -name '*Release*' -type f | while read file; do + testaccessrights "$file" '640' +done +# all copied files are properly chmodded +find rootdir/var/lib/apt/lists -type f | while read file; do + testaccessrights "$file" '644' +done + testdownload() { local APT="$2" if [ -n "$3" ]; then @@ -65,6 +80,7 @@ testsuccess aptget update # test with already stored deb testsuccess aptget install -d apt testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb +testaccessrights 'aptarchive/pool/apt_2.0_all.deb' '644' mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone testdownload apt_2.0_all.deb apt mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth index cf5195024..b7ccd6cf3 100755 --- a/test/integration/test-apt-update-unauth +++ b/test/integration/test-apt-update-unauth @@ -27,7 +27,7 @@ runtest() { find rootdir/var/lib/apt/lists/ -type f | xargs rm -f rm -f aptarchive/dists/unstable/*Release* - aptget update -qq --allow-insecure-repositories + testsuccess aptget update -qq --allow-insecure-repositories # FIXME: this really shouldn't be needed rm -f rootdir/var/lib/apt/lists/partial/* @@ -41,7 +41,6 @@ runtest() { aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed # and ensure we re-check the downloaded data - msgtest "Check rollback on going from unauth -> auth" # change the local packages file PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*) @@ -49,18 +48,22 @@ runtest() { ls rootdir/var/lib/apt/lists/ > lists.before # update and ensure all is reverted on the hashsum failure - aptget update -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 -o Debug::acquire::http=0 > output.log 2>&1 || true + testfailure aptget update -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 -o Debug::acquire::http=0 # ensure we have before what we have after + msgtest 'Check rollback on going from' 'unauth -> auth' ls rootdir/var/lib/apt/lists/ > lists.after - if diff -u lists.before lists.after; then + if cmp lists.before lists.after; then msgpass else - cat output.log - msgfail + echo >&2 '### Output of previous apt-get update ###' + cat >&2 rootdir/tmp/testfailure.output + echo >&2 '### Changes in the lists-directory: ###' + diff -u >&2 lists.before lists.after + msgfail fi - # move uncompressed back for release file + # move uncompressed back for release file mv aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed \ aptarchive/dists/unstable/main/binary-i386/Packages } @@ -72,6 +75,5 @@ for COMPRESSEDINDEXES in 'false' 'true'; do else msgmsg 'Run tests with GzipIndexes disabled' fi - - runtest + runtest done -- cgit v1.2.3 From 4dbfe436c60880f2625e4d3a9d0127a83dd6276e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 7 Oct 2014 01:46:30 +0200 Subject: display errortext for all Err as well as Ign logs consistently using Item::Failed in all specializec classes helps setting up some information bits otherwise unset, so some errors had an empty reason as an error. Ign is upgraded to display the error message we ignored to further help in understanding what happens. --- test/integration/framework | 13 ++- .../integration/test-apt-get-update-unauth-warning | 7 +- test/integration/test-apt-update-ims | 5 +- test/integration/test-apt-update-nofallback | 2 +- test/integration/test-apt-update-rollback | 101 ++++++++++----------- .../test-bug-595691-empty-and-broken-archive-files | 2 +- 6 files changed, 70 insertions(+), 60 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 688a1abf2..29e5fafe6 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -715,7 +715,7 @@ buildaptarchivefromincoming() { aptftparchive -qq generate ftparchive.conf cd - > /dev/null msgdone "info" - generatereleasefiles + generatereleasefiles "$@" } buildaptarchivefromfiles() { @@ -830,14 +830,19 @@ setupflataptarchive() { } setupaptarchive() { - buildaptarchive + local NOUPDATE=0 + if [ "$1" = '--no-update' ]; then + NOUPDATE=1 + shift + fi + buildaptarchive "$@" if [ -e aptarchive/dists ]; then setupdistsaptarchive else setupflataptarchive fi - signreleasefiles - if [ "$1" != '--no-update' ]; then + signreleasefiles 'Joe Sixpack' "$@" + if [ "1" != "$NOUPDATE" ]; then testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true fi } diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index 27160b5f9..8e212a3c4 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -20,11 +20,12 @@ rm -f $APTARCHIVE/dists/unstable/*Release* # update without authenticated files leads to warning testequal "Ign file: unstable InRelease + File not found Err file: unstable Release - + File not found W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository. W: Use --allow-insecure-repositories to force the update -W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release +W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release File not found E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update @@ -34,7 +35,9 @@ testequal "partial" ls rootdir/var/lib/apt/lists # allow override testequal "Ign file: unstable InRelease + File not found Ign file: unstable Release + File not found Reading package lists... W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." aptget update --allow-insecure-repositories # ensure we can not install the package diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 61b808b0f..8aa5a7262 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -44,8 +44,9 @@ echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex runtest msgmsg "Release/Release.gpg" -# with Release/Release.gpg +# with Release/Release.gpg EXPECT="Ign http://localhost:8080 unstable InRelease + 404 Not Found Hit http://localhost:8080 unstable Release Hit http://localhost:8080 unstable Release.gpg Hit http://localhost:8080 unstable/main Sources @@ -65,8 +66,10 @@ runtest # no Release.gpg or InRelease msgmsg "Release only" EXPECT="Ign http://localhost:8080 unstable InRelease + 404 Not Found Hit http://localhost:8080 unstable Release Ign http://localhost:8080 unstable Release.gpg + 404 Not Found Hit http://localhost:8080 unstable/main Sources Hit http://localhost:8080 unstable/main amd64 Packages Hit http://localhost:8080 unstable/main Translation-en diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index c400dcc36..321472c2e 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -161,7 +161,7 @@ test_inrelease_to_invalid_inrelease() testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) -W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease +W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index ee8bc6926..5b9c200fe 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -19,44 +19,44 @@ create_fresh_archive() insertpackage 'unstable' 'old' 'all' '1.0' - setupaptarchive + setupaptarchive --no-update } add_new_package() { insertpackage "unstable" "new" "all" "1.0" insertsource "unstable" "new" "all" "1.0" - setupaptarchive --no-update - - avoid_ims_hit + setupaptarchive --no-update "$@" } break_repository_sources_index() { - printf "xxx" > $APTARCHIVE/dists/unstable/main/source/Sources - gzip -c $APTARCHIVE/dists/unstable/main/source/Sources > \ - $APTARCHIVE/dists/unstable/main/source/Sources.gz - avoid_ims_hit + printf 'xxx' > $APTARCHIVE/dists/unstable/main/source/Sources + compressfile "$APTARCHIVE/dists/unstable/main/source/Sources" "$@" } -test_inrelease_to_new_inrelease() { - msgmsg "Test InRelease to new InRelease works fine" +start_with_good_inrelease() { create_fresh_archive + testsuccess aptget update testequal "old/unstable 1.0 all" apt list -q +} - add_new_package +test_inrelease_to_new_inrelease() { + msgmsg 'Test InRelease to new InRelease works fine' + start_with_good_inrelease + add_new_package '+1hour' testsuccess aptget update -o Debug::Acquire::Transaction=1 - testequal "new/unstable 1.0 all old/unstable 1.0 all" apt list -q } test_inrelease_to_broken_hash_reverts_all() { - msgmsg "Test InRelease to broken InRelease reverts everything" - create_fresh_archive - add_new_package + msgmsg 'Test InRelease to broken InRelease reverts everything' + start_with_good_inrelease + + add_new_package '+1hour' # break the Sources file - break_repository_sources_index + break_repository_sources_index '+1hour' # test the error condition testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch @@ -66,14 +66,14 @@ E: Some index files failed to download. They have been ignored, or old ones used testequal "E: Unable to locate package new" aptget install new -s -qq } -test_inreleae_to_valid_release() { - msgmsg "Test InRelease to valid Release" - create_fresh_archive - add_new_package - # switch to a unsinged repo now +test_inrelease_to_valid_release() { + msgmsg 'Test InRelease to valid Release' + start_with_good_inrelease + + add_new_package '+1hour' + # switch to a unsigned repo now rm $APTARCHIVE/dists/unstable/InRelease rm $APTARCHIVE/dists/unstable/Release.gpg - avoid_ims_hit # update fails testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq @@ -85,16 +85,17 @@ test_inreleae_to_valid_release() { testfailure ls $ROOTDIR/var/lib/apt/lists/*_Release } -test_inreleae_to_release_reverts_all() { - msgmsg "Test InRelease to broken Release reverts everything" - create_fresh_archive +test_inrelease_to_release_reverts_all() { + msgmsg 'Test InRelease to broken Release reverts everything' + start_with_good_inrelease - # switch to a unsinged repo now - add_new_package + # switch to a unsigned repo now + add_new_package '+1hour' rm $APTARCHIVE/dists/unstable/InRelease rm $APTARCHIVE/dists/unstable/Release.gpg + # break it - break_repository_sources_index + break_repository_sources_index '+1hour' # ensure error testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 @@ -107,21 +108,19 @@ test_inreleae_to_release_reverts_all() { } test_unauthenticated_to_invalid_inrelease() { - msgmsg "Test UnAuthenticated to invalid InRelease reverts everything" + msgmsg 'Test UnAuthenticated to invalid InRelease reverts everything' create_fresh_archive - rm -rf rootdir/var/lib/apt/lists/* rm $APTARCHIVE/dists/unstable/InRelease rm $APTARCHIVE/dists/unstable/Release.gpg - avoid_ims_hit - - testsuccess aptget update -qq --allow-insecure-repositories + + testsuccess aptget update --allow-insecure-repositories testequal "WARNING: The following packages cannot be authenticated! old E: There are problems and -y was used without --force-yes" aptget install -qq -y old - + # go to authenticated but not correct - add_new_package - break_repository_sources_index + add_new_package '+1hour' + break_repository_sources_index '+1hour' testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch @@ -134,14 +133,14 @@ E: There are problems and -y was used without --force-yes" aptget install -qq -y } test_inrelease_to_unauth_inrelease() { - msgmsg "Test InRelease to InRelease without sig" - create_fresh_archive - signreleasefiles 'Marvin Paranoid' - avoid_ims_hit - + msgmsg 'Test InRelease to InRelease without good sig' + start_with_good_inrelease + + signreleasefiles 'Marvin Paranoid' '+1hour' + testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 -W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease +W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq @@ -150,13 +149,13 @@ W: Some index files failed to download. They have been ignored, or old ones used test_inrelease_to_broken_gzip() { msgmsg "Test InRelease to broken gzip" - create_fresh_archive - # append junk at the end of the gzip, this + start_with_good_inrelease + + # append junk at the end of the compressed file echo "lala" >> $APTARCHIVE/dists/unstable/main/source/Sources.gz - # remove uncompressed file, otherwise apt will just fallback fetching - # that + touch -d '+2min' $APTARCHIVE/dists/unstable/main/source/Sources.gz + # remove uncompressed file to avoid fallback rm $APTARCHIVE/dists/unstable/main/source/Sources - avoid_ims_hit testfailure aptget update } @@ -174,7 +173,7 @@ ROOTDIR=${TMPWORKINGDIRECTORY}/rootdir APTARCHIVE_LISTS="$(echo $APTARCHIVE | tr "/" "_" )" # test the following cases: -# - InRelease -> broken InRelease revert to previous state +# - InRelease -> broken InRelease revert to previous state # - empty lists dir and broken remote leaves nothing on the system # - InRelease -> hashsum mismatch for one file reverts all files to previous state # - Release/Release.gpg -> hashsum mismatch @@ -184,13 +183,13 @@ APTARCHIVE_LISTS="$(echo $APTARCHIVE | tr "/" "_" )" # - unauthenticated -> invalid InRelease # stuff to do: -# - ims-hit +# - ims-hit # - gzip-index tests test_inrelease_to_new_inrelease test_inrelease_to_broken_hash_reverts_all -test_inreleae_to_valid_release -test_inreleae_to_release_reverts_all +test_inrelease_to_valid_release +test_inrelease_to_release_reverts_all test_unauthenticated_to_invalid_inrelease test_inrelease_to_unauth_inrelease test_inrelease_to_broken_gzip diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files index 683c174bd..fedf82c92 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -13,7 +13,7 @@ setupflataptarchive testaptgetupdate() { rm -rf rootdir/var/lib/apt aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true - sed -i -e '/Ign / d' -e '/Release/ d' -e 's#Get:[0-9]\+ #Get: #' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff + sed -i -e '/Ign /,+1d' -e '/Release/ d' -e 's#Get:[0-9]\+ #Get: #' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff GIVEN="$1" shift msgtest "Test for correctness of" "apt-get update with $*" -- cgit v1.2.3 From c86bc8515a3a195aa244a1743476b102d72c9a2a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 7 Oct 2014 13:17:16 +0200 Subject: fix test-cve-2013-1051-InRelease-parsing (fails now in the method) --- test/integration/test-cve-2013-1051-InRelease-parsing | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-cve-2013-1051-InRelease-parsing b/test/integration/test-cve-2013-1051-InRelease-parsing index 41b27f691..8f9803991 100755 --- a/test/integration/test-cve-2013-1051-InRelease-parsing +++ b/test/integration/test-cve-2013-1051-InRelease-parsing @@ -42,7 +42,7 @@ touch -d '+1hour' aptarchive/dists/stable/InRelease # ensure the update fails # useful for debugging to add "-o Debug::pkgAcquire::auth=true" msgtest 'apt-get update for should fail with the modified' 'InRelease' -aptget update 2>&1 | grep -q 'Hash Sum mismatch' > /dev/null && msgpass || msgfail +aptget update 2>&1 | grep -E -q '(Writing more data than expected|Hash Sum mismatch)' > /dev/null && msgpass || msgfail # ensure there is no package testequal 'Reading package lists... -- cgit v1.2.3 From c48eea97b93920062ea26001081d4fdf7eb967e3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 7 Oct 2014 17:47:30 +0200 Subject: make expected-size a maximum-size check as this is what we want at this point --- test/integration/test-apt-update-expected-size | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 72812336d..c1eecc08a 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -15,6 +15,13 @@ changetowebserver # normal update works fine testsuccess aptget update +# make InRelease really big +mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good +dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 +touch -d '+1hour' aptarchive/dists/unstable/InRelease +aptget update -o acquire::MaxReleaseFileSize=$((1*1000*1000)) + + # append junk at the end of the Packages.gz/Packages SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" echo "1234567890" >> aptarchive/dists/unstable/main/binary-i386/Packages.gz -- cgit v1.2.3 From 27e6c17a18216e2a02de39a6d1722b83ac823d42 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 7 Oct 2014 20:40:37 +0200 Subject: Add new Acquire::MaxReleaseFileSize=10*1000*1000 option This option controls the maximum size of Release/Release.gpg/InRelease files. The rational is that we do not know the size of these files in advance and we want to protect against a denial of service attack where someone sends us endless amounts of data until the disk is full (we do know the size all other files (Packages/Sources/debs)). --- test/integration/test-apt-update-expected-size | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index c1eecc08a..f8ec24dcc 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -17,10 +17,17 @@ testsuccess aptget update # make InRelease really big mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good -dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 +dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null touch -d '+1hour' aptarchive/dists/unstable/InRelease -aptget update -o acquire::MaxReleaseFileSize=$((1*1000*1000)) - +aptget update -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 > output.log +msgtest 'Check that the max write warning is triggered' +if grep -q "Writing more data than expected" output.log; then + msgpass +else + cat output.log + msgfail +fi +mv aptarchive/dists/unstable/InRelease.good aptarchive/dists/unstable/InRelease # append junk at the end of the Packages.gz/Packages SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" -- cgit v1.2.3 From d6cf2345a35896448e19bfb294ffe66faab00f86 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 7 Oct 2014 20:51:07 +0200 Subject: don't show ErrorText for Ign by default Some distributions (or repositories) do not have as much "Ign-discipline" as I would like to, so that could be pretty distracting for our users if enabled by default. It is handy for testcases though. Git-Dch: Ignore --- test/integration/framework | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 0aa648fb6..ad3c33c28 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -215,6 +215,7 @@ setupenvironment() { cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys/ chmod 644 $(find keys -name '*.pub' -o -name '*.sec') ln -s ${TMPWORKINGDIRECTORY}/keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf echo "Debug::NoLocking \"true\";" >> aptconfig.conf @@ -232,8 +233,11 @@ setupenvironment() { echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf echo 'quiet::NoUpdate "true";' >> aptconfig.conf echo 'quiet::NoStatistic "true";' >> aptconfig.conf + # too distracting for users, but helpful to detect changes + echo 'Acquire::Progress::Ignore::ShowErrorText "true";' >> aptconfig.conf + echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https - echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary + echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary configcompression '.' 'gz' #'bz2' 'lzma' 'xz' # cleanup the environment a bit -- cgit v1.2.3 From ee27950632c149bb14c9c490e92147579ba4fc2a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 7 Oct 2014 22:36:09 +0200 Subject: Send "Fail-Reason: MaximumSizeExceeded" from the method Communicate the fail reason from the methods to the parent and Rename() failed files. --- test/integration/test-apt-update-expected-size | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index f8ec24dcc..58920f544 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -19,7 +19,7 @@ testsuccess aptget update mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null touch -d '+1hour' aptarchive/dists/unstable/InRelease -aptget update -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 > output.log +aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 > output.log msgtest 'Check that the max write warning is triggered' if grep -q "Writing more data than expected" output.log; then msgpass @@ -27,8 +27,11 @@ else cat output.log msgfail fi +# ensure the failed InRelease file got renamed +testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED mv aptarchive/dists/unstable/InRelease.good aptarchive/dists/unstable/InRelease + # append junk at the end of the Packages.gz/Packages SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" echo "1234567890" >> aptarchive/dists/unstable/main/binary-i386/Packages.gz -- cgit v1.2.3 From 0045df3fc7c3c1dba084682805b50203472d443f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 7 Oct 2014 23:52:12 +0200 Subject: do not show IP in output of testcases On travis-ci connect.cc detects a rotation, triggering it store the IP which is later appended to the error message, which is all nice and great if we deal with a real server, but in the testcases it just triggers failures as strings do not match. Git-Dch: Ignore --- test/integration/framework | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index ad3c33c28..75cec204c 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -235,6 +235,9 @@ setupenvironment() { echo 'quiet::NoStatistic "true";' >> aptconfig.conf # too distracting for users, but helpful to detect changes echo 'Acquire::Progress::Ignore::ShowErrorText "true";' >> aptconfig.conf + # in testcases, it can appear as if localhost has a rotation setup, + # hide this as we can't really deal with it properly + echo 'Acquire::Failure::ShowIP "false";' >> aptconfig.conf echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary -- cgit v1.2.3 From f9a3c4bde867e70e8c89b6ed5924ab9fab517096 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 8 Oct 2014 00:37:32 +0200 Subject: fix http-pipeline-messup testcase The test generates failures if the created deb files have the same size, so we try a little harder to avoid having the same size for them. Git-Dch: Ignore --- test/integration/test-http-pipeline-messup | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/integration/test-http-pipeline-messup b/test/integration/test-http-pipeline-messup index 9c59e1825..405574e8a 100755 --- a/test/integration/test-http-pipeline-messup +++ b/test/integration/test-http-pipeline-messup @@ -7,10 +7,11 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -buildsimplenativepackage 'pkga' 'all' '1.0' 'stable' -buildsimplenativepackage 'pkgb' 'all' '1.0' 'stable' -buildsimplenativepackage 'pkgc' 'all' '1.0' 'stable' -buildsimplenativepackage 'pkgd' 'all' '1.0' 'stable' +# try a little harder to create a size mismatch +buildsimplenativepackage 'pkga' 'all' '1.0' 'stable' "Depends: foo" '' '' '' '' 'none' +buildsimplenativepackage 'pkgb' 'all' '1.0' 'stable' "Depends: foo" '' '' '' '' 'none' +buildsimplenativepackage 'pkgc' 'all' '1.0' 'stable' "Depends: f$(for i in $(seq 0 1000); do printf 'o'; done)" '' '' '' '' 'none' +buildsimplenativepackage 'pkgd' 'all' '1.0' 'stable' "Depends: f$(for i in $(seq 0 1000); do printf 'o'; done)" '' '' '' '' 'none' setupaptarchive --no-update @@ -21,17 +22,20 @@ changetowebserver \ -o 'aptwebserver::overwrite::.*pkgb.*::filename=/pool/pkgc_1.0_all.deb' \ -o 'aptwebserver::overwrite::.*pkgd.*::filename=/pool/pkga_1.0_all.deb' -testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::pkgAcquire::Worker=1 +echo 'Debug::Acquire::http "true"; +Debug::pkgAcquire::Worker "true";' > rootdir/etc/apt/apt.conf.d/99debug + +testsuccess aptget update # messup is bigger than pipeline: checks if fixup isn't trying to hard -testfailure aptget download pkga pkgb pkgc pkgd "$@" -o Acquire::http::Pipeline-Depth=2 +testfailure aptget download pkga pkgb pkgc pkgd -o Acquire::http::Pipeline-Depth=2 testfailure test -f pkga_1.0_all.deb # ensure that pipeling is enabled for rest of this test echo 'Acquire::http::Pipeline-Depth 10;' > rootdir/etc/apt/apt.conf.d/99enable-pipeline # the output is a bit strange: it looks like it has downloaded pkga 4 times -testsuccess aptget download pkga pkgb pkgc pkgd -o Debug::Acquire::http=1 -o Debug::pkgAcquire::Worker=1 +testsuccess aptget download pkga pkgb pkgc pkgd for pkg in 'pkga' 'pkgb' 'pkgc' 'pkgd'; do testsuccess test -f ${pkg}_1.0_all.deb testsuccess cmp incoming/${pkg}_1.0_all.deb ${pkg}_1.0_all.deb @@ -40,4 +44,4 @@ done # while hashes will pass (as none are available), sizes will not match, so failure # checks that no hashes means that pipeline depth is ignored as we can't fixup -testfailure aptget download pkga pkgb pkgc pkgd "$@" --allow-unauthenticated -o Acquire::ForceHash=ROT26 +testfailure aptget download pkga pkgb pkgc pkgd --allow-unauthenticated -o Acquire::ForceHash=ROT26 -- cgit v1.2.3 From 07cb47e71f4de7e3c57f9dcfbfb82e4e5566aed6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 13 Oct 2014 08:12:06 +0200 Subject: trusted=yes sources are secure, we just don't know why Do not require a special flag to be present to update trusted=yes sources as this flag in the sources.list is obviously special enough. Note that this is just disabling the error message, the user will still be warned about all the (possible) failures the repository generated, it is just triggering the acceptance of the warnings on a source-by-source level. Similarily, the trusted=no flag doesn't require the user to pass additional flags to update, if the repository looks fine in the view of apt it will update just fine. The unauthenticated warnings will "just" be presented then the data is used. In case you wonder: Both was the behavior in previous versions, too. --- test/integration/framework | 9 +- test/integration/test-sourceslist-trusted-options | 168 ++++++++++++++++++++++ 2 files changed, 174 insertions(+), 3 deletions(-) create mode 100755 test/integration/test-sourceslist-trusted-options (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 75cec204c..76425f0c3 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -859,6 +859,7 @@ setupaptarchive() { signreleasefiles() { local SIGNER="${1:-Joe Sixpack}" + local REPODIR="${2:-aptarchive}" local KEY="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | sed 's# ##g')" local GPG="aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly adv --batch --yes" msgninfo "\tSign archive with $SIGNER key $KEY… " @@ -885,7 +886,7 @@ signreleasefiles() { cp ${REXKEY}.pub $PUBUNEXPIRED fi fi - for RELEASE in $(find aptarchive/ -name Release); do + for RELEASE in $(find ${REPODIR}/ -name Release); do $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg ${RELEASE} local INRELEASE="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE @@ -1167,9 +1168,10 @@ testsuccess() { if $@ >${OUTPUT} 2>&1; then msgpass else + local EXITCODE=$? echo >&2 cat >&2 $OUTPUT - msgfail + msgfail "exitcode $EXITCODE" fi } @@ -1181,9 +1183,10 @@ testfailure() { fi local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" if $@ >${OUTPUT} 2>&1; then + local EXITCODE=$? echo >&2 cat >&2 $OUTPUT - msgfail + msgfail "exitcode $EXITCODE" else msgpass fi diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options new file mode 100755 index 000000000..ae65cca83 --- /dev/null +++ b/test/integration/test-sourceslist-trusted-options @@ -0,0 +1,168 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'foo' 'amd64' '1' 'stable' +buildsimplenativepackage 'foo' 'amd64' '2' 'testing' + +setupaptarchive --no-update + +APTARCHIVE=$(readlink -f ./aptarchive) + +everythingsucceeds() { + testequal 'Listing... +foo/testing 2 amd64 +foo/stable 1 amd64 +' apt list foo -a + + rm -f foo_1_amd64.deb foo_2_amd64.deb + testsuccess aptget download foo "$@" + testsuccess test -s foo_1_amd64.deb -o -s foo_2_amd64.deb + + rm -f foo_1.dsc foo_2.dsc + testsuccess aptget source foo --dsc-only -d "$@" + testsuccess test -s foo_1.dsc -o -s foo_2.dsc +} + +everythingfails() { + testequal 'Listing... +foo/testing 2 amd64 +foo/stable 1 amd64 +' apt list foo -a + + local WARNING='WARNING: The following packages cannot be authenticated! + foo +E: Some packages could not be authenticated' + + rm -f foo_1_amd64.deb foo_2_amd64.deb + testfailure aptget download foo "$@" + testequal "$WARNING" tail -n 3 rootdir/tmp/testfailure.output + testfailure test -s foo_1_amd64.deb -o -s foo_2_amd64.deb + + rm -f foo_1.dsc foo_2.dsc + testfailure aptget source foo --dsc-only -d "$@" + testequal "$WARNING" tail -n 3 rootdir/tmp/testfailure.output + testfailure test -s foo_1.dsc -o -s foo_2.dsc +} + +cp -a rootdir/etc/apt/sources.list.d/ rootdir/etc/apt/sources.list.d.bak/ + +aptgetupdate() { + rm -rf rootdir/var/lib/apt/lists + # note that insecure with trusted=yes are allowed + # as the trusted=yes indicates that security is provided by + # something above the understanding of apt + testsuccess aptget update --no-allow-insecure-repositories +} + +insecureaptgetupdate() { + rm -rf rootdir/var/lib/apt/lists + testfailure aptget update + rm -rf rootdir/var/lib/apt/lists + testsuccess aptget update --allow-insecure-repositories +} + +msgmsg 'Test without trusted option and good sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +aptgetupdate +everythingsucceeds +everythingsucceeds -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=yes option and good sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* +aptgetupdate +everythingsucceeds +everythingsucceeds -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=no option and good sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/* +# we want the warnings on the actions, but for 'update' everything is fine +aptgetupdate +everythingfails +everythingfails -t stable +everythingfails -t testing + +find aptarchive/dists/stable \( -name 'InRelease' -o -name 'Release.gpg' \) -delete + +msgmsg 'Test without trusted option and good and unsigned sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +insecureaptgetupdate +everythingsucceeds +everythingfails -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=yes option and good and unsigned sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* +aptgetupdate +everythingsucceeds +everythingsucceeds -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=no option and good and unsigned sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/* +insecureaptgetupdate +everythingfails +everythingfails -t stable +everythingfails -t testing + +signreleasefiles 'Marvin Paranoid' 'aptarchive/dists/stable' + +msgmsg 'Test without trusted option and good and unknown sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +insecureaptgetupdate +everythingsucceeds +everythingfails -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=yes option and good and unknown sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* +aptgetupdate +everythingsucceeds +everythingsucceeds -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=no option and good and unknown sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/* +insecureaptgetupdate +everythingfails +everythingfails -t stable +everythingfails -t testing + +signreleasefiles 'Rex Expired' 'aptarchive/dists/stable' +cp -a keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg + +msgmsg 'Test without trusted option and good and expired sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +insecureaptgetupdate +everythingsucceeds +everythingfails -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=yes option and good and expired sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* +aptgetupdate +everythingsucceeds +everythingsucceeds -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=no option and good and expired sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/* +insecureaptgetupdate +everythingfails +everythingfails -t stable +everythingfails -t testing -- cgit v1.2.3 From 9d653a6de2ca952247cc4e628256259d225570a6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 13 Oct 2014 09:54:21 +0200 Subject: fix compile and tests error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I am pretty sure I did that before committing broken stuff… Git-Dch: Ignore --- test/integration/framework | 2 +- .../integration/test-apt-get-update-unauth-warning | 5 +--- test/integration/test-apt-update-expected-size | 2 +- test/integration/test-apt-update-ims | 3 ++- test/integration/test-apt-update-rollback | 2 +- test/integration/test-sourceslist-trusted-options | 27 ++++++++++++++++++++++ 6 files changed, 33 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 76425f0c3..160df9301 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -851,7 +851,7 @@ setupaptarchive() { else setupflataptarchive fi - signreleasefiles 'Joe Sixpack' "$@" + signreleasefiles 'Joe Sixpack' if [ "1" != "$NOUPDATE" ]; then testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true fi diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index 8e212a3c4..fe0cb45a4 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -24,10 +24,7 @@ testequal "Ign file: unstable InRelease Err file: unstable Release File not found W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository. -W: Use --allow-insecure-repositories to force the update -W: Failed to fetch file:$APTARCHIVE/dists/unstable/Release File not found - -E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update +E: Use --allow-insecure-repositories to force the update" aptget update # no package foo testequal "Listing..." apt list foo diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 58920f544..a039e9e1c 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -38,7 +38,7 @@ echo "1234567890" >> aptarchive/dists/unstable/main/binary-i386/Packages.gz echo "1234567890" >> aptarchive/dists/unstable/main/binary-i386/Packages NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" rm -f rootdir/var/lib/apt/lists/localhost* -testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) [IP: ::1 8080] +testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 8aa5a7262..06b9c2b62 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -73,7 +73,8 @@ Ign http://localhost:8080 unstable Release.gpg Hit http://localhost:8080 unstable/main Sources Hit http://localhost:8080 unstable/main amd64 Packages Hit http://localhost:8080 unstable/main Translation-en -Reading package lists..." +Reading package lists... +W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated." find aptarchive -name "Release.gpg" | xargs rm -f diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index 5b9c200fe..220c3052b 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -136,7 +136,7 @@ test_inrelease_to_unauth_inrelease() { msgmsg 'Test InRelease to InRelease without good sig' start_with_good_inrelease - signreleasefiles 'Marvin Paranoid' '+1hour' + signreleasefiles 'Marvin Paranoid' testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options index ae65cca83..1178df46a 100755 --- a/test/integration/test-sourceslist-trusted-options +++ b/test/integration/test-sourceslist-trusted-options @@ -166,3 +166,30 @@ insecureaptgetupdate everythingfails everythingfails -t stable everythingfails -t testing + +# same as the one further above, but this time testing is unsigned +find aptarchive/ \( -name 'InRelease' -o -name 'Release.gpg' \) -delete +signreleasefiles 'Joe Sixpack' 'aptarchive/dists/stable' + +msgmsg 'Test without trusted option and unsigned and good sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +insecureaptgetupdate +everythingfails +everythingsucceeds -t stable +everythingfails -t testing + +msgmsg 'Test with trusted=yes option and unsigned and good sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* +aptgetupdate +everythingsucceeds +everythingsucceeds -t stable +everythingsucceeds -t testing + +msgmsg 'Test with trusted=no option and unsigned and good sources' +cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ +sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/* +insecureaptgetupdate +everythingfails +everythingfails -t stable +everythingfails -t testing -- cgit v1.2.3 From 78bc8d6b16c898c30ab046519d758ee9c1c6f42b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 13 Oct 2014 10:24:54 +0200 Subject: do not load filesize in pkgAcqIndexTrans explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The constructor is calling the baseclass pkgAcqIndex which does this already – and also does it correctly for compressed files which would overwise lead to the size of uncompressed files to be expected. Git-Dch: Ignore --- test/integration/test-bug-596498-trusted-unsigned-repo | 2 +- test/integration/test-compressed-indexes | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo index 3104a70c2..a08c153f8 100755 --- a/test/integration/test-bug-596498-trusted-unsigned-repo +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -12,7 +12,7 @@ setupaptarchive aptgetupdate() { rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin - aptget update -qq --allow-insecure-repositories + testsuccess aptget update --allow-insecure-repositories } PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)" diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 1beb5d831..f67077973 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -51,6 +51,7 @@ testrun() { ! test -e rootdir/var/lib/apt/lists/*_Translation-en.* || F=1 fi if [ -n "$F" ]; then + cat rootdir/tmp/testsuccess.output ls -laR rootdir/var/lib/apt/lists/ msgfail else @@ -103,15 +104,15 @@ testovermethod() { INDCOMP='compressed' fi - testsuccess aptget update + testsuccess aptget update -o Debug::Acquire::http=1 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes" testrun "$INDCOMP" - testsuccess aptget update -o Acquire::Pdiffs=1 + testsuccess aptget update -o Acquire::Pdiffs=1 -o Debug::Acquire::http=1 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes (update unchanged with pdiffs)" testrun "$INDCOMP" - testsuccess aptget update -o Acquire::Pdiffs=0 + testsuccess aptget update -o Acquire::Pdiffs=0 -o Debug::Acquire::http=1 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes (update unchanged without pdiffs)" testrun "$INDCOMP" -- cgit v1.2.3 From d4f4bcf76bb2035b7df370a82b081384140b3083 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 14 Oct 2014 17:00:56 +0200 Subject: Add new configallowinsecurerepositories to the test framework Add a new configallowinsecurerepositories that controls the value of Acquire::AllowInsecureRepositories for the tests. Set it to "false" for most of the testsuite and only enable it where its really needed. We want to switch the default for this post-jessie. --- test/integration/framework | 9 +++++++++ test/integration/test-apt-update-ims | 2 ++ 2 files changed, 11 insertions(+) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 160df9301..96b867788 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -243,6 +243,10 @@ setupenvironment() { echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary configcompression '.' 'gz' #'bz2' 'lzma' 'xz' + # Acquire::AllowInsecureRepositories=false is not yet the default + # but we want it to be the default soon + configallowinsecurerepositories "false"; + # cleanup the environment a bit # prefer our apt binaries over the system apt binaries export PATH="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin" @@ -317,6 +321,11 @@ configdpkg() { fi } +configallowinsecurerepositories() { + echo "Acquire::AllowInsecureRepositories \"$1\";" > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf + +} + configcompression() { while [ -n "$1" ]; do case "$1" in diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 06b9c2b62..c74058c5d 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -64,6 +64,8 @@ runtest # no Release.gpg or InRelease +configallowinsecurerepositories "true" + msgmsg "Release only" EXPECT="Ign http://localhost:8080 unstable InRelease 404 Not Found -- cgit v1.2.3 From 68ba0b7f4e1c03edfb6f621e7e7314ea610af96b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Oct 2014 03:47:50 +0200 Subject: testcases runable as root Running the testcases is usually not a good idea, but it can be handy to check if the privilege dropping works. Git-Dch: Ignore --- test/integration/framework | 31 ++++++++++++++++++---- test/integration/test-apt-get-changelog | 9 +++---- test/integration/test-apt-get-download | 13 +++++++-- .../integration/test-apt-get-update-unauth-warning | 2 +- ...test-bug-254770-segfault-if-cache-not-buildable | 14 +++++++--- test/integration/test-bug-738785-switch-protocol | 8 +++++- test/integration/test-sourceslist-trusted-options | 2 +- 7 files changed, 61 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 96b867788..a8d6bf3d0 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -43,7 +43,10 @@ msgtest() { printf "…${CNORMAL} " } msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } -msgskip() { printf "${CWARNING}SKIP${CNORMAL}\n" >&2; } +msgskip() { + if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; + else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi +} msgfail() { if [ $# -gt 0 ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi @@ -170,6 +173,12 @@ setupenvironment() { addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " + if [ "$(id -u)" = '0' ]; then + # relax permissions so that running as root with user switching works + umask 022 + chmod o+rx "$TMPWORKINGDIRECTORY" + fi + TESTDIRECTORY=$(readlink -f $(dirname $0)) # allow overriding the default BUILDDIR location BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"} @@ -185,7 +194,7 @@ setupenvironment() { mkdir rootdir aptarchive keys cd rootdir mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d - mkdir -p var/cache var/lib/apt var/log tmp + mkdir -p usr/bin var/cache var/lib/apt var/log tmp mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers touch var/lib/dpkg/available mkdir -p usr/lib/apt @@ -221,7 +230,15 @@ setupenvironment() { echo "Debug::NoLocking \"true\";" >> aptconfig.conf echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf - echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf + # store apt-key were we can access it, even if we run it as a different user + # destroys coverage reporting though, so just do it for root for now + if [ "$(id -u)" = '0' ]; then + cp "${BUILDDIRECTORY}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" + chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" + echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf + else + echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf + fi echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf @@ -239,7 +256,11 @@ setupenvironment() { # hide this as we can't really deal with it properly echo 'Acquire::Failure::ShowIP "false";' >> aptconfig.conf - echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https + cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" + if [ "$(id -u)" = '0' ]; then + chown _apt:root "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" + fi + echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary configcompression '.' 'gz' #'bz2' 'lzma' 'xz' @@ -977,7 +998,7 @@ changetohttpswebserver() { changetowebserver --no-rewrite "$@" fi echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid -cert = ${TESTDIRECTORY}/apt.pem +cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem output = /dev/null [https] diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 02d6c39ab..76a32a122 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -26,19 +26,18 @@ testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt testequal "'http://localhost:8080//pool/apt_1.0/changelog' 'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris -aptget changelog apt -qq > apt.changelog -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" -rm apt.changelog +testsuccess aptget changelog apt -qq +testfileequal 'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/apt_1.0/changelog)" testsuccess aptget changelog apt -d testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" -rm apt.changelog aptarchive/pool/apt_1.0/changelog +rm -f apt.changelog aptarchive/pool/apt_1.0/changelog testequal "$(cat aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' testsuccess aptget changelog apt -d testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" -rm apt.changelog aptarchive/pool/apt_1.0.changelog +rm -f apt.changelog aptarchive/pool/apt_1.0.changelog testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 0514542b3..9a154e5fb 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -11,18 +11,27 @@ buildsimplenativepackage 'apt' 'all' '1.0' 'stable' buildsimplenativepackage 'apt' 'all' '2.0' 'unstable' insertinstalledpackage 'vrms' 'all' '1.0' +OLD_UMASK="$(umask)" umask 0027 +setupaptarchive --no-update +umask "$OLD_UMASK" -setupaptarchive - +# directories should be readable by everyone +find aptarchive/dists -type d | while read dir; do + chmod o+rx "$dir" +done # apt-ftparchive knows how to chmod files find aptarchive/dists -name '*Packages*' -type f | while read file; do testaccessrights "$file" '644' + chmod 640 "$file" done # created by the framework without special care find aptarchive/dists -name '*Release*' -type f | while read file; do testaccessrights "$file" '640' done + +testsuccess aptget update + # all copied files are properly chmodded find rootdir/var/lib/apt/lists -type f | while read file; do testaccessrights "$file" '644' diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index fe0cb45a4..0389415c1 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -24,7 +24,7 @@ testequal "Ign file: unstable InRelease Err file: unstable Release File not found W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository. -E: Use --allow-insecure-repositories to force the update" aptget update +E: Use --allow-insecure-repositories to force the update" aptget update --no-allow-insecure-repositories # no package foo testequal "Listing..." apt list foo diff --git a/test/integration/test-bug-254770-segfault-if-cache-not-buildable b/test/integration/test-bug-254770-segfault-if-cache-not-buildable index 59102ddc9..6ae8944b2 100755 --- a/test/integration/test-bug-254770-segfault-if-cache-not-buildable +++ b/test/integration/test-bug-254770-segfault-if-cache-not-buildable @@ -3,17 +3,25 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework + +msgtest 'Test run as' 'non-root' +if [ "$(id -u)" = '0' ]; then + msgskip 'root has by definition no problems accessing files' + exit 0 +else + msgpass +fi + setupenvironment configarchitecture "i386" setupaptarchive -CURRENTTRAP="chmod a+x rootdir/var/lib/dpkg; $CURRENTTRAP" -trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM +addtrap 'prefix' 'chmod a+x rootdir/var/lib/dpkg;' chmod a-x rootdir/var/lib/dpkg testsegfault() { msgtest "No segfault in" "$*" - local TEST="$($* 2>&1 | grep -v 'E:')" + local TEST="$("$@" 2>&1 | grep -v 'E:')" if [ -z "$TEST" ]; then msgpass else diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index f81bba4b9..f450e5e5a 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -49,8 +49,14 @@ rm https cd - >/dev/null echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf -testequal "E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. +if [ "$(id -u)" = '0' ]; then + testequal "Can't drop privileges for downloading as file '$(pwd)/apt_1.0_all.deb' couldn't be accessed by user '_apt'. +E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed?" aptget download apt -q=0 +else + testequal "E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. +N: Is the package apt-transport-https installed?" aptget download apt -q=0 +fi testsuccess test ! -e apt_1.0_all.deb # revert to all methods diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options index 1178df46a..c954f2f4f 100755 --- a/test/integration/test-sourceslist-trusted-options +++ b/test/integration/test-sourceslist-trusted-options @@ -62,7 +62,7 @@ aptgetupdate() { insecureaptgetupdate() { rm -rf rootdir/var/lib/apt/lists - testfailure aptget update + testfailure aptget update --no-allow-insecure-repositories rm -rf rootdir/var/lib/apt/lists testsuccess aptget update --allow-insecure-repositories } -- cgit v1.2.3 From 5afcfe2a51a9e47e95023b99bcab065d1975e950 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Oct 2014 15:56:53 +0200 Subject: don't cleanup cdrom files in apt-get update Regression from merging 801745284905e7962aa77a9f37a6b4e7fcdc19d0 and b0f4b486e6850c5f98520ccf19da71d0ed748ae4. While fine by itself, merged the part fixing the filename is skipped if a cdrom source is encountered, so that our list-cleanup removes what seems to be orphaned files. Closes: 765458 --- test/integration/test-apt-cdrom | 49 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 8d8fdf167..44eccb7bf 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -66,22 +66,51 @@ CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: // testequal "CD::${CD_ID} \"${CD_LABEL}\"; CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list -testequal 'Reading package lists... +testcdromusage() { + touch rootdir/var/lib/apt/extended_states + + testequal 'Reading package lists... Building dependency tree... +Reading state information... The following NEW packages will be installed: testing 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst testing (0.8.15 stable [amd64]) Conf testing (0.8.15 stable [amd64])' aptget install testing -s -testequal 'Reading package lists... + testdpkgnotinstalled testing + testsuccess aptget install testing -y + testdpkginstalled testing + testsuccess aptget purge testing -y + testdpkgnotinstalled testing + + testequal 'Reading package lists... Building dependency tree... +Reading state information... The following NEW packages will be installed: testing:i386 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst testing:i386 (0.8.15 stable [i386]) Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s + testdpkgnotinstalled testing:i386 + testsuccess aptget install testing:i386 -y + testdpkginstalled testing:i386 + testsuccess aptget purge testing:i386 -y + testdpkgnotinstalled testing:i386 + + rm -f testing_0.8.15_amd64.deb + testsuccess aptget download testing + testsuccess test -s testing_0.8.15_amd64.deb + rm -f testing_0.8.15_amd64.deb + + rm -f testing_0.8.15.dsc + testsuccess aptget source testing --dsc-only -d + testsuccess test -s testing_0.8.15.dsc + rm -f testing_0.8.15.dsc +} +testcdromusage + # check Idempotence of apt-cdrom (and disabling of Translation dropping) testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures @@ -101,7 +130,15 @@ $CDROM_POST" aptcdromlog add msgtest 'Test for the english description translation of' 'testing' aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail -# check that we really can install from a 'cdrom' -testdpkgnotinstalled testing -testsuccess aptget install testing -y -testdpkginstalled testing +# ensure cdrom method isn't trying to mount the cdrom +mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected +# ensure an update doesn't mess with cdrom sources +testsuccess aptget update +testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' +mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted +testcdromusage + +# and again to check that it withstands the temptation even if it could mount +testsuccess aptget update +testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' +testcdromusage -- cgit v1.2.3 From 70b63c573fc532f7e1a9de82eb81385a8cca0cec Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Oct 2014 19:11:45 +0200 Subject: ignore Acquire::GzipIndexes for cdrom sources We do not support compressed indexes for cdrom sources as we rewrite some of them, so supporting it correctly could be hard. What we do instead in the meantime is probably disabling it for cdrom sources. --- test/integration/test-compressed-indexes | 35 +++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index f67077973..72b262e84 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -89,7 +89,8 @@ Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s echo 'Debug::pkgAcquire::worker "true"; debug::pkgAcquire::Auth "true"; -Debug::pkgAcquire::Diffs "true";' > rootdir/etc/apt/apt.conf.d/99debugconf +Debug::pkgAcquire::Diffs "true"; +Debug::Acquire::http "true";' > rootdir/etc/apt/apt.conf.d/99debugconf testovermethod() { forcecompressor $2 @@ -98,23 +99,28 @@ testovermethod() { rm -rf rootdir/var/lib/apt/lists echo "Acquire::GzipIndexes \"${INDEX}\";" > rootdir/etc/apt/apt.conf.d/02compressindex local INDCOMP - if [ "$INDEX" = 'false' ]; then + if [ "$INDEX" = 'false' -o "$1" = 'cdrom' ]; then INDCOMP='uncompressed' else INDCOMP='compressed' fi - testsuccess aptget update -o Debug::Acquire::http=1 - msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes" + msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX" + if [ "${1}" = 'cdrom' ]; then + testsuccess aptcdrom add Date: Sat, 18 Oct 2014 14:44:41 +0200 Subject: reenable support for -s (and co) in apt-get source The conversion to accept only relevant options for commands has forgotten another one, so adding it again even through the usecase might very well be equally good served by --print-uris. Closes: 742578 --- test/integration/test-apt-get-source | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source index 33bd980d0..b27cbbe96 100755 --- a/test/integration/test-apt-get-source +++ b/test/integration/test-apt-get-source @@ -82,3 +82,7 @@ testequal "$HEADER Need to get 0 B of source archives. 'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris -t unstable foo=0.0.1 + +testequal "$HEADER +Need to get 0 B of source archives. +Fetch source foo" aptget source -q -s foo -- cgit v1.2.3 From de81b2e20f80bb5f42034863a9a974c815a45da5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 18 Oct 2014 17:48:55 +0200 Subject: aborted reverify restores file owner and permission If we get an IMS hit for an InRelease file we use the file we already have and pass it into reverification, but this changes the permissions and on abort of the transaction they weren't switched back. This is now done, additionally, every file in partial which hasn't failed gets permission and owner changed for root access as well, as it is very well possible that the next invocation will (re)use these files. --- test/integration/framework | 54 +++++++++++++--------- test/integration/test-apt-update-transactions | 65 +++++++++++++++++++++++---- 2 files changed, 89 insertions(+), 30 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index a8d6bf3d0..d692f62a9 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -23,25 +23,32 @@ if [ "$MSGCOLOR" != 'NO' ]; then CCMD="\033[1;35m" # pink fi -msgdie() { printf "${CERROR}E: $1${CNORMAL}\n" >&2; exit 1; } -msgwarn() { printf "${CWARNING}W: $1${CNORMAL}\n" >&2; } -msgmsg() { printf "${CMSG}$1${CNORMAL}\n"; } -msginfo() { printf "${CINFO}I: $1${CNORMAL}\n"; } -msgdebug() { printf "${CDEBUG}D: $1${CNORMAL}\n"; } -msgdone() { printf "${CDONE}DONE${CNORMAL}\n"; } -msgnwarn() { printf "${CWARNING}W: $1${CNORMAL}" >&2; } -msgnmsg() { printf "${CMSG}$1${CNORMAL}"; } -msgninfo() { printf "${CINFO}I: $1${CNORMAL}"; } -msgndebug() { printf "${CDEBUG}D: $1${CNORMAL}"; } -msgtest() { - while [ -n "$1" ]; do - printf "${CINFO}$1${CCMD} " - printf -- "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} " +msgprintf() { + local START="$1" + local MIDDLE="$2" + local END="$3" + shift 3 + if [ -n "$1" ]; then + printf "$START " "$1" shift - if [ -n "$1" ]; then shift; else break; fi - done - printf "…${CNORMAL} " + while [ -n "$1" ]; do + printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cgfs]\)#apt-\1#')" + shift + done + fi + printf "${END}" } +msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } +msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } +msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } +msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } +msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } +msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } +msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } +msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } +msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } +msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } +msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } msgskip() { if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; @@ -1222,18 +1229,21 @@ testfailure() { fi } -testaccessrights() { - msgtest "Test that file $1 has access rights set to" "$2" - if [ "$2" = "$(stat --format '%a' "$1")" ]; then +testfilestats() { + msgtest "Test that file $1 has $2 $3" "$4" + if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then msgpass else echo >&2 ls -l >&2 "$1" - echo -n >&2 "stat(1) reports access rights: " - stat --format '%a' "$1" + echo -n >&2 "stat(1) reports for $2: " + stat --format "$2" "$1" msgfail fi } +testaccessrights() { + testfilestats "$1" '%a' '=' "$2" +} testwebserverlaststatuscode() { local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log' diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index 247334991..2d5d9e721 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -1,24 +1,73 @@ #!/bin/sh set -e +# ensure that an update will only succeed entirely or not at all + TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' insertpackage 'unstable' 'foo' 'all' '1.0' +insertsource 'unstable' 'foo' 'all' '1.0' setupaptarchive --no-update -changetowebserver -# break package file -cat > aptarchive/dists/unstable/main/binary-i386/Packages < "$1" < listsdir.lst + testrun 'listsdir.lst' + + msgmsg 'Test with initial data over' "$1" + testsuccess aptget update + ls rootdir/var/lib/apt/lists > listsdir.lst + testrun 'listsdir.lst' +} + +testsetup 'file' +changetowebserver +testsetup 'http' -- cgit v1.2.3 From ab25bf1f08ca605d3eb4c05619e8df495ccca30a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 18 Oct 2014 20:00:25 +0200 Subject: autorun permission tests for all apt-get update calls Adds some infrastructure to run tests automatically for certain commands. The first command being 'apt-get update' (and 'apt update') which check for correct permission and owner of the files in lists/. Git-Dch: Ignore --- test/integration/framework | 42 +++++++++++++++++++++++++-- test/integration/test-apt-get-download | 5 ---- test/integration/test-apt-update-ims | 5 ++-- test/integration/test-apt-update-transactions | 5 ---- 4 files changed, 41 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index d692f62a9..8ccbe7f6d 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1081,12 +1081,13 @@ testfileequal() { testempty() { msgtest "Test for no output of" "$*" local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" - if $* >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then + if "$@" >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then msgpass else cat $COMPAREFILE msgfail fi + aptautotest 'testempty' "$@" } testequal() { @@ -1103,7 +1104,8 @@ testequal() { if [ -n "$MSG" ]; then msgtest "$MSG" "$*" fi - $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail + "$@" 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail + aptautotest 'testequal' "$@" } testequalor2() { @@ -1114,7 +1116,7 @@ testequalor2() { echo "$2" > $COMPAREFILE2 shift 2 msgtest "Test for equality OR of" "$*" - $* >$COMPAREAGAINST 2>&1 || true + "$@" >$COMPAREAGAINST 2>&1 || true if checkdiff $COMPAREFILE1 $COMPAREAGAINST >/dev/null 2>&1 || \ checkdiff $COMPAREFILE2 $COMPAREAGAINST >/dev/null 2>&1 then @@ -1126,6 +1128,7 @@ testequalor2() { checkdiff $COMPAREFILE2 $COMPAREAGAINST || true msgfail fi + aptautotest 'testequalor2' "$@" } testshowvirtual() { @@ -1210,6 +1213,7 @@ testsuccess() { cat >&2 $OUTPUT msgfail "exitcode $EXITCODE" fi + aptautotest 'testsuccess' "$@" } testfailure() { @@ -1227,6 +1231,7 @@ testfailure() { else msgpass fi + aptautotest 'testfailure' "$@" } testfilestats() { @@ -1271,3 +1276,34 @@ pause() { local IGNORE read IGNORE } + +### The following tests are run by most test methods automatically to check +### general things about commands executed without writing the test every time. + +aptautotest() { + local TESTCALL="$1" + local CMD="$2" + local FIRSTOPT="$3" + local AUTOTEST="aptautotest_$(basename "$CMD" | tr -d '-')_$(echo "$FIRSTOPT" | tr -d '-')" + if command -v $AUTOTEST >/dev/null; then + shift 3 + # save and restore the *.output files from other tests + # as we might otherwise override them in these automatic tests + rm -rf rootdir/tmp-before + mv rootdir/tmp rootdir/tmp-before + mkdir rootdir/tmp + $AUTOTEST "$TESTCALL" "$@" + rm -rf rootdir/tmp-aptautotest + mv rootdir/tmp rootdir/tmp-aptautotest + mv rootdir/tmp-before rootdir/tmp + fi +} + +aptautotest_aptget_update() { + if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi + # all copied files are properly chmodded + find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f | while read file; do + testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:644" + done +} +aptautotest_apt_update() { aptautotest_aptget_update "$@"; } diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 9a154e5fb..48086d808 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -32,11 +32,6 @@ done testsuccess aptget update -# all copied files are properly chmodded -find rootdir/var/lib/apt/lists -type f | while read file; do - testaccessrights "$file" '644' -done - testdownload() { local APT="$2" if [ -n "$3" ]; then diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index c74058c5d..6746837a4 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -54,7 +54,7 @@ Hit http://localhost:8080 unstable/main amd64 Packages Hit http://localhost:8080 unstable/main Translation-en Reading package lists..." -find aptarchive -name "InRelease" | xargs rm -f +find aptarchive -name 'InRelease' -delete echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex runtest @@ -78,9 +78,8 @@ Hit http://localhost:8080 unstable/main Translation-en Reading package lists... W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated." -find aptarchive -name "Release.gpg" | xargs rm -f +find aptarchive -name 'Release.gpg' -delete -echo 'Acquire::AllowInsecureRepositories "1";' > rootdir/etc/apt/apt.conf.d/insecure.conf echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex runtest diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index 2d5d9e721..2fc5f1dad 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -27,11 +27,6 @@ restorefile() { listscheck() { testequal "$(cat $1)" ls rootdir/var/lib/apt/lists - # all copied files are properly chmodded - find rootdir/var/lib/apt/lists -maxdepth 1 -type f | while read file; do - testaccessrights "$file" '644' - testfilestats "$file" '%U' '!=' '_apt' - done } testrun() { -- cgit v1.2.3 From 846bc058cb0c1bf7ce7c2fb30b9c277e96e9eaf7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 18 Oct 2014 22:46:48 +0200 Subject: check lists/ content in tests doing rollback Git-Dch: Ignore --- test/integration/framework | 9 +++++++++ test/integration/test-apt-update-expected-size | 5 +++-- test/integration/test-apt-update-file | 24 +++++++++++------------- test/integration/test-apt-update-ims | 4 ++-- test/integration/test-apt-update-nofallback | 25 +++++++++++++++++++------ test/integration/test-apt-update-rollback | 10 +++++++++- test/integration/test-apt-update-stale | 17 +++++++---------- test/integration/test-apt-update-transactions | 19 +++++++++---------- test/integration/test-apt-update-unauth | 15 ++++++--------- 9 files changed, 75 insertions(+), 53 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 8ccbe7f6d..d9851a48c 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1277,6 +1277,15 @@ pause() { read IGNORE } +listcurrentlistsdirectory() { + find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do + stat --format '%U:%G:%a:%n' "$line" + done + find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do + stat --format '%U:%G:%a:%s:%y:%n' "$line" + done +} + ### The following tests are run by most test methods automatically to check ### general things about commands executed without writing the test every time. diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index a039e9e1c..b71853406 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -34,8 +34,9 @@ mv aptarchive/dists/unstable/InRelease.good aptarchive/dists/unstable/InRelease # append junk at the end of the Packages.gz/Packages SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" -echo "1234567890" >> aptarchive/dists/unstable/main/binary-i386/Packages.gz -echo "1234567890" >> aptarchive/dists/unstable/main/binary-i386/Packages +find aptarchive -name 'Packages*' | while read pkg; do + echo "1234567890" >> "$pkg" +done NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" rm -f rootdir/var/lib/apt/lists/localhost* testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file index e6332dc3b..1ecf9a38a 100755 --- a/test/integration/test-apt-update-file +++ b/test/integration/test-apt-update-file @@ -10,28 +10,26 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "amd64" -configcompression 'bz2' 'gz' +configcompression 'bz2' 'gz' -insertpackage 'unstable' 'foo' 'all' '1.0' +insertpackage 'unstable' 'foo' 'all' '1' +insertsource 'unstable' 'foo' 'all' '1' setupaptarchive --no-update # ensure the archive is not writable +addtrap 'prefix' 'chmod 750 aptarchive/dists/unstable/main/binary-amd64;' chmod 550 aptarchive/dists/unstable/main/binary-amd64 -testsuccess aptget update -qq -testsuccess aptget update -qq -aptget update -qq -o Debug::pkgAcquire::Auth=1 2> output.log +testsuccess aptget update +testsuccess aptget update -o Debug::pkgAcquire::Auth=1 +cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output -# ensure that the hash of the uncompressed file was verified even on a local -# ims hit +# ensure that the hash of the uncompressed file was verified even on a local ims hit canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" -grep -q -- "- $canary" output.log +testsuccess grep -- "$canary" rootdir/tmp/update.output # foo is still available testsuccess aptget install -s foo - -# the cleanup should still work -chmod 750 aptarchive/dists/unstable/main/binary-amd64 - - +testsuccess aptcache showsrc foo +testsuccess aptget source foo --print-uris diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 6746837a4..eece0c84c 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -8,7 +8,7 @@ configarchitecture 'amd64' buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' -setupaptarchive +setupaptarchive --no-update changetowebserver runtest() { @@ -23,7 +23,7 @@ runtest() { testequal "$EXPECT" aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 # ensure that we still do a hash check on ims hit - msgtest 'Test I-M-S reverify' + msgtest 'Test I-M-S' 'reverify' aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A1 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail # ensure no leftovers in partial diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index 321472c2e..12977129f 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -39,8 +39,9 @@ assert_update_is_refused_and_last_good_state_used() assert_repo_is_intact() { testequal "foo/unstable 2.0 all" apt list -q - testsuccess "" aptget install -y -s foo - testfailure "" aptget install -y evil + testsuccess aptget install -y -s foo + testfailure aptget install -y evil + testsuccess aptget source foo --print-uris LISTDIR=rootdir/var/lib/apt/lists if ! ( ls $LISTDIR/*InRelease >/dev/null 2>&1 || @@ -62,9 +63,11 @@ test_from_inrelease_to_unsigned() # setup archive with InRelease file setupaptarchive_with_lists_clean testsuccess aptget update + listcurrentlistsdirectory > lists.before simulate_mitm_and_inject_evil_package assert_update_is_refused_and_last_good_state_used + testfileequal lists.before "$(listcurrentlistsdirectory)" } test_from_release_gpg_to_unsigned() @@ -73,9 +76,11 @@ test_from_release_gpg_to_unsigned() setupaptarchive_with_lists_clean rm $APTARCHIVE/dists/unstable/InRelease testsuccess aptget update + listcurrentlistsdirectory > lists.before simulate_mitm_and_inject_evil_package assert_update_is_refused_and_last_good_state_used + testfileequal lists.before "$(listcurrentlistsdirectory)" } test_from_inrelease_to_unsigned_with_override() @@ -118,6 +123,7 @@ test_cve_2012_0214() # setup archive with InRelease setupaptarchive_with_lists_clean testsuccess aptget update + listcurrentlistsdirectory > lists.before # do what CVE-2012-0214 did rm $APTARCHIVE/dists/unstable/InRelease @@ -127,6 +133,7 @@ test_cve_2012_0214() aptftparchive -qq release ./aptarchive > aptarchive/dists/unstable/Release assert_update_is_refused_and_last_good_state_used + testfileequal lists.before "$(listcurrentlistsdirectory)" # ensure there is no _Release file downloaded testfailure ls rootdir/var/lib/apt/lists/*_Release @@ -137,6 +144,7 @@ test_subvert_inrelease() # setup archive with InRelease setupaptarchive_with_lists_clean testsuccess aptget update + listcurrentlistsdirectory > lists.before # replace InRelease with something else mv $APTARCHIVE/dists/unstable/Release $APTARCHIVE/dists/unstable/InRelease @@ -146,6 +154,7 @@ test_subvert_inrelease() E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure we keep the repo + testfileequal lists.before "$(listcurrentlistsdirectory)" assert_repo_is_intact } @@ -154,6 +163,7 @@ test_inrelease_to_invalid_inrelease() # setup archive with InRelease setupaptarchive_with_lists_clean testsuccess aptget update + listcurrentlistsdirectory > lists.before # now remove InRelease and subvert Release do no longer verify sed -i 's/Codename.*/Codename: evil!'/ $APTARCHIVE/dists/unstable/InRelease @@ -166,8 +176,9 @@ W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease The following si W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure we keep the repo + testfailure grep 'evil' rootdir/var/lib/apt/lists/*InRelease + testfileequal lists.before "$(listcurrentlistsdirectory)" assert_repo_is_intact - testfailure grep "evil" rootdir/var/lib/apt/lists/*InRelease } test_release_gpg_to_invalid_release_release_gpg() @@ -176,6 +187,7 @@ test_release_gpg_to_invalid_release_release_gpg() setupaptarchive_with_lists_clean rm $APTARCHIVE/dists/unstable/InRelease testsuccess aptget update + listcurrentlistsdirectory > lists.before # now subvert Release do no longer verify echo "Some evil data" >> $APTARCHIVE/dists/unstable/Release @@ -187,8 +199,9 @@ W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + testfailure grep 'evil' rootdir/var/lib/apt/lists/*Release + testfileequal lists.before "$(listcurrentlistsdirectory)" assert_repo_is_intact - testfailure grep "evil" rootdir/var/lib/apt/lists/*Release } @@ -229,6 +242,6 @@ test_inrelease_to_invalid_inrelease msgmsg "test_release_gpg_to_invalid_release_release_gpg" test_release_gpg_to_invalid_release_release_gpg -# ensure we can ovveride the downgrade error -msgmsg "test_from_inrelease_to_unsigned" +# ensure we can override the downgrade error +msgmsg "test_from_inrelease_to_unsigned_with_override" test_from_inrelease_to_unsigned_with_override diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index 220c3052b..d33411da4 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -37,6 +37,7 @@ break_repository_sources_index() { start_with_good_inrelease() { create_fresh_archive testsuccess aptget update + listcurrentlistsdirectory > lists.before testequal "old/unstable 1.0 all" apt list -q } @@ -63,6 +64,7 @@ test_inrelease_to_broken_hash_reverts_all() { E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure that the Packages file is also rolled back + testfileequal lists.before "$(listcurrentlistsdirectory)" testequal "E: Unable to locate package new" aptget install new -s -qq } @@ -78,7 +80,8 @@ test_inrelease_to_valid_release() { # update fails testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq - # test that we can install the new packages but do no longer have a sig + # test that security downgrade was not successful + testfileequal lists.before "$(listcurrentlistsdirectory)" testsuccess aptget install old -s testfailure aptget install new -s testsuccess ls $ROOTDIR/var/lib/apt/lists/*_InRelease @@ -101,6 +104,7 @@ test_inrelease_to_release_reverts_all() { testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 # ensure that the Packages file is also rolled back + testfileequal lists.before "$(listcurrentlistsdirectory)" testsuccess aptget install old -s testfailure aptget install new -s testsuccess ls $ROOTDIR/var/lib/apt/lists/*_InRelease @@ -114,6 +118,7 @@ test_unauthenticated_to_invalid_inrelease() { rm $APTARCHIVE/dists/unstable/Release.gpg testsuccess aptget update --allow-insecure-repositories + listcurrentlistsdirectory > lists.before testequal "WARNING: The following packages cannot be authenticated! old E: There are problems and -y was used without --force-yes" aptget install -qq -y old @@ -126,6 +131,7 @@ E: There are problems and -y was used without --force-yes" aptget install -qq -y E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + testfileequal lists.before "$(listcurrentlistsdirectory)" testfailure ls rootdir/var/lib/apt/lists/*_InRelease testequal "WARNING: The following packages cannot be authenticated! old @@ -144,6 +150,7 @@ W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease The following sign W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + testfileequal lists.before "$(listcurrentlistsdirectory)" testsuccess ls rootdir/var/lib/apt/lists/*_InRelease } @@ -158,6 +165,7 @@ test_inrelease_to_broken_gzip() { rm $APTARCHIVE/dists/unstable/main/source/Sources testfailure aptget update + testfileequal lists.before "$(listcurrentlistsdirectory)" } TESTDIR=$(readlink -f $(dirname $0)) diff --git a/test/integration/test-apt-update-stale b/test/integration/test-apt-update-stale index 780ff79af..52f94591f 100755 --- a/test/integration/test-apt-update-stale +++ b/test/integration/test-apt-update-stale @@ -17,6 +17,7 @@ insertpackage 'unstable' 'foo' 'all' '1.0' setupaptarchive changetowebserver aptget update -qq +listcurrentlistsdirectory > lists.before # insert new version mkdir aptarchive/dists/unstable/main/binary-i386/saved @@ -24,23 +25,19 @@ cp -p aptarchive/dists/unstable/main/binary-i386/Packages* \ aptarchive/dists/unstable/main/binary-i386/saved insertpackage 'unstable' 'foo' 'all' '2.0' -# not using compressfile for compat with older apt releases -gzip -c aptarchive/dists/unstable/main/binary-i386/Packages > \ - aptarchive/dists/unstable/main/binary-i386/Packages.gz -generatereleasefiles -signreleasefiles - +compressfile aptarchive/dists/unstable/main/binary-i386/Packages # ensure that we do not get a I-M-S hit for the Release file -touch -d "+1hour" aptarchive/dists/unstable/*Release* + +generatereleasefiles '+1hour' +signreleasefiles # but now only deliver the previous Packages file instead of the new one # (simulating a stale attack) cp -p aptarchive/dists/unstable/main/binary-i386/saved/Packages* \ aptarchive/dists/unstable/main/binary-i386/ -# ensure this raises a error +# ensure this raises an error testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq - - +testfileequal lists.before "$(listcurrentlistsdirectory)" diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index 2fc5f1dad..fe352c762 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -25,40 +25,39 @@ restorefile() { mv "${1}.bak" "$1" } -listscheck() { - testequal "$(cat $1)" ls rootdir/var/lib/apt/lists -} - testrun() { # produce an unsigned repository find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete testfailure aptget update --no-allow-insecure-repositories - listscheck "$1" + testfileequal "$1" "$(listcurrentlistsdirectory)" # signed but broken signreleasefiles breakfile aptarchive/dists/unstable/main/binary-i386/Packages testfailure aptget update - listscheck "$1" + testfileequal "$1" "$(listcurrentlistsdirectory)" restorefile aptarchive/dists/unstable/main/binary-i386/Packages breakfile aptarchive/dists/unstable/main/source/Sources testfailure aptget update - listscheck "$1" + testfileequal "$1" "$(listcurrentlistsdirectory)" restorefile aptarchive/dists/unstable/main/source/Sources } testsetup() { msgmsg 'Test with no initial data over' "$1" rm -rf rootdir/var/lib/apt/lists - mkdir -p rootdir/var/lib/apt/lists/partial - ls rootdir/var/lib/apt/lists > listsdir.lst + mkdir -m 700 -p rootdir/var/lib/apt/lists/partial + if [ "$(id -u)" = '0' ]; then + chown _apt:root rootdir/var/lib/apt/lists/partial + fi + listcurrentlistsdirectory > listsdir.lst testrun 'listsdir.lst' msgmsg 'Test with initial data over' "$1" testsuccess aptget update - ls rootdir/var/lib/apt/lists > listsdir.lst + listcurrentlistsdirectory > listsdir.lst testrun 'listsdir.lst' } diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth index b7ccd6cf3..1b5dbc6c4 100755 --- a/test/integration/test-apt-update-unauth +++ b/test/integration/test-apt-update-unauth @@ -16,7 +16,7 @@ configarchitecture "i386" insertpackage 'unstable' 'foo' 'all' '1.0' insertsource 'unstable' 'foo' 'all' '1.0' -setupaptarchive +setupaptarchive --no-update changetowebserver # FIXME: @@ -24,13 +24,10 @@ changetowebserver # reverified runtest() { # start unauthenticated - find rootdir/var/lib/apt/lists/ -type f | xargs rm -f - rm -f aptarchive/dists/unstable/*Release* + rm -rf rootdir/var/lib/apt/lists/ + find aptarchive/ -name '*Release*' -delete - testsuccess aptget update -qq --allow-insecure-repositories - - # FIXME: this really shouldn't be needed - rm -f rootdir/var/lib/apt/lists/partial/* + testsuccess aptget update --allow-insecure-repositories # become authenticated generatereleasefiles @@ -45,14 +42,14 @@ runtest() { # change the local packages file PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*) echo "meep" > $PKGS - ls rootdir/var/lib/apt/lists/ > lists.before + listcurrentlistsdirectory > lists.before # update and ensure all is reverted on the hashsum failure testfailure aptget update -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 -o Debug::acquire::http=0 # ensure we have before what we have after msgtest 'Check rollback on going from' 'unauth -> auth' - ls rootdir/var/lib/apt/lists/ > lists.after + listcurrentlistsdirectory > lists.after if cmp lists.before lists.after; then msgpass else -- cgit v1.2.3 From 1df24acfdb8ba1cd8bbbaa166f170dda480ce41e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 19 Oct 2014 14:14:37 +0200 Subject: check for failure message in testsuccess/failure These functions check the exit code of the command, but for apt commands we can go further and require an error message for non-zero exits and none for zero exits. Git-Dch: Ignore --- test/integration/framework | 29 +++++- test/integration/test-apt-cli-update | 2 +- test/integration/test-apt-update-expected-size | 8 +- .../test-bug-673536-pre-depends-breaks-loop | 5 +- .../integration/test-bug-733028-gpg-resource-limit | 6 +- test/integration/test-conflicts-loop | 2 +- test/integration/test-essential-force-loopbreak | 4 +- test/integration/test-releasefile-valid-until | 100 ++++++--------------- 8 files changed, 65 insertions(+), 91 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index d9851a48c..617daa283 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1205,8 +1205,18 @@ testsuccess() { msgtest 'Test for successful execution of' "$*" fi local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" - if $@ >${OUTPUT} 2>&1; then - msgpass + if "$@" >${OUTPUT} 2>&1; then + if expr match "$1" '^apt.*' >/dev/null; then + if grep -q -E '^E: ' "$OUTPUT"; then + echo >&2 + cat >&2 $OUTPUT + msgfail 'successful run, but output contains errors' + else + msgpass + fi + else + msgpass + fi else local EXITCODE=$? echo >&2 @@ -1223,13 +1233,24 @@ testfailure() { msgtest 'Test for failure in execution of' "$*" fi local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" - if $@ >${OUTPUT} 2>&1; then + if "$@" >${OUTPUT} 2>&1; then local EXITCODE=$? echo >&2 cat >&2 $OUTPUT msgfail "exitcode $EXITCODE" else - msgpass + local EXITCODE=$? + if expr match "$1" '^apt.*' >/dev/null; then + if ! grep -q -E '^E: ' "$OUTPUT"; then + echo >&2 + cat >&2 $OUTPUT + msgfail "run failed with exitcode ${EXITCODE}, but with no errors" + else + msgpass + fi + else + msgpass + fi fi aptautotest 'testfailure' "$@" } diff --git a/test/integration/test-apt-cli-update b/test/integration/test-apt-cli-update index 8237bf03f..987bb9adb 100755 --- a/test/integration/test-apt-cli-update +++ b/test/integration/test-apt-cli-update @@ -10,7 +10,7 @@ configarchitecture "i386" insertpackage 'unstable' 'foo' 'all' '2.0' insertinstalledpackage 'foo' 'all' '1.0' -setupaptarchive +setupaptarchive --no-update APTARCHIVE=$(readlink -f ./aptarchive) diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index b71853406..2acf56961 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -15,16 +15,16 @@ changetowebserver # normal update works fine testsuccess aptget update -# make InRelease really big +# make InRelease really big to trigger fallback mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null touch -d '+1hour' aptarchive/dists/unstable/InRelease -aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 > output.log +testsuccess aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 msgtest 'Check that the max write warning is triggered' -if grep -q "Writing more data than expected" output.log; then +if grep -q "Writing more data than expected" rootdir/tmp/testsuccess.output; then msgpass else - cat output.log + cat rootdir/tmp/testsuccess.output msgfail fi # ensure the failed InRelease file got renamed diff --git a/test/integration/test-bug-673536-pre-depends-breaks-loop b/test/integration/test-bug-673536-pre-depends-breaks-loop index 21bd5e065..eb47553dc 100755 --- a/test/integration/test-bug-673536-pre-depends-breaks-loop +++ b/test/integration/test-bug-673536-pre-depends-breaks-loop @@ -24,12 +24,11 @@ testloopbreak() { cp -a dpkg.status.backup rootdir/var/lib/dpkg/status rm -f rootdir/var/lib/apt/extended_states - - testsuccess aptget install advanced=1 -y -t "$1" -o Debug::pkgPackageManager=1 + testsuccess aptget install advanced=1 -y -t "$1" testdpkginstalled advanced testdpkgnotinstalled basic common - testsuccess aptget dist-upgrade -y -t "$1" -o Debug::pkgPackageManager=1 + testsuccess aptget dist-upgrade -y -t "$1" testdpkginstalled advanced basic common } diff --git a/test/integration/test-bug-733028-gpg-resource-limit b/test/integration/test-bug-733028-gpg-resource-limit index f9c804963..7040856b3 100755 --- a/test/integration/test-bug-733028-gpg-resource-limit +++ b/test/integration/test-bug-733028-gpg-resource-limit @@ -17,11 +17,11 @@ done aptkey list | grep '^pub' > aptkey.list testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' +testsuccess aptget update msgtest 'Test for no gpg errors/warnings in' 'apt-get update' -aptget update > update.log 2>&1 -if grep -iq 'GPG' update.log; then +if grep -iq 'GPG' rootdir/tmp/testsuccess.output; then + cat rootdir/tmp/testsuccess.output msgfail - cat update.log else msgpass fi diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop index 0906ef8fa..81731dfe4 100755 --- a/test/integration/test-conflicts-loop +++ b/test/integration/test-conflicts-loop @@ -30,4 +30,4 @@ Conf openjdk-6-jre (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre-headless (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])' aptget dist-upgrade -s -o APT::Immediate-Configure-All=true -testsuccess aptget dist-upgrade -s -o Debug::pkgPackageManager=1 +testsuccess aptget dist-upgrade -s diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak index ac8fc6d28..1493430d8 100755 --- a/test/integration/test-essential-force-loopbreak +++ b/test/integration/test-essential-force-loopbreak @@ -37,13 +37,13 @@ The following packages will be upgraded: E: This installation run will require temporarily removing the essential package sysvinit:$(getarchitecture 'native') due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. E: Internal Error, Could not early remove sysvinit:$(dpkg --print-architecture) (2)" aptget install systemd-sysv -t "$1" -s # ensure that really nothing happens - testfailure aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 + testfailure aptget install systemd-sysv -y -t "$1" testdpkginstalled 'sysvinit' testdpkgnotinstalled 'systemd-sysv' # with enough force however … cp -a dpkg.status.backup rootdir/var/lib/dpkg/status - testsuccess aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1 -o APT::Force-LoopBreak=1 + testsuccess aptget install systemd-sysv -y -t "$1" -o APT::Force-LoopBreak=1 testdpkginstalled 'sysvinit' 'systemd-sysv' } diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until index e673d5f71..0d9a91254 100755 --- a/test/integration/test-releasefile-valid-until +++ b/test/integration/test-releasefile-valid-until @@ -12,84 +12,38 @@ getlabelfromsuite() { echo -n 'Testcases' } +setupaptarchive --no-update -setupaptarchive - -setupreleasefile() { +runtest() { + local MSG="$1" + msgtest "$1" "$2" rm -rf rootdir/var/lib/apt/lists aptget clean - generatereleasefiles "$1" "$2" + generatereleasefiles "$3" "$4" signreleasefiles -} - -aptgetupdate() { - if aptget update $* 2>&1 | grep -q 'is expired'; then - return 1 + shift 4 + if expr match "$MSG" '.*accepted.*' >/dev/null; then + testsuccess --nomsg aptget update "$@" + testfailure grep -q 'is expired' rootdir/tmp/testsuccess.output else - return 0 + testfailure --nomsg aptget update "$@" + testsuccess grep -q 'is expired' rootdir/tmp/testfailure.output fi } -setupreleasefile -msgtest 'Release file is accepted as it has' 'no Until' -testsuccess --nomsg aptgetupdate - -setupreleasefile -msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid' -testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600 - -setupreleasefile 'now - 2 days' -msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600 - -setupreleasefile 'now - 3 days' 'now + 1 day' -msgtest 'Release file is accepted as it has' 'good Until' -testsuccess --nomsg aptgetupdate - -setupreleasefile 'now - 7 days' 'now - 4 days' -msgtest 'Release file is rejected as it has' 'bad Until' -testfailure --nomsg aptgetupdate - -setupreleasefile 'now - 7 days' 'now - 4 days' -msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600 - -setupreleasefile 'now - 7 days' 'now - 4 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 - -setupreleasefile 'now - 7 days' 'now + 4 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 - -setupreleasefile 'now - 7 days' 'now + 4 days' -msgtest 'Release file is accepted as it has' 'good labeled Max-Valid' -testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 - -setupreleasefile 'now - 7 days' 'now + 4 days' -msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 - -setupreleasefile 'now - 7 days' 'now + 1 days' -msgtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' -testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 - -setupreleasefile 'now - 7 days' 'now - 4 days' -msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' -testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 - -setupreleasefile 'now - 7 days' 'now - 2 days' -msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <' -testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 - -setupreleasefile 'now - 7 days' 'now - 2 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 - -setupreleasefile 'now - 7 days' 'now - 2 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <' -testfailure --nomsg aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 - -setupreleasefile 'now - 7 days' 'now - 2 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 +runtest 'Release file is accepted as it has' 'no Until' '' '' +runtest 'Release file is accepted as it has' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600 +runtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600 +runtest 'Release file is accepted as it has' 'good Until' 'now - 3 days' 'now + 1 day' +runtest 'Release file is rejected as it has' 'bad Until' 'now - 7 days' 'now - 4 days' +runtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600 +runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400 +runtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 +runtest 'Release file is accepted as it has' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 +runtest 'Release file is rejected as it has' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 +runtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600 +runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600 +runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 +runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 +runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 +runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 -- cgit v1.2.3 From 4fa34122cbe347d21b3a162ff2fa75dd2e73c3a8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 20 Oct 2014 10:23:41 +0200 Subject: testcases: do not allow warnings in testsuccess Adds a new testwarning which tests for zero exit and the presents of a warning in the output, failing if either is not the case or if an error is found, too. This allows us to change testsuccess to accept only totally successful executions (= without warnings) which should help finding regressions. Git-Dch: Ignore --- test/integration/framework | 34 ++++++++++++++++++++-- test/integration/test-apt-by-hash-update | 4 +-- test/integration/test-apt-get-source-authenticated | 2 +- test/integration/test-apt-update-expected-size | 1 - test/integration/test-apt-update-ims | 15 ++++++---- test/integration/test-apt-update-nofallback | 8 ++--- test/integration/test-apt-update-rollback | 2 +- test/integration/test-apt-update-unauth | 2 +- .../test-bug-596498-trusted-unsigned-repo | 4 +-- ...17690-allow-unauthenticated-makes-all-untrusted | 2 +- test/integration/test-http-pipeline-messup | 2 +- test/integration/test-sourceslist-trusted-options | 12 ++++---- 12 files changed, 60 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 617daa283..9ce300d55 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1205,12 +1205,43 @@ testsuccess() { msgtest 'Test for successful execution of' "$*" fi local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" + if "$@" >${OUTPUT} 2>&1; then + if expr match "$1" '^apt.*' >/dev/null; then + if grep -q -E '^[WE]: ' "$OUTPUT"; then + echo >&2 + cat >&2 $OUTPUT + msgfail 'successful run, but output contains warnings/errors' + else + msgpass + fi + else + msgpass + fi + else + local EXITCODE=$? + echo >&2 + cat >&2 $OUTPUT + msgfail "exitcode $EXITCODE" + fi + aptautotest 'testsuccess' "$@" +} +testwarning() { + if [ "$1" = '--nomsg' ]; then + shift + else + msgtest 'Test for successful execution with warnings of' "$*" + fi + local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" if "$@" >${OUTPUT} 2>&1; then if expr match "$1" '^apt.*' >/dev/null; then if grep -q -E '^E: ' "$OUTPUT"; then echo >&2 cat >&2 $OUTPUT msgfail 'successful run, but output contains errors' + elif ! grep -q -E '^W: ' "$OUTPUT"; then + echo >&2 + cat >&2 $OUTPUT + msgfail 'successful run, but output contains no warnings' else msgpass fi @@ -1223,9 +1254,8 @@ testsuccess() { cat >&2 $OUTPUT msgfail "exitcode $EXITCODE" fi - aptautotest 'testsuccess' "$@" + aptautotest 'testwarning' "$@" } - testfailure() { if [ "$1" = '--nomsg' ]; then shift diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index 6e1ecdaff..d9d0b146f 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -34,7 +34,7 @@ Building dependency tree... E: Unable to locate package foo" aptget install -q -s foo # ensure we can apt-get update by hash -testsuccess aptget update -o APT::Acquire::By-Hash=1 +testsuccess aptget update -o APT::Acquire::By-Hash=1 -o Acquire::Languages=none # ensure it works testequal "Inst foo (1.0 unstable [all]) @@ -45,5 +45,5 @@ MAGIC="Acquire-By-Hash: true" sed -i "s#Suite: unstable#Suite: unstable\n$MAGIC#" aptarchive/dists/unstable/Release signreleasefiles # ... and verify that it fetches by hash now -testsuccess aptget update +testsuccess aptget update -o Acquire::Languages=none diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated index d833ddd85..fedfc8308 100755 --- a/test/integration/test-apt-get-source-authenticated +++ b/test/integration/test-apt-get-source-authenticated @@ -21,7 +21,7 @@ APTARCHIVE=$(readlink -f ./aptarchive) rm -f $APTARCHIVE/dists/unstable/*Release* # update without authenticated InRelease file -testsuccess aptget update --allow-insecure-repositories +testwarning aptget update --allow-insecure-repositories # this all should fail testfailure aptget install -y foo diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 2acf56961..045217a77 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -42,4 +42,3 @@ rm -f rootdir/var/lib/apt/lists/localhost* testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq - diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index eece0c84c..afae99563 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -12,9 +12,15 @@ setupaptarchive --no-update changetowebserver runtest() { + configallowinsecurerepositories "${1:-false}" + rm -f rootdir/var/lib/apt/lists/localhost* - testsuccess aptget update + if [ "$1" = 'true' ]; then + testwarning aptget update + else + testsuccess aptget update + fi # ensure no leftovers in partial testfailure ls "rootdir/var/lib/apt/lists/partial/*" @@ -62,10 +68,7 @@ runtest echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex runtest - # no Release.gpg or InRelease -configallowinsecurerepositories "true" - msgmsg "Release only" EXPECT="Ign http://localhost:8080 unstable InRelease 404 Not Found @@ -81,7 +84,7 @@ W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Pac find aptarchive -name 'Release.gpg' -delete echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex -runtest +runtest "true" echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex -runtest +runtest "true" diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index 12977129f..831fc67eb 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -54,8 +54,7 @@ assert_repo_is_intact() setupaptarchive_with_lists_clean() { setupaptarchive --no-update - rm -f rootdir/var/lib/apt/lists/_* - #rm -rf rootdir/var/lib/apt/lists + rm -rf rootdir/var/lib/apt/lists } test_from_inrelease_to_unsigned() @@ -87,14 +86,15 @@ test_from_inrelease_to_unsigned_with_override() { # setup archive with InRelease file setupaptarchive_with_lists_clean - testsuccess aptget update + # FIXME: is not what the server reported 4104 4106 + testsuccess aptget update #-o Debug::pkgAcquire::Worker=1 # simulate moving to a unsigned but otherwise valid repo simulate_mitm_and_inject_evil_package generatereleasefiles # and ensure we can update to it (with enough force) - testsuccess aptget update --allow-insecure-repositories \ + testwarning aptget update --allow-insecure-repositories \ -o Acquire::AllowDowngradeToInsecureRepositories=1 # but that the individual packages are still considered untrusted testequal "WARNING: The following packages cannot be authenticated! diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index d33411da4..9efc194a0 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -117,7 +117,7 @@ test_unauthenticated_to_invalid_inrelease() { rm $APTARCHIVE/dists/unstable/InRelease rm $APTARCHIVE/dists/unstable/Release.gpg - testsuccess aptget update --allow-insecure-repositories + testwarning aptget update --allow-insecure-repositories listcurrentlistsdirectory > lists.before testequal "WARNING: The following packages cannot be authenticated! old diff --git a/test/integration/test-apt-update-unauth b/test/integration/test-apt-update-unauth index 1b5dbc6c4..7347f7d10 100755 --- a/test/integration/test-apt-update-unauth +++ b/test/integration/test-apt-update-unauth @@ -27,7 +27,7 @@ runtest() { rm -rf rootdir/var/lib/apt/lists/ find aptarchive/ -name '*Release*' -delete - testsuccess aptget update --allow-insecure-repositories + testwarning aptget update --allow-insecure-repositories # become authenticated generatereleasefiles diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo index a08c153f8..1e5e75b0e 100755 --- a/test/integration/test-bug-596498-trusted-unsigned-repo +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -12,7 +12,7 @@ setupaptarchive aptgetupdate() { rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin - testsuccess aptget update --allow-insecure-repositories + ${1:-testwarning} aptget update --allow-insecure-repositories } PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)" @@ -25,7 +25,7 @@ testequal "$PKGTEXT Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE -aptgetupdate +aptgetupdate 'testsuccess' testequal "$PKGTEXT WARNING: The following packages cannot be authenticated! diff --git a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted index 0736bb6dc..164dca070 100755 --- a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted +++ b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted @@ -34,7 +34,7 @@ testrun() { testsuccess aptget download cool --allow-unauthenticated testfileexists 'cool_1.0_i386.deb' else - testsuccess aptget update --allow-insecure-repositories + testwarning aptget update --allow-insecure-repositories testfailure aptget download cool testfilemissing 'cool_1.0_i386.deb' diff --git a/test/integration/test-http-pipeline-messup b/test/integration/test-http-pipeline-messup index 405574e8a..dda8ef7eb 100755 --- a/test/integration/test-http-pipeline-messup +++ b/test/integration/test-http-pipeline-messup @@ -35,7 +35,7 @@ testfailure test -f pkga_1.0_all.deb echo 'Acquire::http::Pipeline-Depth 10;' > rootdir/etc/apt/apt.conf.d/99enable-pipeline # the output is a bit strange: it looks like it has downloaded pkga 4 times -testsuccess aptget download pkga pkgb pkgc pkgd +testwarning aptget download pkga pkgb pkgc pkgd for pkg in 'pkga' 'pkgb' 'pkgc' 'pkgd'; do testsuccess test -f ${pkg}_1.0_all.deb testsuccess cmp incoming/${pkg}_1.0_all.deb ${pkg}_1.0_all.deb diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options index c954f2f4f..28415dd62 100755 --- a/test/integration/test-sourceslist-trusted-options +++ b/test/integration/test-sourceslist-trusted-options @@ -57,14 +57,14 @@ aptgetupdate() { # note that insecure with trusted=yes are allowed # as the trusted=yes indicates that security is provided by # something above the understanding of apt - testsuccess aptget update --no-allow-insecure-repositories + ${1:-testsuccess} aptget update --no-allow-insecure-repositories } insecureaptgetupdate() { rm -rf rootdir/var/lib/apt/lists testfailure aptget update --no-allow-insecure-repositories rm -rf rootdir/var/lib/apt/lists - testsuccess aptget update --allow-insecure-repositories + testwarning aptget update --allow-insecure-repositories } msgmsg 'Test without trusted option and good sources' @@ -103,7 +103,7 @@ everythingsucceeds -t testing msgmsg 'Test with trusted=yes option and good and unsigned sources' cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* -aptgetupdate +aptgetupdate 'testwarning' everythingsucceeds everythingsucceeds -t stable everythingsucceeds -t testing @@ -128,7 +128,7 @@ everythingsucceeds -t testing msgmsg 'Test with trusted=yes option and good and unknown sources' cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* -aptgetupdate +aptgetupdate 'testwarning' everythingsucceeds everythingsucceeds -t stable everythingsucceeds -t testing @@ -154,7 +154,7 @@ everythingsucceeds -t testing msgmsg 'Test with trusted=yes option and good and expired sources' cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* -aptgetupdate +aptgetupdate 'testwarning' everythingsucceeds everythingsucceeds -t stable everythingsucceeds -t testing @@ -181,7 +181,7 @@ everythingfails -t testing msgmsg 'Test with trusted=yes option and unsigned and good sources' cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/* -aptgetupdate +aptgetupdate 'testwarning' everythingsucceeds everythingsucceeds -t stable everythingsucceeds -t testing -- cgit v1.2.3 From 0d303f1764645284b33924c9be8bf29f0a32ca5c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 20 Oct 2014 12:00:46 +0200 Subject: test if TMPDIR is accessible before using Private temporary directories as created by e.g. libpam-tmpdir are nice, but they are also very effective in preventing our priviledge dropping to work as TMPDIR will be set to a directory only root has access to, so working with it as _apt will fail. We circumvent this by extending our check for a usable TMPDIR setting by checking access rights. Closes: 765951 --- test/integration/framework | 4 ++++ test/integration/test-bug-604401-files-are-directories | 2 +- test/libapt/fileutl_test.cc | 10 +++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 9ce300d55..d576712e5 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -176,6 +176,10 @@ addtrap() { } setupenvironment() { + # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) + if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$(stat --format '%a' "$TMPDIR")" != '1777' ]; then + unset TMPDIR + fi TMPWORKINGDIRECTORY=$(mktemp -d) addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " diff --git a/test/integration/test-bug-604401-files-are-directories b/test/integration/test-bug-604401-files-are-directories index e6913edcf..fe0ccc783 100755 --- a/test/integration/test-bug-604401-files-are-directories +++ b/test/integration/test-bug-604401-files-are-directories @@ -57,7 +57,7 @@ echo 'Package: apt Pin: release a=now Pin-Value: 1000' > rootdir/etc/apt/good-link.pref ln -s rootdir/etc/apt/good-link.pref rootdir/etc/apt/preferences -test -n "$(aptcache policy | grep 1000)" && msgfail || msgpass +test -n "$(aptcache policy | grep '1000 ')" && msgfail || msgpass rm rootdir/etc/apt/preferences msgtest "Broken link instead of a file as preferences ignored" diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index cdf7ea479..8d47c5098 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -217,8 +217,16 @@ TEST(FileUtlTest, GetTempDir) setenv("TMPDIR", "/not-there-no-really-not", 1); EXPECT_EQ("/tmp", GetTempDir()); + // here but not accessible for non-roots setenv("TMPDIR", "/usr", 1); - EXPECT_EQ("/usr", GetTempDir()); + EXPECT_EQ("/tmp", GetTempDir()); + + // files are no good for tmpdirs, too + setenv("TMPDIR", "/dev/null", 1); + EXPECT_EQ("/tmp", GetTempDir()); + + setenv("TMPDIR", "/var/tmp", 1); + EXPECT_EQ("/var/tmp", GetTempDir()); unsetenv("TMPDIR"); if (old_tmpdir.empty() == false) -- cgit v1.2.3 From 03aa08472dcd689572a46ce6efdb1dccf6136334 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 23 Oct 2014 01:28:05 +0200 Subject: chown finished partial files earlier partial files are chowned by the Item baseclass to let the methods work with them. Now, this baseclass is also responsible for chowning the files back to root instead of having various deeper levels do this. The consequence is that all overloaded Failed() methods now call the Item::Failed base as their first step. The same is done for Done(). The effect is that even in partial files usually don't belong to _apt anymore, helping sneakernets and reducing possibilities of a bad method modifying files not belonging to them. The change is supported by the framework not only supporting being run as root, but with proper permission management, too, so that privilege dropping can be tested with them. --- test/integration/framework | 30 +++++++++++---------- test/integration/test-apt-cdrom | 2 ++ test/integration/test-apt-get-changelog | 25 ++++++++++------- test/integration/test-apt-get-download | 12 ++++++++- test/integration/test-apt-get-source-authenticated | 7 +++-- test/integration/test-apt-helper | 21 ++++++++------- test/integration/test-apt-update-nofallback | 2 +- ...17690-allow-unauthenticated-makes-all-untrusted | 10 ++++--- test/integration/test-bug-738785-switch-protocol | 12 ++++----- test/integration/test-compressed-indexes | 8 ++++-- test/integration/test-partial-file-support | 31 +++++++++++----------- test/integration/test-sourceslist-trusted-options | 10 +++++-- .../test-ubuntu-bug-1098738-apt-get-source-md5sum | 2 ++ 13 files changed, 104 insertions(+), 68 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index d576712e5..23ff0983b 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -32,7 +32,7 @@ msgprintf() { printf "$START " "$1" shift while [ -n "$1" ]; do - printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cgfs]\)#apt-\1#')" + printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghs]\)#apt-\1#')" shift done fi @@ -57,9 +57,9 @@ msgskip() { msgfail() { if [ $# -gt 0 ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi - if [ -n "$APT_DEBUG_TESTS" ]; then - bash - fi + if [ -n "$APT_DEBUG_TESTS" ]; then + $SHELL + fi EXIT_CODE=$((EXIT_CODE+1)); } @@ -184,10 +184,12 @@ setupenvironment() { addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " + mkdir -m 700 "${TMPWORKINGDIRECTORY}/downloaded" if [ "$(id -u)" = '0' ]; then # relax permissions so that running as root with user switching works umask 022 - chmod o+rx "$TMPWORKINGDIRECTORY" + chmod 711 "$TMPWORKINGDIRECTORY" + chown _apt:root "${TMPWORKINGDIRECTORY}/downloaded" fi TESTDIRECTORY=$(readlink -f $(dirname $0)) @@ -1061,7 +1063,7 @@ downloadfile() { } checkdiff() { - local DIFFTEXT="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" + local DIFFTEXT="$(command diff -u "$@" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" if [ -n "$DIFFTEXT" ]; then echo >&2 echo >&2 "$DIFFTEXT" @@ -1307,7 +1309,7 @@ testaccessrights() { testwebserverlaststatuscode() { local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log' - local STATUS='rootdir/tmp/webserverstatus-statusfile.log' + local STATUS='downloaded/webserverstatus-statusfile.log' rm -f "$DOWNLOG" "$STATUS" msgtest 'Test last status code from the webserver was' "$1" downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" @@ -1353,20 +1355,20 @@ aptautotest() { shift 3 # save and restore the *.output files from other tests # as we might otherwise override them in these automatic tests - rm -rf rootdir/tmp-before - mv rootdir/tmp rootdir/tmp-before - mkdir rootdir/tmp + rm -rf ${TMPWORKINGDIRECTORY}/rootdir/tmp-before + mv ${TMPWORKINGDIRECTORY}/rootdir/tmp ${TMPWORKINGDIRECTORY}/rootdir/tmp-before + mkdir ${TMPWORKINGDIRECTORY}/rootdir/tmp $AUTOTEST "$TESTCALL" "$@" - rm -rf rootdir/tmp-aptautotest - mv rootdir/tmp rootdir/tmp-aptautotest - mv rootdir/tmp-before rootdir/tmp + rm -rf ${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest + mv ${TMPWORKINGDIRECTORY}/rootdir/tmp ${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest + mv ${TMPWORKINGDIRECTORY}/rootdir/tmp-before ${TMPWORKINGDIRECTORY}/rootdir/tmp fi } aptautotest_aptget_update() { if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi # all copied files are properly chmodded - find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f | while read file; do + for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f); do testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:644" done } diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 2220a290c..4489143e4 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -99,6 +99,7 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s testsuccess aptget purge testing:i386 -y testdpkgnotinstalled testing:i386 + cd downloaded rm -f testing_0.8.15_amd64.deb testsuccess aptget download testing testsuccess test -s testing_0.8.15_amd64.deb @@ -108,6 +109,7 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s testsuccess aptget source testing --dsc-only -d testsuccess test -s testing_0.8.15.dsc rm -f testing_0.8.15.dsc + cd - >/dev/null } testcdromusage diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 76a32a122..648dccf40 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -21,23 +21,28 @@ chmod -R -w rootdir/var/cache/apt/archives echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf -testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris +testequal "'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt --print-uris -testequal "'http://localhost:8080//pool/apt_1.0/changelog' -'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris +testequal "'http://localhost:8080/pool/apt_1.0/changelog' +'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris + +cd downloaded testsuccess aptget changelog apt -qq -testfileequal 'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/apt_1.0/changelog)" +testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/apt_1.0/changelog)" testsuccess aptget changelog apt -d -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" -rm -f apt.changelog aptarchive/pool/apt_1.0/changelog +testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0/changelog)" +testfilestats 'apt.changelog' '%U:%G:%a' '=' "${USER}:${USER}:644" +rm -f apt.changelog ../aptarchive/pool/apt_1.0/changelog -testequal "$(cat aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ +testequal "$(cat ../aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' testsuccess aptget changelog apt -d -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" -rm -f apt.changelog aptarchive/pool/apt_1.0.changelog +testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0.changelog)" +testfilestats 'apt.changelog' '%U:%G:%a' '=' "${USER}:${USER}:644" +rm -f apt.changelog ../aptarchive/pool/apt_1.0.changelog -testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' +testequal 'E: changelog download failed' aptget changelog apt -qq -d -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' +testfailure test -e apt.changelog diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 48086d808..6503bbd1c 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -44,7 +44,10 @@ testdownload() { } # normal case as "root" +OLDPWD="$(pwd)" +cd downloaded testdownload apt_2.0_all.deb apt +cd "$OLDPWD" # simulate normal user with non-existent root-owned directories rm -rf rootdir/var/cache/apt/archives/ @@ -52,14 +55,18 @@ mkdir rootdir/var/cache/apt/archives/ addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;" chmod -R -w rootdir/var/cache/apt/archives +OLDPWD="$(pwd)" +cd downloaded + # normal case(es) testdownload apt_1.0_all.deb apt stable testdownload apt_2.0_all.deb apt -DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb" +DEBFILE="$(readlink -f ../aptarchive)/pool/apt_2.0_all.deb" testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris # deb:677887 +testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms --print-uris testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms # deb:736962 @@ -74,6 +81,7 @@ testsuccess aptget download apt apt apt/unstable apt=2.0 testsuccess test -s apt_2.0_all.deb # restore "root" rights +cd "$OLDPWD" chmod -f -R +w $PWD/rootdir/var/cache/apt/archives rm -rf rootdir/var/cache/apt/archives/ @@ -86,5 +94,7 @@ testsuccess aptget install -d apt testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb testaccessrights 'aptarchive/pool/apt_2.0_all.deb' '644' mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone +cd downloaded testdownload apt_2.0_all.deb apt +cd "$OLDPWD" mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated index fedfc8308..f68c32386 100755 --- a/test/integration/test-apt-get-source-authenticated +++ b/test/integration/test-apt-get-source-authenticated @@ -25,7 +25,10 @@ testwarning aptget update --allow-insecure-repositories # this all should fail testfailure aptget install -y foo +cd downloaded testfailure aptget source foo - +testfailure test -e foo_2.0.dsc # allow overriding the warning -testsuccess aptget source --allow-unauthenticated foo +testsuccess aptget source --allow-unauthenticated foo -o Debug::pkgAcquire::Worker=1 +testsuccess test -s foo_2.0.dsc -a -L foo_2.0.dsc +testaccessrights 'foo_2.0.dsc' '777' diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index 42c40bb9e..06e497ff7 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -13,23 +13,23 @@ test_apt_helper_download() { echo 'foo' > aptarchive/foo msgtest 'apt-file download-file' 'md5sum' - apthelper -qq download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail - testfileequal foo2 'foo' + apthelper -qq download-file http://localhost:8080/foo downloaded/foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail + testfileequal downloaded/foo2 'foo' msgtest 'apt-file download-file' 'sha1' - apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail - testfileequal foo1 'foo' + apthelper -qq download-file http://localhost:8080/foo downloaded/foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail + testfileequal downloaded/foo1 'foo' msgtest 'apt-file download-file' 'sha256' - apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail - testfileequal foo3 'foo' + apthelper -qq download-file http://localhost:8080/foo downloaded/foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail + testfileequal downloaded/foo3 'foo' msgtest 'apt-file download-file' 'no-hash' - apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail - testfileequal foo4 'foo' + apthelper -qq download-file http://localhost:8080/foo downloaded/foo4 && msgpass || msgfail + testfileequal downloaded/foo4 'foo' msgtest 'apt-file download-file' 'wrong hash' - if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then + if ! apthelper -qq download-file http://localhost:8080/foo downloaded/foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then msgpass else msgfail @@ -37,7 +37,8 @@ test_apt_helper_download() { testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch E: Download Failed' - testfileequal foo5.FAILED 'foo' + testfileequal downloaded/foo5.FAILED 'foo' + testfailure test -e downloaded/foo5 } test_apt_helper_detect_proxy() { diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index 831fc67eb..e82a976a6 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -195,7 +195,7 @@ test_release_gpg_to_invalid_release_release_gpg() testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release.gpg: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) -W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg +W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq diff --git a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted index 164dca070..582e1bf5e 100755 --- a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted +++ b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted @@ -24,6 +24,7 @@ testfilemissing() { testrun() { rm -rf rootdir/var/lib/apt + cd downloaded if [ "$1" = 'trusted' ]; then testsuccess aptget update @@ -43,18 +44,19 @@ testrun() { testfileexists 'cool_1.0_i386.deb' fi - mv aptarchive/pool/cool_1.0_i386.deb aptarchive/pool/cool_1.0_i386.deb.bak - echo 'this is not a good package' > aptarchive/pool/cool_1.0_i386.deb + mv ../aptarchive/pool/cool_1.0_i386.deb ../aptarchive/pool/cool_1.0_i386.deb.bak + echo 'this is not a good package' > ../aptarchive/pool/cool_1.0_i386.deb testfailure aptget download cool testfilemissing cool_1.0_i386.deb testfailure aptget download cool --allow-unauthenticated # unauthenticated doesn't mean unchecked testfilemissing cool_1.0_i386.deb - rm -f aptarchive/pool/cool_1.0_i386.deb - mv aptarchive/pool/cool_1.0_i386.deb.bak aptarchive/pool/cool_1.0_i386.deb + rm -f ../aptarchive/pool/cool_1.0_i386.deb + mv ../aptarchive/pool/cool_1.0_i386.deb.bak ../aptarchive/pool/cool_1.0_i386.deb testsuccess aptget download cool --allow-unauthenticated testfileexists 'cool_1.0_i386.deb' + cd - >/dev/null } testrun 'trusted' diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index f450e5e5a..e50c84dbf 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -25,6 +25,7 @@ downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog >/dev/null echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris +cd downloaded testsuccess aptget changelog apt -d testsuccess test -s apt.changelog rm -f apt.changelog @@ -32,6 +33,7 @@ rm -f apt.changelog testsuccess aptget download apt testsuccess test -s apt_1.0_all.deb rm apt_1.0_all.deb +cd - >/dev/null testsuccess aptget install apt -y testdpkginstalled 'apt' @@ -49,15 +51,11 @@ rm https cd - >/dev/null echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf -if [ "$(id -u)" = '0' ]; then - testequal "Can't drop privileges for downloading as file '$(pwd)/apt_1.0_all.deb' couldn't be accessed by user '_apt'. -E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. -N: Is the package apt-transport-https installed?" aptget download apt -q=0 -else - testequal "E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. +cd downloaded +testequal "E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed?" aptget download apt -q=0 -fi testsuccess test ! -e apt_1.0_all.deb +cd - >/dev/null # revert to all methods rm -rf rootdir/$COPYMETHODS diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 72b262e84..92e7c0e84 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -58,9 +58,11 @@ testrun() { msgpass fi msgtest 'Check if package is downloadable' + cd downloaded testsuccess --nomsg aptget download testpkg msgtest '\tdeb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb rm testpkg_1.0_i386.deb + cd - >/dev/null testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -79,10 +81,12 @@ Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s testequal "$GOODSHOWSRC" aptcache showsrc testpkg aptget clean msgtest 'Check if the source is aptgetable' + cd downloaded testsuccess --nomsg aptget source testpkg - msgtest '\tdsc file is present'; testsuccess --nomsg test -f testpkg_1.0.dsc - msgtest '\tdirectory is present'; testsuccess --nomsg test -d testpkg-1.0 + testsuccess test -s testpkg_1.0.dsc + testsuccess test -d testpkg-1.0 rm -rf testpkg-1.0* + cd - >/dev/null testequal "$(aptcache show testpkg -o Acquire::Languages=none) " aptcache dumpavail } diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support index 5ab326def..98b2f242a 100755 --- a/test/integration/test-partial-file-support +++ b/test/integration/test-partial-file-support @@ -52,36 +52,37 @@ cp -a ${TESTDIR}/framework $TESTFILE testrun() { webserverconfig 'aptwebserver::support::range' 'true' + local DOWN='./downloaded/testfile' - copysource $TESTFILE 0 ./testfile - testdownloadfile 'no data' "${1}/testfile" './testfile' '=' + copysource $TESTFILE 0 $DOWN + testdownloadfile 'no data' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '200' "$DOWNLOADLOG" - copysource $TESTFILE 20 ./testfile - testdownloadfile 'valid partial data' "${1}/testfile" './testfile' '=' + copysource $TESTFILE 20 $DOWN + testdownloadfile 'valid partial data' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '206' "$DOWNLOADLOG" - copysource /dev/zero 20 ./testfile - testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!=' + copysource /dev/zero 20 $DOWN + testdownloadfile 'invalid partial data' "${1}/testfile" "$DOWN" '!=' testwebserverlaststatuscode '206' "$DOWNLOADLOG" - copysource $TESTFILE 1M ./testfile - testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '=' + copysource $TESTFILE 1M $DOWN + testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '416' "$DOWNLOADLOG" - copysource /dev/zero 1M ./testfile - testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '=' + copysource /dev/zero 1M $DOWN + testdownloadfile 'too-big partial file' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '200' "$DOWNLOADLOG" - copysource /dev/zero 20 ./testfile - touch ./testfile - testdownloadfile 'old data' "${1}/testfile" './testfile' '=' + copysource /dev/zero 20 $DOWN + touch $DOWN + testdownloadfile 'old data' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '200' "$DOWNLOADLOG" webserverconfig 'aptwebserver::support::range' 'false' - copysource $TESTFILE 20 ./testfile - testdownloadfile 'no server support' "${1}/testfile" './testfile' '=' + copysource $TESTFILE 20 $DOWN + testdownloadfile 'no server support' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '200' "$DOWNLOADLOG" } diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options index 28415dd62..55d4e0233 100755 --- a/test/integration/test-sourceslist-trusted-options +++ b/test/integration/test-sourceslist-trusted-options @@ -20,6 +20,7 @@ foo/testing 2 amd64 foo/stable 1 amd64 ' apt list foo -a + cd downloaded rm -f foo_1_amd64.deb foo_2_amd64.deb testsuccess aptget download foo "$@" testsuccess test -s foo_1_amd64.deb -o -s foo_2_amd64.deb @@ -27,6 +28,7 @@ foo/stable 1 amd64 rm -f foo_1.dsc foo_2.dsc testsuccess aptget source foo --dsc-only -d "$@" testsuccess test -s foo_1.dsc -o -s foo_2.dsc + cd - >/dev/null } everythingfails() { @@ -39,18 +41,22 @@ foo/stable 1 amd64 foo E: Some packages could not be authenticated' + cd downloaded rm -f foo_1_amd64.deb foo_2_amd64.deb testfailure aptget download foo "$@" - testequal "$WARNING" tail -n 3 rootdir/tmp/testfailure.output + testequal "$WARNING" tail -n 3 ../rootdir/tmp/testfailure.output testfailure test -s foo_1_amd64.deb -o -s foo_2_amd64.deb rm -f foo_1.dsc foo_2.dsc testfailure aptget source foo --dsc-only -d "$@" - testequal "$WARNING" tail -n 3 rootdir/tmp/testfailure.output + testequal "$WARNING" tail -n 3 ../rootdir/tmp/testfailure.output testfailure test -s foo_1.dsc -o -s foo_2.dsc + cd - >/dev/null } cp -a rootdir/etc/apt/sources.list.d/ rootdir/etc/apt/sources.list.d.bak/ +echo 'Debug::Acquire::Transaction "true"; +Debug::pkgAcquire::Worker "true";' > rootdir/etc/apt/apt.conf.d/00debugging aptgetupdate() { rm -rf rootdir/var/lib/apt/lists diff --git a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum index 8c9c9c767..574183b0a 100755 --- a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum +++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum @@ -141,6 +141,8 @@ setupaptarchive changetowebserver testsuccess aptget update +cd downloaded + testok() { rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz testequal "Reading package lists... -- cgit v1.2.3 From b0314abb0cbe5937d2d3cdcd6df9d322b69d03a0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 23 Oct 2014 10:42:18 +0200 Subject: add test for Basic Authentication scheme Git-Dch: Ignore --- test/integration/framework | 31 ++++++--- test/integration/test-apt-cdrom | 7 +- test/integration/test-authentication-basic | 106 +++++++++++++++++++++++++++++ test/interactive-helper/aptwebserver.cc | 75 ++++++++++++++++++-- test/libapt/strutil_test.cc | 16 ++++- 5 files changed, 219 insertions(+), 16 deletions(-) create mode 100755 test/integration/test-authentication-basic (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 23ff0983b..fcaa4ddd3 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -944,23 +944,35 @@ signreleasefiles() { } webserverconfig() { - msgtest "Set webserver config option '${1}' to" "$2" + local NOCHECK=false + if [ "$1" = '--no-check' ]; then + NOCHECK=true + shift + fi local DOWNLOG='rootdir/tmp/download-testfile.log' - local STATUS='rootdir/tmp/webserverconfig.status' + local STATUS='downloaded/webserverconfig.status' rm -f "$STATUS" "$DOWNLOG" - if downloadfile "http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then + local URI + if [ -n "$2" ]; then + msgtest "Set webserver config option '${1}' to" "$2" + URI="http://localhost:8080/_config/set/${1}/${2}" + else + msgtest 'Clear webserver config option' "${1}" + URI="http://localhost:8080/_config/clear/${1}" + fi + if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then msgpass else - cat "$DOWNLOG" "$STATUS" + cat "$DOWNLOG" "$STATUS" || true msgfail fi - testwebserverlaststatuscode '200' + $NOCHECK || testwebserverlaststatuscode '200' } rewritesourceslist() { local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")" for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do - sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#" + sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#https://localhost:4433/#${1}#" done } @@ -1047,7 +1059,7 @@ acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom mv "${CD}" "${CD}-unmounted" # we don't want the disk to be modifiable addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;" - chmod -R -w rootdir/media/cdrom-unmounted/dists + chmod -R 555 rootdir/media/cdrom-unmounted/dists } downloadfile() { @@ -1055,7 +1067,7 @@ downloadfile() { apthelper -o Debug::Acquire::${PROTO}=1 \ download-file "$1" "$2" 2>&1 || true # only if the file exists the download was successful - if [ -e "$2" ]; then + if [ -r "$2" ]; then return 0 else return 1 @@ -1312,8 +1324,7 @@ testwebserverlaststatuscode() { local STATUS='downloaded/webserverstatus-statusfile.log' rm -f "$DOWNLOG" "$STATUS" msgtest 'Test last status code from the webserver was' "$1" - downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" - if [ "$(cat "$STATUS")" = "$1" ]; then + if downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then msgpass else echo >&2 diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 4489143e4..3a33219fe 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -21,7 +21,7 @@ echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable ' >> Translation-de compressfile Translation-de rm -f Translation-en Translation-de -chmod -R -w . +chmod -R 555 . cd - > /dev/null aptcdromlog() { @@ -144,3 +144,8 @@ testcdromusage testsuccess aptget update testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' testcdromusage + +msgmsg 'Check that nothing touched our' 'CD-ROM' +for file in $(find rootdir/media/cdrom-unmounted/dists); do + testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:555" +done diff --git a/test/integration/test-authentication-basic b/test/integration/test-authentication-basic new file mode 100755 index 000000000..4b0ead54a --- /dev/null +++ b/test/integration/test-authentication-basic @@ -0,0 +1,106 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'i386' + +insertpackage 'unstable' 'foo' 'all' '1' +setupaptarchive --no-update + +changetohttpswebserver --authorization="$(printf '%s' 'star:hunter2' | base64 )" + +echo 'See, when YOU type hunter2, it shows to us as *******' > aptarchive/bash + +testauthfailure() { + testfailure apthelper download-file "${1}/bash" ./downloaded/bash + # crappy test, but http and https output are wastely different… + testsuccess grep 401 rootdir/tmp/testfailure.output + testsuccess test ! -s ./downloaded/bash +} + +testauthsuccess() { + testsuccess apthelper download-file "${1}/bash" ./downloaded/bash + testfileequal ./downloaded/bash "$(cat aptarchive/bash)" + testfilestats ./downloaded/bash '%U:%G:%a' '=' "${USER}:${USER}:644" + rm -f ./downloaded/bash + + # lets see if got/retains acceptable permissions + if [ -n "$AUTHCONF" ]; then + if [ "$(id -u)" = '0' ]; then + testfilestats "$AUTHCONF" '%U:%G:%a' '=' "_apt:root:600" + else + testfilestats "$AUTHCONF" '%U:%G:%a' '=' "${USER}:${USER}:600" + fi + fi + + rm -rf rootdir/var/lib/apt/lists + testsuccess aptget update + testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1 unstable [all]) +Conf foo (1 unstable [all])' aptget install foo -s +} + +authfile() { + local AUTHCONF='rootdir/etc/apt/auth.conf' + rm -f "$AUTHCONF" + printf '%s' "$1" > "$AUTHCONF" + chmod 600 "$AUTHCONF" +} + +runtest() { + # unauthorized fails + authfile '' + testauthfailure "$1" + + # good auth + authfile 'machine localhost +login star +password hunter2' + testauthsuccess "$1" + + # bad auth + authfile 'machine localhost +login anonymous +password hunter2' + testauthfailure "$1" + + # 2 stanzas: unmatching + good auth + authfile 'machine debian.org +login debian +password jessie + +machine localhost +login star +password hunter2' + testauthsuccess "$1" +} + +msgmsg 'server basic auth' +rewritesourceslist 'http://localhost:8080' +runtest 'http://localhost:8080' +rewritesourceslist 'https://localhost:4433' +runtest 'https://localhost:4433' +rewritesourceslist 'http://localhost:8080' + +msgmsg 'proxy to server basic auth' +webserverconfig 'aptwebserver::request::absolute' 'uri' +export http_proxy='http://localhost:8080' +runtest 'http://localhost:8080' +unset http_proxy + +msgmsg 'proxy basic auth to server basic auth' +webserverconfig 'aptwebserver::proxy-authorization' "$(printf 'moon:deer2' | base64)" +export http_proxy='http://moon:deer2@localhost:8080' +runtest 'http://localhost:8080' + +msgmsg 'proxy basic auth to server' +authfile '' +webserverconfig 'aptwebserver::authorization' '' +testauthsuccess 'http://localhost:8080' diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 34476e1af..7474cf148 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -157,9 +157,8 @@ static bool sendData(int const client, std::string const &data) /*{{{*/ } /*}}}*/ static void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ - bool content, std::string const &error = "") + bool content, std::string const &error = "", std::list headers = std::list()) { - std::list headers; std::string response(""); response.append(httpcodeToStr(httpcode)).append(""); response.append("

").append(httpcodeToStr(httpcode)).append("

"); @@ -367,22 +366,88 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ // Proxies require absolute uris, so this is a simple proxy-fake option std::string const absolute = _config->Find("aptwebserver::request::absolute", "uri,path"); - if (strncmp(host.c_str(), filename.c_str(), host.length()) == 0) + if (strncmp(host.c_str(), filename.c_str(), host.length()) == 0 && APT::String::Startswith(filename, "/_config/") == false) { if (absolute.find("uri") == std::string::npos) { sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that"); return false; } + // strip the host from the request to make it an absolute path filename.erase(0, host.length()); + + std::string const authConf = _config->Find("aptwebserver::proxy-authorization", ""); + std::string auth = LookupTag(request, "Proxy-Authorization", ""); + if (authConf.empty() != auth.empty()) + { + if (auth.empty()) + sendError(client, 407, request, sendContent, "Proxy requires authentication"); + else + sendError(client, 407, request, sendContent, "Client wants to authenticate to proxy, but proxy doesn't need it"); + return false; + } + if (authConf.empty() == false) + { + char const * const basic = "Basic "; + if (strncmp(auth.c_str(), basic, strlen(basic)) == 0) + { + auth.erase(0, strlen(basic)); + if (auth != authConf) + { + sendError(client, 407, request, sendContent, "Proxy-Authentication doesn't match"); + return false; + } + } + else + { + std::list headers; + headers.push_back("Proxy-Authenticate: Basic"); + sendError(client, 407, request, sendContent, "Unsupported Proxy-Authentication Scheme", headers); + return false; + } + } } - else if (absolute.find("path") == std::string::npos) + else if (absolute.find("path") == std::string::npos && APT::String::Startswith(filename, "/_config/") == false) { sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that"); return false; } + if (APT::String::Startswith(filename, "/_config/") == false) + { + std::string const authConf = _config->Find("aptwebserver::authorization", ""); + std::string auth = LookupTag(request, "Authorization", ""); + if (authConf.empty() != auth.empty()) + { + if (auth.empty()) + sendError(client, 401, request, sendContent, "Server requires authentication"); + else + sendError(client, 401, request, sendContent, "Client wants to authenticate to server, but server doesn't need it"); + return false; + } + if (authConf.empty() == false) + { + char const * const basic = "Basic "; + if (strncmp(auth.c_str(), basic, strlen(basic)) == 0) + { + auth.erase(0, strlen(basic)); + if (auth != authConf) + { + sendError(client, 401, request, sendContent, "Authentication doesn't match"); + return false; + } + } + else + { + std::list headers; + headers.push_back("WWW-Authenticate: Basic"); + sendError(client, 401, request, sendContent, "Unsupported Authentication Scheme", headers); + return false; + } + } + } + size_t paramspos = filename.find('?'); if (paramspos != std::string::npos) { @@ -656,6 +721,8 @@ int main(int const argc, const char * argv[]) CommandLine::Args Args[] = { {0, "port", "aptwebserver::port", CommandLine::HasArg}, {0, "request-absolute", "aptwebserver::request::absolute", CommandLine::HasArg}, + {0, "authorization", "aptwebserver::authorization", CommandLine::HasArg}, + {0, "proxy-authorization", "aptwebserver::proxy-authorization", CommandLine::HasArg}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, {0,0,0,0} diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index 8dd9114ec..494159c87 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -85,7 +85,7 @@ TEST(StrUtilTest,EndsWith) EXPECT_FALSE(Endswith("abcd", "x")); EXPECT_FALSE(Endswith("abcd", "abcndefg")); } -TEST(StrUtilTest,StartWith) +TEST(StrUtilTest,StartsWith) { using APT::String::Startswith; EXPECT_TRUE(Startswith("abcd", "a")); @@ -129,3 +129,17 @@ TEST(StrUtilTest,SubstVar) EXPECT_EQ(" bb a bb a bb a bb ", SubstVar(" aaa a aaa a aaa a aaa ", "aaa", "bb")); } +TEST(StrUtilTest,Base64Encode) +{ + EXPECT_EQ("QWxhZGRpbjpvcGVuIHNlc2FtZQ==", Base64Encode("Aladdin:open sesame")); + EXPECT_EQ("cGxlYXN1cmUu", Base64Encode("pleasure.")); + EXPECT_EQ("bGVhc3VyZS4=", Base64Encode("leasure.")); + EXPECT_EQ("ZWFzdXJlLg==", Base64Encode("easure.")); + EXPECT_EQ("YXN1cmUu", Base64Encode("asure.")); + EXPECT_EQ("c3VyZS4=", Base64Encode("sure.")); + EXPECT_EQ("dXJlLg==", Base64Encode("ure.")); + EXPECT_EQ("cmUu", Base64Encode("re.")); + EXPECT_EQ("ZS4=", Base64Encode("e.")); + EXPECT_EQ("Lg==", Base64Encode(".")); + EXPECT_EQ("", Base64Encode("")); +} -- cgit v1.2.3 From 0e0d9919cc1749e5343b2076084d77122db1820d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 23 Oct 2014 11:29:31 +0200 Subject: switch tests to Translation-en usage We can use either and some tests exercise this, but the default should be what we want to use and that is a split out long description file which is properly mentioned in the Release file. Git-Dch: Ignore --- test/integration/framework | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index fcaa4ddd3..ea3903056 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -683,8 +683,7 @@ insertpackage() { fi for BUILDARCH in $ARCHS; do local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" - mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source - touch aptarchive/dists/${RELEASE}/main/source/Sources + mkdir -p $PPATH local FILE="${PPATH}/Packages" echo "Package: $NAME Priority: $PRIORITY @@ -695,10 +694,17 @@ Maintainer: Joe Sixpack " >> $FILE echo "Version: $VERSION Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE - echo "Description: $DESCRIPTION" >> $FILE + echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" >> $FILE + echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" >> $FILE echo >> $FILE done done + mkdir -p aptarchive/dists/${RELEASE}/main/source aptarchive/dists/${RELEASE}/main/i18n + touch aptarchive/dists/${RELEASE}/main/source/Sources + echo "Package: $NAME +Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) +Description-en: $DESCRIPTION +" >> aptarchive/dists/${RELEASE}/main/i18n/Translation-en } insertsource() { @@ -773,7 +779,7 @@ buildaptarchivefromincoming() { buildaptarchivefromfiles() { msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…" - find aptarchive -name 'Packages' -o -name 'Sources' | while read line; do + find aptarchive -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do msgninfo "\t${line} file… " compressfile "$line" "$1" msgdone "info" -- cgit v1.2.3 From 10e100e59a96ea7b6834a139beab5d9d70180633 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 23 Oct 2014 11:37:49 +0200 Subject: tests: support 'installed' release in insertpackage It is sometimes handy to have an installed package also in the archive, but this was until now harder than it should as you had to duplicate the lines, which is especially dangerous while writing the tests as it easily happens that these two lines divert and so the same-but-different version detection kicks in. Git-Dch: Ignore --- test/integration/framework | 50 ++++++++++++---------- test/integration/test-apt-get-upgrade | 13 ++---- .../test-bug-745036-new-foreign-invalidates-cache | 6 +-- test/integration/test-bug-753297-upgradable | 3 +- ...prevent-markinstall-multiarch-same-versionscrew | 9 ++-- .../test-suggest-installed-multiarch-silbing | 3 +- 6 files changed, 39 insertions(+), 45 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index ea3903056..190d4d665 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -664,47 +664,53 @@ buildaptftparchivedirectorystructure() { } insertpackage() { - local RELEASE="$1" + local RELEASES="$1" local NAME="$2" local ARCH="$3" local VERSION="$4" local DEPENDENCIES="$5" local PRIORITY="${6:-optional}" - local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} If you find such a package installed on your system, something went horribly wrong! They are autogenerated und used only by testcases and surf no other propose…"}" local ARCHS="" - for arch in $(getarchitecturesfromcommalist "$ARCH"); do - if [ "$arch" = 'all' -o "$arch" = 'none' ]; then - ARCHS="$(getarchitectures)" - else - ARCHS="$arch" + for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do + if [ "$RELEASE" = 'installed' ]; then + insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" + continue fi - for BUILDARCH in $ARCHS; do - local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" - mkdir -p $PPATH - local FILE="${PPATH}/Packages" - echo "Package: $NAME + for arch in $(getarchitecturesfromcommalist "$ARCH"); do + if [ "$arch" = 'all' -o "$arch" = 'none' ]; then + ARCHS="$(getarchitectures)" + else + ARCHS="$arch" + fi + for BUILDARCH in $ARCHS; do + local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" + mkdir -p $PPATH + local FILE="${PPATH}/Packages" + echo "Package: $NAME Priority: $PRIORITY Section: other Installed-Size: 42 Maintainer: Joe Sixpack " >> $FILE - test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE - echo "Version: $VERSION + test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE + echo "Version: $VERSION Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE - test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE - echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" >> $FILE - echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" >> $FILE - echo >> $FILE + test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE + echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" >> $FILE + echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" >> $FILE + echo >> $FILE + done done - done - mkdir -p aptarchive/dists/${RELEASE}/main/source aptarchive/dists/${RELEASE}/main/i18n - touch aptarchive/dists/${RELEASE}/main/source/Sources - echo "Package: $NAME + mkdir -p aptarchive/dists/${RELEASE}/main/source aptarchive/dists/${RELEASE}/main/i18n + touch aptarchive/dists/${RELEASE}/main/source/Sources + echo "Package: $NAME Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) Description-en: $DESCRIPTION " >> aptarchive/dists/${RELEASE}/main/i18n/Translation-en + done } insertsource() { diff --git a/test/integration/test-apt-get-upgrade b/test/integration/test-apt-get-upgrade index 5335c243a..d042e4fb7 100755 --- a/test/integration/test-apt-get-upgrade +++ b/test/integration/test-apt-get-upgrade @@ -8,23 +8,18 @@ setupenvironment configarchitecture "i386" # simple case -insertpackage 'stable' 'upgrade-simple' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-simple' 'all' '1.0' insertpackage 'unstable' 'upgrade-simple' 'all' '2.0' -insertinstalledpackage 'upgrade-simple' 'all' '1.0' # upgrade with a new dependency -insertpackage 'stable' 'upgrade-with-new-dep' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-with-new-dep' 'all' '1.0' insertpackage 'unstable' 'upgrade-with-new-dep' 'all' '2.0' 'Depends: new-dep' insertpackage 'stable' 'new-dep' 'all' '1.0' -insertinstalledpackage 'upgrade-with-new-dep' 'all' '1.0' # upgrade with conflict and a new pkg with higher priority than conflict -insertpackage 'stable' 'upgrade-with-conflict' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-with-conflict' 'all' '1.0' insertpackage 'unstable' 'upgrade-with-conflict' 'all' '2.0' 'Conflicts: conflicting-dep' 'standard' -insertpackage 'stable' 'conflicting-dep' 'all' '1.0' -insertinstalledpackage 'upgrade-with-conflict' 'all' '1.0' -insertinstalledpackage 'conflicting-dep' 'all' '1.0' - +insertpackage 'stable,installed' 'conflicting-dep' 'all' '1.0' setupaptarchive diff --git a/test/integration/test-bug-745036-new-foreign-invalidates-cache b/test/integration/test-bug-745036-new-foreign-invalidates-cache index 490cbecdd..2b7ee06ad 100755 --- a/test/integration/test-bug-745036-new-foreign-invalidates-cache +++ b/test/integration/test-bug-745036-new-foreign-invalidates-cache @@ -6,10 +6,8 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' -insertpackage 'unstable' 'cool-foo' 'amd64' '1.0' 'Depends: foo' -insertpackage 'unstable' 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' -insertinstalledpackage 'cool-foo' 'amd64' '1.0' 'Depends: foo' -insertinstalledpackage 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' +insertpackage 'unstable,installed' 'cool-foo' 'amd64' '1.0' 'Depends: foo' +insertpackage 'unstable,installed' 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' setupaptarchive diff --git a/test/integration/test-bug-753297-upgradable b/test/integration/test-bug-753297-upgradable index 068704b3e..01395a095 100755 --- a/test/integration/test-bug-753297-upgradable +++ b/test/integration/test-bug-753297-upgradable @@ -16,8 +16,7 @@ Pin: release unstable Pin-Priority: 1 EOF -insertinstalledpackage 'foo' 'all' '1' -insertpackage 'testing' 'foo' 'all' '1' +insertpackage 'testing,installed' 'foo' 'all' '1' insertpackage 'testing-updates' 'foo' 'all' '2' insertpackage 'unstable' 'foo' 'all' '3' diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index 9d2ea2d5d..db97687ce 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -9,20 +9,17 @@ configarchitecture 'amd64' 'i386' 'armel' insertpackage 'stable' 'allarchs' 'all' '1' insertpackage 'unstable' 'allarchs' 'all' '2' -insertinstalledpackage 'fine' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'fine' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'fine' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'fine' 'amd64,i386' '2' 'Multi-Arch: same' insertinstalledpackage 'fine-installed' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'stable' 'fine-installed' 'i386,amd64,armel' '1' 'Multi-Arch: same' insertpackage 'unstable' 'fine-installed' 'i386,amd64' '2' 'Multi-Arch: same' -insertinstalledpackage 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'out-of-sync-native' 'amd64' '2' 'Multi-Arch: same' -insertinstalledpackage 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'out-of-sync-foreign' 'i386' '2' 'Multi-Arch: same' insertinstalledpackage 'out-of-sync-gone-native' 'i386,amd64' '1' 'Multi-Arch: same' diff --git a/test/integration/test-suggest-installed-multiarch-silbing b/test/integration/test-suggest-installed-multiarch-silbing index d55d250aa..89640a30c 100755 --- a/test/integration/test-suggest-installed-multiarch-silbing +++ b/test/integration/test-suggest-installed-multiarch-silbing @@ -9,8 +9,7 @@ configarchitecture 'amd64' 'i386' 'armel' insertinstalledpackage 'foo' 'i386' '1' insertpackage 'unstable' 'foo' 'amd64,i386' '1' -insertinstalledpackage 'foo2' 'i386' '1' -insertpackage 'unstable' 'foo2' 'i386' '1' +insertpackage 'unstable,installed' 'foo2' 'i386' '1' insertinstalledpackage 'foo3' 'amd64' '1' insertpackage 'unstable' 'foo3' 'amd64,i386' '1' -- cgit v1.2.3 From 23397c9d7d4d455461176600bb45c81185493504 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 23 Oct 2014 16:54:00 +0200 Subject: promote filesize to a hashstring It is a very simple hashstring, which is why it isn't contributing to the usability of a list of them, but it is also trivial to check and calculate, so it doesn't hurt checking it either as it can combined even with the simplest other hashes greatly complicate attacks on them as you suddenly need a same-size hash collision, which is usually a lot harder to achieve. --- test/integration/test-apt-update-filesize-mismatch | 55 ++++++++++++++++++++++ test/integration/test-apt-update-hashsum-mismatch | 49 +++++++++++++++++++ test/integration/test-apt-update-ims | 2 +- test/interactive-helper/aptwebserver.cc | 4 +- test/libapt/hashsums_test.cc | 25 +++++++--- 5 files changed, 127 insertions(+), 8 deletions(-) create mode 100755 test/integration/test-apt-update-filesize-mismatch create mode 100755 test/integration/test-apt-update-hashsum-mismatch (limited to 'test') diff --git a/test/integration/test-apt-update-filesize-mismatch b/test/integration/test-apt-update-filesize-mismatch new file mode 100755 index 000000000..8c73c059e --- /dev/null +++ b/test/integration/test-apt-update-filesize-mismatch @@ -0,0 +1,55 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' +configcompression 'gz' + +insertpackage 'testing' 'foo' 'all' '1' +insertpackage 'testing' 'foo2' 'all' '1' +insertsource 'testing' 'foo' 'all' '1' +insertsource 'testing' 'foo2' 'all' '1' + +setupaptarchive --no-update +changetowebserver + +find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete +for release in $(find aptarchive -name 'Release'); do + cp "$release" "${release}.backup" +done + +testsuccess aptget update +testsuccess aptcache show foo +testsuccess aptget install foo -s + +for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log); do + for ext in '' '.gz'; do + COMPRESSFILE="$get" + get="${get}${ext}" + FILE="$(basename -s '.gz' "$get")" + msgmsg 'Test filesize mismatch with file' "$FILE" + rm -rf rootdir/var/lib/apt/lists + + for release in $(find aptarchive -name 'Release'); do + SIZE="$(awk "/$FILE\$/ { print \$2; exit }" "${release}.backup")" + sed "s# $SIZE # $(($SIZE + 111)) #" "${release}.backup" > "$release" + done + signreleasefiles + + TEST='testfailure' + if expr match "$COMPRESSFILE" '^.*Translation-.*$' >/dev/null; then + TEST='testsuccess' + unset COMPRESSFILE + fi + $TEST aptget update -o Debug::pkgAcquire::Worker=1 + cp rootdir/tmp/${TEST}.output rootdir/tmp/update.output + testsuccess grep -E "$(basename -s '.gz' "$COMPRESSFILE").*Hash Sum mismatch" rootdir/tmp/update.output + $TEST aptcache show foo + $TEST aptget install foo -s + + testfailure aptcache show bar + testfailure aptget install bar -s + done +done diff --git a/test/integration/test-apt-update-hashsum-mismatch b/test/integration/test-apt-update-hashsum-mismatch new file mode 100755 index 000000000..747418c53 --- /dev/null +++ b/test/integration/test-apt-update-hashsum-mismatch @@ -0,0 +1,49 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' +configcompression 'gz' + +insertpackage 'testing' 'foo' 'all' '1' +insertpackage 'testing' 'foo2' 'all' '1' +insertsource 'testing' 'foo' 'all' '1' +insertsource 'testing' 'foo2' 'all' '1' + +setupaptarchive --no-update +changetowebserver + +echo 'Package: bar +Maintainer: Doctor Evil +Description: come to the dark side +' > aptarchive/DoctorEvil +compressfile aptarchive/DoctorEvil + +find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete + +testsuccess aptget update +testsuccess aptcache show foo +testsuccess aptget install foo -s + +for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log); do + msgmsg 'Test hashsum mismatch with file' "$get" + rm -rf rootdir/var/lib/apt/lists + webserverconfig 'aptwebserver::overwrite' '' + webserverconfig "aptwebserver::overwrite::$(printf '%s' "${get}" | sed 's#/#%2F#g' )::filename" '%2FDoctorEvil.gz' + + TEST='testfailure' + if expr match "$get" '^.*Translation-.*$' >/dev/null; then + TEST='testsuccess' + unset get + fi + $TEST aptget update + cp rootdir/tmp/${TEST}.output rootdir/tmp/update.output + testsuccess grep -E "$(basename -s '.gz' "$get").*Hash Sum mismatch" rootdir/tmp/update.output + $TEST aptcache show foo + $TEST aptget install foo -s + + testfailure aptcache show bar + testfailure aptget install bar -s +done diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index afae99563..5394a9f30 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -30,7 +30,7 @@ runtest() { # ensure that we still do a hash check on ims hit msgtest 'Test I-M-S' 'reverify' - aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A1 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail + aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A2 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail # ensure no leftovers in partial testfailure ls "rootdir/var/lib/apt/lists/partial/*" diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 7474cf148..00004a524 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -499,9 +499,11 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ return true; } /*}}}*/ -static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector const &parts)/*{{{*/ +static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector parts)/*{{{*/ { size_t const pcount = parts.size(); + for (size_t i = 0; i < pcount; ++i) + parts[i] = DeQuoteString(parts[i]); if (pcount == 4 && parts[1] == "set") { _config->Set(parts[2], parts[3]); diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index 2159996ff..a19a0befd 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -163,30 +163,34 @@ TEST(HashSumsTest, FileBased) FileFd fd(__FILE__, FileFd::ReadOnly); EXPECT_TRUE(fd.IsOpen()); + std::string FileSize; + strprintf(FileSize, "%llu", fd.FileSize()); { Hashes hashes; hashes.AddFD(fd.Fd()); HashStringList list = hashes.GetHashStringList(); EXPECT_FALSE(list.empty()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue()); EXPECT_EQ(sha1.Value(), list.find("SHA1")->HashValue()); EXPECT_EQ(sha256.Value(), list.find("SHA256")->HashValue()); EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue()); + EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue()); } - unsigned long sz = fd.FileSize(); + unsigned long long sz = fd.FileSize(); fd.Seek(0); { Hashes hashes; hashes.AddFD(fd.Fd(), sz); HashStringList list = hashes.GetHashStringList(); EXPECT_FALSE(list.empty()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue()); EXPECT_EQ(sha1.Value(), list.find("SHA1")->HashValue()); EXPECT_EQ(sha256.Value(), list.find("SHA256")->HashValue()); EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue()); + EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue()); } fd.Seek(0); { @@ -279,37 +283,46 @@ TEST(HashSumsTest, HashStringList) EXPECT_EQ(NULL, list.find("")); EXPECT_EQ(NULL, list.find("MD5Sum")); + // empty lists aren't equal HashStringList list2; EXPECT_FALSE(list == list2); EXPECT_TRUE(list != list2); + // some hashes don't really contribute to usability + list.push_back(HashString("Checksum-FileSize", "29")); + EXPECT_FALSE(list.empty()); + EXPECT_FALSE(list.usable()); + Hashes hashes; hashes.Add("The quick brown fox jumps over the lazy dog"); list = hashes.GetHashStringList(); EXPECT_FALSE(list.empty()); EXPECT_TRUE(list.usable()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_TRUE(NULL != list.find(NULL)); EXPECT_TRUE(NULL != list.find("")); EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL != list.find("Checksum-FileSize")); EXPECT_TRUE(NULL == list.find("ROT26")); _config->Set("Acquire::ForceHash", "MD5Sum"); EXPECT_FALSE(list.empty()); EXPECT_TRUE(list.usable()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_TRUE(NULL != list.find(NULL)); EXPECT_TRUE(NULL != list.find("")); EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL != list.find("Checksum-FileSize")); EXPECT_TRUE(NULL == list.find("ROT26")); _config->Set("Acquire::ForceHash", "ROT26"); EXPECT_FALSE(list.empty()); EXPECT_FALSE(list.usable()); - EXPECT_EQ(4, list.size()); + EXPECT_EQ(5, list.size()); EXPECT_TRUE(NULL == list.find(NULL)); EXPECT_TRUE(NULL == list.find("")); EXPECT_TRUE(NULL != list.find("MD5Sum")); + EXPECT_TRUE(NULL != list.find("Checksum-FileSize")); EXPECT_TRUE(NULL == list.find("ROT26")); _config->Clear("Acquire::ForceHash"); -- cgit v1.2.3 From d8c71b3b5dc98daa247433503ad8242c9e7b77db Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 24 Oct 2014 23:55:15 +0200 Subject: rewrite ReadMessages() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Central methods of our infrastructure like this one responsible for communication with our methods shouldn't be more complicated then they have to and not claim to have (albeit unlikely) bugs. While I am not sure about having improved the first part, the bug is now gone and a few explicit tests check that it stays that way, so nobody will notice the difference (hopefully) – expect that this should a very tiny bit faster as well as we don't manually proceed through the string. Git-Dch: Ignore --- test/libapt/strutil_test.cc | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'test') diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index 494159c87..9bc3c76fd 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -1,10 +1,13 @@ #include #include +#include #include #include #include +#include "file-helpers.h" + TEST(StrUtilTest,DeEscapeString) { // nothing special @@ -143,3 +146,70 @@ TEST(StrUtilTest,Base64Encode) EXPECT_EQ("Lg==", Base64Encode(".")); EXPECT_EQ("", Base64Encode("")); } +void ReadMessagesTestWithNewLine(char const * const nl, char const * const ab) +{ + SCOPED_TRACE(SubstVar(SubstVar(nl, "\n", "n"), "\r", "r") + " # " + ab); + FileFd fd; + std::string pkgA = "Package: pkgA\n" + "Version: 1\n" + "Size: 100\n" + "Description: aaa\n" + " aaa"; + std::string pkgB = "Package: pkgB\n" + "Version: 1\n" + "Flag: no\n" + "Description: bbb"; + std::string pkgC = "Package: pkgC\n" + "Version: 2\n" + "Flag: yes\n" + "Description:\n" + " ccc"; + + createTemporaryFile("readmessage", fd, NULL, (pkgA + nl + pkgB + nl + pkgC + nl).c_str()); + std::vector list; + EXPECT_TRUE(ReadMessages(fd.Fd(), list)); + EXPECT_EQ(3, list.size()); + EXPECT_EQ(pkgA, list[0]); + EXPECT_EQ(pkgB, list[1]); + EXPECT_EQ(pkgC, list[2]); + + size_t const msgsize = 63990; + createTemporaryFile("readmessage", fd, NULL, NULL); + for (size_t j = 0; j < msgsize; ++j) + fd.Write(ab, strlen(ab)); + for (size_t i = 0; i < 21; ++i) + { + std::string msg; + strprintf(msg, "msgsize=%zu i=%zu", msgsize, i); + SCOPED_TRACE(msg); + fd.Seek((msgsize + (i - 1)) * strlen(ab)); + fd.Write(ab, strlen(ab)); + fd.Write(nl, strlen(nl)); + fd.Seek(0); + list.clear(); + EXPECT_TRUE(ReadMessages(fd.Fd(), list)); + EXPECT_EQ(1, list.size()); + EXPECT_EQ((msgsize + i) * strlen(ab), list[0].length()); + EXPECT_EQ(std::string::npos, list[0].find_first_not_of(ab)); + } + + list.clear(); + fd.Write(pkgA.c_str(), pkgA.length()); + fd.Write(nl, strlen(nl)); + fd.Seek(0); + EXPECT_TRUE(ReadMessages(fd.Fd(), list)); + EXPECT_EQ(2, list.size()); + EXPECT_EQ((msgsize + 20) * strlen(ab), list[0].length()); + EXPECT_EQ(std::string::npos, list[0].find_first_not_of(ab)); + EXPECT_EQ(pkgA, list[1]); + + + fd.Close(); +} +TEST(StrUtilTest,ReadMessages) +{ + ReadMessagesTestWithNewLine("\n\n", "a"); + ReadMessagesTestWithNewLine("\r\n\r\n", "a"); + ReadMessagesTestWithNewLine("\n\n", "ab"); + ReadMessagesTestWithNewLine("\r\n\r\n", "ab"); +} -- cgit v1.2.3 From e52aad5208281837f13018363118ff73aaaabf45 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 25 Oct 2014 13:37:05 +0200 Subject: tests: enhance output of grep and test fails Git-Dch: Ignore --- test/integration/framework | 72 +++++++++++++++--------- test/integration/run-tests | 6 +- test/integration/test-apt-get-clean | 10 ++-- test/integration/test-apt-key | 14 ++--- test/integration/test-authentication-basic | 2 +- test/integration/test-bug-738785-switch-protocol | 2 +- 6 files changed, 64 insertions(+), 42 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 190d4d665..153c5bb25 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -77,12 +77,6 @@ if [ $MSGLEVEL -le 2 ]; then msgnmsg() { true; } msgtest() { true; } msgpass() { printf " ${CPASS}P${CNORMAL}"; } - msgskip() { printf " ${CWARNING}S${CNORMAL}" >&2; } - if [ -n "$CFAIL" ]; then - msgfail() { printf " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); } - else - msgfail() { printf " ###FAILED###" >&2; EXIT_CODE=$((EXIT_CODE+1)); } - fi fi if [ $MSGLEVEL -le 3 ]; then msginfo() { true; } @@ -1228,6 +1222,36 @@ testmarkedauto() { aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } +msgfailoutput() { + local MSG="$1" + local OUTPUT="$2" + shift 2 + echo >&2 + if [ "$1" = 'grep' ]; then + while [ -n "$2" ]; do shift; done + echo "#### Complete file: $1 ####" + cat >&2 "$1" || true + echo '#### grep output ####' + elif [ "$1" = 'test' ]; then + # doesn't support ! or non-file flags + msgfailoutputstatfile() { + local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' + if expr match "$1" "$FILEFLAGS" >/dev/null; then + echo "#### stat(2) of file: $2 ####" + stat "$2" || true + fi + } + msgfailoutputstatfile "$2" "$3" + while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do + shift 3 + msgfailoutputstatfile "$2" "$3" + done + echo '#### test output ####' + fi + cat >&2 $OUTPUT + msgfail "$MSG" +} + testsuccess() { if [ "$1" = '--nomsg' ]; then shift @@ -1237,10 +1261,10 @@ testsuccess() { local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" if "$@" >${OUTPUT} 2>&1; then if expr match "$1" '^apt.*' >/dev/null; then - if grep -q -E '^[WE]: ' "$OUTPUT"; then - echo >&2 - cat >&2 $OUTPUT - msgfail 'successful run, but output contains warnings/errors' + if grep -q -E ' runtime error: ' "$OUTPUT"; then + msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" + elif grep -q -E '^[WE]: ' "$OUTPUT"; then + msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" else msgpass fi @@ -1249,9 +1273,7 @@ testsuccess() { fi else local EXITCODE=$? - echo >&2 - cat >&2 $OUTPUT - msgfail "exitcode $EXITCODE" + msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" fi aptautotest 'testsuccess' "$@" } @@ -1264,14 +1286,12 @@ testwarning() { local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" if "$@" >${OUTPUT} 2>&1; then if expr match "$1" '^apt.*' >/dev/null; then - if grep -q -E '^E: ' "$OUTPUT"; then - echo >&2 - cat >&2 $OUTPUT - msgfail 'successful run, but output contains errors' + if grep -q -E ' runtime error: ' "$OUTPUT"; then + msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" + elif grep -q -E '^E: ' "$OUTPUT"; then + msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" elif ! grep -q -E '^W: ' "$OUTPUT"; then - echo >&2 - cat >&2 $OUTPUT - msgfail 'successful run, but output contains no warnings' + msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" else msgpass fi @@ -1295,16 +1315,14 @@ testfailure() { local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" if "$@" >${OUTPUT} 2>&1; then local EXITCODE=$? - echo >&2 - cat >&2 $OUTPUT - msgfail "exitcode $EXITCODE" + msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" else local EXITCODE=$? if expr match "$1" '^apt.*' >/dev/null; then - if ! grep -q -E '^E: ' "$OUTPUT"; then - echo >&2 - cat >&2 $OUTPUT - msgfail "run failed with exitcode ${EXITCODE}, but with no errors" + if grep -q -E ' runtime error: ' "$OUTPUT"; then + msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" + elif ! grep -q -E '^E: ' "$OUTPUT"; then + msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" else msgpass fi diff --git a/test/integration/run-tests b/test/integration/run-tests index c39a2ac68..6c6a37611 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -46,7 +46,11 @@ for testcase in $(run-parts --list $DIR | grep '/test-'); do if ! ${testcase}; then FAIL=$((FAIL+1)) FAILED_TESTS="$FAILED_TESTS $(basename $testcase)" - echo >&2 "$(basename $testcase) ... FAIL" + if [ "$MSGLEVEL" -le 2 ]; then + printf >&2 "\n${CHIGH}Running $(basename $testcase) -> FAILED${CRESET}" + else + echo >&2 "${CHIGH}Running $(basename $testcase) -> FAILED${CRESET}" + fi else PASS=$((PASS+1)) fi diff --git a/test/integration/test-apt-get-clean b/test/integration/test-apt-get-clean index 98f7c84d0..457bff9d3 100755 --- a/test/integration/test-apt-get-clean +++ b/test/integration/test-apt-get-clean @@ -26,10 +26,10 @@ touch rootdir/var/cache/apt/archives/foo_4_all.deb testsuccess aptget clean -testsuccess test ! -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en -testsuccess test ! -e rootdir/var/cache/apt/archives/foo_1_all.deb -testsuccess test ! -e rootdir/var/cache/apt/archives/foo_2_all.deb -testsuccess test ! -e rootdir/var/cache/apt/archives/foo_3_all.deb -testsuccess test ! -e rootdir/var/cache/apt/archives/foo_4_all.deb +testfailure test -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en +testfailure test -e rootdir/var/cache/apt/archives/foo_1_all.deb +testfailure test -e rootdir/var/cache/apt/archives/foo_2_all.deb +testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb +testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index e6ac530a6..b6b7b7909 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -41,7 +41,7 @@ gpg: unchanged: 1' aptkey --fakeroot update testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' - testsuccess test ! -e rootdir/etc/apt/trusted.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg testsuccess aptkey --fakeroot add ./keys/rexexpired.pub msgtest 'Check if trusted.gpg is created with permissions set to' '0644' if [ "$(stat -c '%a' rootdir/etc/apt/trusted.gpg )" = '644' ]; then @@ -78,7 +78,7 @@ pub 2048R/DBAC8DAE 2010-08-18' cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE testempty aptkey list - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ msgtest 'Test key removal with' 'long key ID' @@ -86,7 +86,7 @@ pub 2048R/DBAC8DAE 2010-08-18' cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE testempty aptkey list - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ msgtest 'Test key removal with' 'fingerprint' @@ -94,7 +94,7 @@ pub 2048R/DBAC8DAE 2010-08-18' cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE testempty aptkey list - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ msgtest 'Test key removal with' 'single key in softlink' @@ -102,7 +102,7 @@ pub 2048R/DBAC8DAE 2010-08-18' ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE testempty aptkey list - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess test -L rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ cleanplate @@ -125,7 +125,7 @@ pub 2048R/528144E2 2011-01-16' testsuccess --nomsg aptkey --fakeroot del DBAC8DAE testaptkeys 'pub 2048R/528144E2 2011-01-16' testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ - testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg + testfailure test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ msgtest 'Test key removal with' 'multiple files including key' @@ -134,7 +134,7 @@ pub 2048R/528144E2 2011-01-16' cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE testaptkeys 'pub 2048R/528144E2 2011-01-16' - testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ diff --git a/test/integration/test-authentication-basic b/test/integration/test-authentication-basic index 4b0ead54a..21b024970 100755 --- a/test/integration/test-authentication-basic +++ b/test/integration/test-authentication-basic @@ -18,7 +18,7 @@ testauthfailure() { testfailure apthelper download-file "${1}/bash" ./downloaded/bash # crappy test, but http and https output are wastely different… testsuccess grep 401 rootdir/tmp/testfailure.output - testsuccess test ! -s ./downloaded/bash + testfailure test -s ./downloaded/bash } testauthsuccess() { diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index e50c84dbf..0f458e099 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -54,7 +54,7 @@ echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf cd downloaded testequal "E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed?" aptget download apt -q=0 -testsuccess test ! -e apt_1.0_all.deb +testfailure test -e apt_1.0_all.deb cd - >/dev/null # revert to all methods -- cgit v1.2.3 From 18593cf75189c0d6d3cbbf729013c875398218ca Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 29 Oct 2014 16:32:42 +0100 Subject: Only support Translation-* that are listed in the {In,}Release file Handle Translation-* files exactly like Packages files (with the expection that it is ok if a download of them fails). Remove all "guessing" on apts side. This will elimimnate a bunch of errors releated to captive portals and similar. Its also more correct and removes another potential attack vector. --- .../test-bug-595691-empty-and-broken-archive-files | 10 ---------- test/integration/test-bug-624218-Translation-file-handling | 11 ++--------- 2 files changed, 2 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files index fedf82c92..bca07268c 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -73,16 +73,6 @@ E: Some index files failed to download. They have been ignored, or old ones used testoverhttp() { forcecompressor "$1" - createemptyfile 'en' - testaptgetupdate "Get: http://localhost:8080 Packages [] -Get: http://localhost:8080 Translation-en -Reading package lists..." "empty file en.$COMPRESS over http" - - createemptyarchive 'en' - testaptgetupdate "Get: http://localhost:8080 Packages [] -Get: http://localhost:8080 Translation-en [] -Reading package lists..." "empty archive en.$COMPRESS over http" - createemptyarchive 'Packages' testaptgetupdate "Get: http://localhost:8080 Packages [] Reading package lists..." "empty archive Packages.$COMPRESS over http" diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index d3c5b08ac..4ec30ee09 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -47,16 +47,9 @@ translationslisted() { translationslisted 'with full Index' -# only compressed files available (as it happens on CD-ROM) -sed -i '/i18n\/Translation-[^.]*$/ d' $(find aptarchive -name 'Release') -signreleasefiles - -translationslisted 'with partial Index' - - # no records at all about Translation files (fallback to guessing) -sed -i '/i18n\/Translation-.*$/ d' $(find aptarchive -name 'Release') -signreleasefiles +find aptarchive -name 'Release' -or -name 'InRelease' | xargs rm -f +configallowinsecurerepositories "true"; msgtest 'Download of en as forced language' 'without Index' aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail -- cgit v1.2.3 From 6e2261d0f250406058d66b360080aa986953ae19 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 4 Nov 2014 22:01:59 +0100 Subject: test/integration/test-apt-update-filesize-mismatch: use "basename file suffix" instead of -s for compatibility with older systems --- test/integration/test-apt-update-filesize-mismatch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-update-filesize-mismatch b/test/integration/test-apt-update-filesize-mismatch index 8c73c059e..b484c5161 100755 --- a/test/integration/test-apt-update-filesize-mismatch +++ b/test/integration/test-apt-update-filesize-mismatch @@ -28,7 +28,7 @@ for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver. for ext in '' '.gz'; do COMPRESSFILE="$get" get="${get}${ext}" - FILE="$(basename -s '.gz' "$get")" + FILE="$(basename "$get" '.gz')" msgmsg 'Test filesize mismatch with file' "$FILE" rm -rf rootdir/var/lib/apt/lists -- cgit v1.2.3 From 7933b3a1cf56096d6ab30cedf1b736054b5fc84b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 Nov 2014 17:28:13 +0100 Subject: test/integration/test-bug-624218-Translation-file-handling: clarify when Translation-* is guessed --- test/integration/test-bug-624218-Translation-file-handling | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index 4ec30ee09..d32bd513b 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -47,7 +47,8 @@ translationslisted() { translationslisted 'with full Index' -# no records at all about Translation files (fallback to guessing) +# No Release file at all, so no records about Translation files +# (fallback to guessing) find aptarchive -name 'Release' -or -name 'InRelease' | xargs rm -f configallowinsecurerepositories "true"; -- cgit v1.2.3 From c355ea30383486e74635cd0248d3b53ed9759c39 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Nov 2014 18:04:29 +0100 Subject: reenable patchsize limit option for pdiffs One word: "doh!" Commit f6d4ab9ad8a2cfe52737ab620dd252cf8ceec43d disabled the check to prevent apt from downloading bigger patches than the index it tries to patch. Happens rarly of course, but still. Detected by scan-build complaining about a dead assignment. To make up for the mistake a test is included as well. --- test/integration/test-pdiff-usage | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test') diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 5bad90214..d773dcd66 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -180,6 +180,40 @@ SHA256-Patches: testnopackage oldstuff testequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff + + msgmsg "Testcase: pdiff patch bigger than index itself: $*" + rm -rf rootdir/var/lib/apt/lists + cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists + cp ${PKGFILE}-new aptarchive/Packages + compressfile 'aptarchive/Packages' + mkdir -p aptarchive/Packages.diff + PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)" + diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true + cat $PATCHFILE | gzip > ${PATCHFILE}.gz + PATCHINDEX='aptarchive/Packages.diff/Index' + echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) +SHA1-History: + 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28 + $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) +SHA1-Patches: + 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28 + $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE)000 $(basename $PATCHFILE) +SHA256-Current: $(sha256sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) +SHA256-History: + 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28 + $(sha256sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE) +SHA256-Patches: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 + $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE)000 $(basename $PATCHFILE)" > $PATCHINDEX + generatereleasefiles '+1hour' + signreleasefiles + #find aptarchive -name 'Packages*' -type f -delete + testsuccess aptget update -o Debug::pkgAcquire::Diffs=1 "$@" + cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptgetupdate.output + testsuccess grep 'bytes (Limit is' rootdir/tmp/aptgetupdate.output + testnopackage oldstuff + testequal "$(cat ${PKGFILE}-new) +" aptcache show apt newstuff } echo 'Debug::pkgAcquire::Diffs "true"; Debug::Acquire::Transaction "true"; -- cgit v1.2.3 From 4234d90d58b684824bf217d9226c50b7c9583346 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Nov 2014 18:14:04 +0100 Subject: tests: silence clang on uninitilized variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The testcases have far worse problems if these ever end up being NULL and/or are not given a value by the method called, but clang is right to warn about it, just that we don't want to fix it in testcases… Git-Dch: Ignore --- test/libapt/cdrom_test.cc | 3 ++- test/libapt/sourcelist_test.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/libapt/cdrom_test.cc b/test/libapt/cdrom_test.cc index 5cf3b353c..7257eaf1b 100644 --- a/test/libapt/cdrom_test.cc +++ b/test/libapt/cdrom_test.cc @@ -109,6 +109,7 @@ TEST(CDROMTest, FindMountPointForDevice) EXPECT_EQ("/boot/efi", FindMountPointForDevice("/dev/sda1")); EXPECT_EQ("/tmp", FindMountPointForDevice("tmpfs")); - unlink(tempfile); + if (tempfile != NULL) + unlink(tempfile); free(tempfile); } diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index eb2d76c43..747ab4957 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -20,7 +20,7 @@ class SourceList : public pkgSourceList { TEST(SourceListTest,ParseFileDeb822) { FileFd fd; - char * tempfile; + char * tempfile = NULL; createTemporaryFile("parsefiledeb822", fd, &tempfile, "Types: deb\n" "URIs: http://ftp.debian.org/debian\n" -- cgit v1.2.3 From ad5ffe1ffb203eb58e5e25fe6f4c0dabc53253c9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Nov 2014 18:42:56 +0100 Subject: Division by result of sizeof(). memset() expects a size in bytes "did you intend to multiply instead?" is what cppcheck helpful says and it is absolutely right. Doesn't make a whole lot of a difference though as we are talking about 'char' in this testcase, but just to be sure. Reported-By: cppcheck Git-Dch: Ignore --- test/libapt/fileutl_test.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 8d47c5098..57d5bbdc2 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -53,11 +53,16 @@ static void TestFileFd(mode_t const a_umask, mode_t const ExpectedFilePermission // ensure the memory is as predictably messed up #define APT_INIT_READBACK \ char readback[20]; \ - memset(readback, 'D', sizeof(readback)/sizeof(readback[0])); \ + memset(readback, 'D', sizeof(readback)*sizeof(readback[0])); \ readback[19] = '\0'; #define EXPECT_N_STR(expect, actual) \ EXPECT_EQ(0, strncmp(expect, actual, strlen(expect))); - + { + APT_INIT_READBACK + char const * const expect = "DDDDDDDDDDDDDDDDDDD"; + EXPECT_STREQ(expect,readback); + EXPECT_N_STR(expect, readback); + } { APT_INIT_READBACK char const * const expect = "This"; -- cgit v1.2.3 From 23fb7b2cbbda62c99a199d29ad62205b23d35af4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Nov 2014 18:56:12 +0100 Subject: (style) Variable 'res' is assigned a value that is never used Checking the return value of this (and many other calls) in this testcase is a good idea, so we do it now. Reported-By: cppcheck Git-Dch: Ignore --- test/libapt/fileutl_test.cc | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 57d5bbdc2..a2c303768 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -252,37 +252,40 @@ TEST(FileUtlTest, Popen) // output something const char* Args[10] = {"/bin/echo", "meepmeep", NULL}; - bool res = Popen(Args, Fd, Child, FileFd::ReadOnly); - Fd.Read(buf, sizeof(buf)-1, &n); + EXPECT_TRUE(Popen(Args, Fd, Child, FileFd::ReadOnly)); + EXPECT_TRUE(Fd.Read(buf, sizeof(buf)-1, &n)); buf[n] = 0; EXPECT_NE(n, 0); - EXPECT_EQ(res, true); EXPECT_STREQ(buf, "meepmeep\n"); // wait for the child to exit and cleanup - ExecWait(Child, "PopenRead"); - Fd.Close(); + EXPECT_TRUE(ExecWait(Child, "PopenRead")); + EXPECT_TRUE(Fd.Close()); // ensure that after a close all is good again if(FileExists("/proc/self/fd")) EXPECT_EQ(Glob("/proc/self/fd/*").size(), OpenFds.size()); - // ReadWrite is not supported - res = Popen(Args, Fd, Child, FileFd::ReadWrite); - EXPECT_EQ(res, false); - _error->Discard(); + _error->PushToStack(); + EXPECT_FALSE(Popen(Args, Fd, Child, FileFd::ReadWrite)); + EXPECT_FALSE(Fd.IsOpen()); + EXPECT_FALSE(Fd.Failed()); + EXPECT_TRUE(_error->PendingError()); + _error->RevertToStack(); // write something Args[0] = "/bin/bash"; Args[1] = "-c"; Args[2] = "read"; Args[3] = NULL; - res = Popen(Args, Fd, Child, FileFd::WriteOnly); + EXPECT_TRUE(Popen(Args, Fd, Child, FileFd::WriteOnly)); s = "\n"; - Fd.Write(s.c_str(), s.size()); - Fd.Close(); - ExecWait(Child, "PopenWrite"); + EXPECT_TRUE(Fd.Write(s.c_str(), s.length())); + EXPECT_TRUE(Fd.Close()); + EXPECT_FALSE(Fd.IsOpen()); + EXPECT_FALSE(Fd.Failed()); + EXPECT_TRUE(ExecWait(Child, "PopenWrite")); } TEST(FileUtlTest, flAbsPath) { -- cgit v1.2.3 From 20801f613690b330c79b4f7a30dc3ff52b722468 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 8 Nov 2014 14:23:18 +0100 Subject: fix variable naming typo used in debug output Git-Dch: Ignore --- test/integration/test-apt-update-ims | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 5394a9f30..0fa882d78 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -30,7 +30,7 @@ runtest() { # ensure that we still do a hash check on ims hit msgtest 'Test I-M-S' 'reverify' - aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A2 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail + aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A2 'ReceivedHash:' | grep -q -- '- SHA' && msgpass || msgfail # ensure no leftovers in partial testfailure ls "rootdir/var/lib/apt/lists/partial/*" -- cgit v1.2.3 From ad7e0941b376d792911f240377094a2e78ca8756 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 8 Nov 2014 18:14:46 +0100 Subject: streamline display of --help in all tools By convention, if I run a tool with --help or --version I expect it to exit successfully with the usage, while if I do call it wrong (like without any parameters) I expect the usage message shown with a non-zero exit. --- test/integration/framework | 2 ++ test/integration/test-00-commands-have-help | 52 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 test/integration/test-00-commands-have-help (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 153c5bb25..dd66f2a0c 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -128,6 +128,7 @@ aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } aptitude() { runapt aptitude "$@"; } aptextracttemplates() { runapt apt-extracttemplates "$@"; } aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } +aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } dpkg() { command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" @@ -194,6 +195,7 @@ setupenvironment() { APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"} APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"} APTINTERNALSOLVER=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"} + APTDUMPSOLVER=${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"} test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" # ----- diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help new file mode 100755 index 000000000..ebf8b8cfa --- /dev/null +++ b/test/integration/test-00-commands-have-help @@ -0,0 +1,52 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +# this test does double duty: The obvious is checking for --help and co, +# but it also checks if the binary can find all methods in the library. +# The later is quite handy for manual testing of non-abibreaking changes +export LD_BIND_NOW=1 + +checkversionmessage() { + testsuccess grep '^apt .* compiled on ' ${1}-help.output +} + +checkhelpmessage() { + checkversionmessage "$1" + testsuccess grep '^Usage:' ${1}-help.output +} + +checkoptions() { + testsuccess $1 --help + cp -f rootdir/tmp/testsuccess.output ${1}-help.output + checkhelpmessage "$1" + + testsuccess $1 --version + cp -f rootdir/tmp/testsuccess.output ${1}-help.output + checkversionmessage "$1" +} + +for CMD in 'apt-cache' 'apt-cdrom' 'apt-config' \ + 'apt-extracttemplates' 'apt-get' 'apt-helper' \ + 'apt-mark' 'apt-sortpkgs' 'apt' 'apt-ftparchive'; do + cmd="$(echo "$CMD" | tr -d '-')" + msgtest 'Test for failure with no parameters calling' "$CMD" + if $cmd > ${cmd}-help.output 2>&1; then + echo + cat ${cmd}-help.output + msgfail 'zero exit' + else + msgpass + fi + checkhelpmessage "$cmd" + checkoptions "$cmd" +done + +for CMD in 'apt-dump-solver' 'apt-internal-solver'; do + checkoptions "$(echo "$CMD" | tr -d '-')" +done -- cgit v1.2.3 From d9e518c6f7dc0ad464495b586d1b8e115d54d41a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 8 Nov 2014 20:44:44 +0100 Subject: use the same code to detect quiet setting in all tools Git-Dch: Ignore --- test/integration/test-apt-ftparchive-cachedb | 30 +++++++----- test/integration/test-apt-ftparchive-src-cachedb | 60 +++++++++++------------- 2 files changed, 46 insertions(+), 44 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index 0e1986bcd..866e5a469 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -69,32 +69,38 @@ buildsimplenativepackage 'foo' 'i386' '1' 'test' mv incoming/* aptarchive/pool/main/ # generate (empty cachedb) -aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1 +cp rootdir/tmp/testsuccess.output stats-out.txt ensure_correct_packages_file ensure_correct_contents_file -testequal " Misses in Cache: 2 - dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt +testsuccess grep Misses stats-out.txt +testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 2 + dists/test/Contents-i386: New 402 B Misses in Cache: 0' # generate again -aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1 +cp rootdir/tmp/testsuccess.output stats-out.txt ensure_correct_packages_file ensure_correct_contents_file -testequal " Misses in Cache: 0 - dists/test/Contents-i386: Misses in Cache: 0" grep Misses stats-out.txt +testsuccess grep Misses stats-out.txt +testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 0 + dists/test/Contents-i386: Misses in Cache: 0' # and again (with removing the Packages file) rm -f ./aptarchive/dists/test/main/binary-i386/* rm -f ./aptarchive/dists/test/Contents-i386 -aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt +testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1 +cp rootdir/tmp/testsuccess.output stats-out.txt ensure_correct_packages_file ensure_correct_contents_file -testequal " Misses in Cache: 0 - dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt +testsuccess grep Misses stats-out.txt +testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 0 + dists/test/Contents-i386: New 402 B Misses in Cache: 0' # and clean rm -rf aptarchive/pool/main/* -testequal "packages-main-i386.db" aptftparchive clean ftparchive.conf -aptftparchive clean ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1 +testequal "packages-main-i386.db" aptftparchive clean ftparchive.conf -q=0 +testsuccess aptftparchive clean ftparchive.conf -q=0 -o Debug::APT::FTPArchive::Clean=1 +cp rootdir/tmp/testsuccess.output clean-out.txt testequal "0 Number of unique keys in the tree" grep unique clean-out.txt testequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt - diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index e7b148530..6e857c0cb 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -106,28 +106,22 @@ mkdir -p aptarchive/dists/test/main/source/ mkdir aptarchive-overrides mkdir aptarchive-cache - - -# generate with --db option -(cd aptarchive && aptftparchive --db ./test.db sources pool/main/ \ - -o APT::FTPArchive::ShowCacheMisses=1 \ - > dists/test/main/source/Sources \ - 2> stats-out.txt - testequal " Misses in Cache: 2" grep Misses stats-out.txt -) +msgtest 'generate with --db option' +cd aptarchive +aptftparchive --db ./test.db sources pool/main/ -q=0 -o APT::FTPArchive::ShowCacheMisses=1 > dists/test/main/source/Sources 2>stats-out.txt && msgpass || msgfail +testsuccess grep Misses stats-out.txt +testfileequal '../rootdir/tmp/testsuccess.output' ' Misses in Cache: 2' +cd .. assert_correct_sources_file -# generate with --db option (again to ensure its in the cache) -(cd aptarchive && aptftparchive --db ./test.db sources pool/main/ \ - -o APT::FTPArchive::ShowCacheMisses=1 \ - > dists/test/main/source/Sources \ - 2> stats-out.txt - testequal " Misses in Cache: 0" grep Misses stats-out.txt -) +msgtest 'generate with --db option (again to ensure its in the cache)' +cd aptarchive +aptftparchive --db ./test.db sources pool/main/ -q=0 -o APT::FTPArchive::ShowCacheMisses=1 > dists/test/main/source/Sources 2>stats-out.txt && msgpass || msgfail +testsuccess grep Misses stats-out.txt +testfileequal '../rootdir/tmp/testsuccess.output' ' Misses in Cache: 0' +cd .. assert_correct_sources_file - - # get ready for the "apt-ftparchive generate" command cat > apt-ftparchive.conf <<"EOF" Dir { @@ -159,20 +153,21 @@ Tree "dists/test" { }; EOF -# generate (empty cachedb) -aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt -testequal " Misses in Cache: 2" grep Misses stats-out.txt +msgtest 'generate (empty cachedb)' +testsuccess aptftparchive generate apt-ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1 +cp rootdir/tmp/testsuccess.output stats-out.txt +testsuccess grep Misses stats-out.txt +testfileequal rootdir/tmp/testsuccess.output ' Misses in Cache: 2' assert_correct_sources_file - -# generate again out of the cache +msgtest 'generate again out of the cache' rm -f ./aptarchive/dists/test/main/source/Sources -aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt -testequal " Misses in Cache: 0" grep Misses stats-out.txt +testsuccess aptftparchive generate apt-ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1 +cp rootdir/tmp/testsuccess.output stats-out.txt +testsuccess grep Misses stats-out.txt +testfileequal rootdir/tmp/testsuccess.output ' Misses in Cache: 0' assert_correct_sources_file - - # generate invalid files mkdir aptarchive/pool/invalid printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc @@ -191,8 +186,9 @@ E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchiv # ensure clean works rm -f aptarchive/pool/main/* -aptftparchive clean apt-ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1 -testequal "0 Number of unique keys in the tree" grep unique clean-out.txt -testequal "sources-main.db" grep sources-main.db clean-out.txt - - +testsuccess aptftparchive clean apt-ftparchive.conf -q=0 -o Debug::APT::FTPArchive::Clean=1 +cp rootdir/tmp/testsuccess.output clean-out.txt +testsuccess grep unique clean-out.txt +testfileequal 'rootdir/tmp/testsuccess.output' "0 Number of unique keys in the tree" +testsuccess grep sources-main.db clean-out.txt +testfileequal 'rootdir/tmp/testsuccess.output' "sources-main.db" -- cgit v1.2.3 From 061ee5f0efa9d8e8fe4796c13af68fe282a21073 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 8 Nov 2014 22:23:19 +0100 Subject: enhance apt-extracttemplates test The tool checks for debconf version before printing the info it extracts, so that it doesn't extract data which can't be interpreted before debconf is upgraded. It is only fair to check for this behaviour in the tests. Git-Dch: Ignore --- test/integration/framework | 1 + test/integration/test-apt-extracttemplates | 69 ++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index dd66f2a0c..0da9e2aab 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1110,6 +1110,7 @@ testempty() { if "$@" >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then msgpass else + echo cat $COMPAREFILE msgfail fi diff --git a/test/integration/test-apt-extracttemplates b/test/integration/test-apt-extracttemplates index ae2cc8bc2..276862464 100755 --- a/test/integration/test-apt-extracttemplates +++ b/test/integration/test-apt-extracttemplates @@ -8,38 +8,63 @@ setupenvironment configarchitecture 'amd64' # apt-extracttemplates needs this -insertinstalledpackage 'debconf' 'amd64' '1.5' insertinstalledpackage 'pkg-with-template' 'amd64' '1.0' # build a simple package that contains a config and a tempalte mkdir -p DEBIAN -TEMPLATE_STR="Template: foo/bar -Type: string -Description: Some bar var -" -echo "$TEMPLATE_STR" > DEBIAN/templates - CONFIG_STR="#!/bin/sh random shell stuff " echo "$CONFIG_STR" > DEBIAN/config -buildsimplenativepackage 'pkg-with-template' 'amd64' '0.8.15' 'stable' '' 'pkg with template' '' '' './DEBIAN' +testrun() { + local TEMPLATE_STR='Template: foo/bar +Type: string +Description: Some bar var +' + echo "$TEMPLATE_STR" > DEBIAN/templates + buildsimplenativepackage "$1" 'amd64' '0.8.15' 'stable' "$2" 'pkg with template' '' '' './DEBIAN' + + cp dpkg.status rootdir/var/lib/dpkg/status + insertinstalledpackage 'debconf' 'amd64' '3' + + # ensure we get the right stuff out of the file + rm -rf extracttemplates-out rootdir/var/cache/apt + mkdir extracttemplates-out + testsuccess aptextracttemplates -t ./extracttemplates-out incoming/${1}*.deb + OUT='rootdir/tmp/testsuccess.output' + testequal "$1" cut -f1 -d' ' $OUT + if [ -n "$2" ]; then + testequal '' cut -f2 -d' ' $OUT + else + testequal '1.0' cut -f2 -d' ' $OUT + fi + TEMPLATE=$(cut -f3 -d' ' $OUT) + testfileequal "$TEMPLATE" "$TEMPLATE_STR" + CONFIG=$(cut -f4 -d' ' $OUT) + testfileequal "$CONFIG" "$CONFIG_STR" -# ensure we get the right stuff out of the file -mkdir extracttemplates-out -OUT="$(aptextracttemplates -t ./extracttemplates-out incoming/pkg-with-template*.deb)" + # ensure that the format of the output string has the right number of dots + for s in "$CONFIG" "$TEMPLATE"; do + NR_DOTS=$(basename "$s" | tr -c -d '.') + testequal '..' echo $NR_DOTS + done -PKG=$(printf "$OUT" | cut -f1 -d' ') -INSTALLED_VER=$(printf "$OUT" | cut -f2 -d' ') -TEMPLATE=$(printf "$OUT" | cut -f3 -d' ') -CONFIG=$(printf "$OUT" | cut -f4 -d' ') + if [ -n "$2" ]; then + rm -rf extracttemplates-out rootdir/var/cache/apt + mkdir extracttemplates-out + cp dpkg.status rootdir/var/lib/dpkg/status + insertinstalledpackage 'debconf' 'amd64' '1' + testempty aptextracttemplates -t ./extracttemplates-out incoming/${1}*.deb + fi +} -testequal "$CONFIG_STR" cat $CONFIG -testequal "$TEMPLATE_STR" cat $TEMPLATE +cp rootdir/var/lib/dpkg/status dpkg.status +testrun 'pkg-with-template' '' +testrun 'pkg-with-template-depends' 'Depends: debconf (>= 2)' +testrun 'pkg-with-template-predepends' 'Pre-Depends: debconf (>= 2)' -# ensure that the format of the output string has the right number of dots -for s in "$CONFIG" "$TEMPLATE"; do - NR_DOTS=$(basename "$s" | tr -c -d .) - testequal ".." echo $NR_DOTS -done +# test with no debconf installed +cp dpkg.status rootdir/var/lib/dpkg/status +testfailure aptextracttemplates -t ./extracttemplates-out incoming/pkg-with-template-depends*.deb +testfileequal 'rootdir/tmp/testfailure.output' 'E: Cannot get debconf version. Is debconf installed?' -- cgit v1.2.3 From 7824564bfde681eddf6969174bba7604d6f34848 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 8 Nov 2014 23:59:31 +0100 Subject: fix test to not spoil output with warnings Git-Dch: Ignore --- .../test-bug-624218-Translation-file-handling | 57 +++++++++++++++------- 1 file changed, 39 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index d32bd513b..652386892 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -8,80 +8,101 @@ configarchitecture 'i386' buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable' -setupaptarchive +setupaptarchive --no-update changetowebserver - rm -rf rootdir/var/lib/apt/lists translationslisted() { msgtest 'No download of non-existent locals' "$1" - LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass + export LC_ALL="" + testsuccess --nomsg aptget update -o Acquire::Languages=en + testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of existent locals' "$1" - LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail + testsuccess --nomsg aptget update + cp rootdir/tmp/testsuccess.output testsuccess.output + testsuccess grep -q -e 'Translation-en ' testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of en in LC_ALL=C' "$1" - LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail + export LC_ALL=C + testsuccess --nomsg aptget update + cp rootdir/tmp/testsuccess.output testsuccess.output + testsuccess grep -q -e 'Translation-en ' testsuccess.output rm -rf rootdir/var/lib/apt/lists + unset LC_ALL msgtest 'Download of en as forced language' "$1" - aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail + testsuccess --nomsg aptget update -o Acquire::Languages=en + cp rootdir/tmp/testsuccess.output testsuccess.output + testsuccess grep -q -e 'Translation-en ' testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' "$1" - aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass + testsuccess --nomsg aptget update -o Acquire::Languages=en + testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download no Translation- if forced language is non-existent' "$1" - aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass + testsuccess --nomsg aptget update -o Acquire::Languages=ast_DE + testfailure grep -q -e 'Translation-' rootdir/tmp/testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing if none is forced' "$1" - aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass + testsuccess --nomsg aptget update -o Acquire::Languages=none + testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output rm -rf rootdir/var/lib/apt/lists } translationslisted 'with full Index' - # No Release file at all, so no records about Translation files # (fallback to guessing) -find aptarchive -name 'Release' -or -name 'InRelease' | xargs rm -f +find aptarchive \( -name 'Release' -o -name 'InRelease' \) -delete configallowinsecurerepositories "true"; msgtest 'Download of en as forced language' 'without Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail +testwarning --nomsg aptget update -o Acquire::Languages=en +cp rootdir/tmp/testsuccess.output testsuccess.output +testsuccess grep -q -e 'Translation-en ' testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' 'without Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass +testwarning --nomsg aptget update -o Acquire::Languages=en +testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of ast_DE as forced language' 'without Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-ast_DE$' && msgpass || msgfail +testwarning --nomsg aptget update -o Acquire::Languages=ast_DE +cp rootdir/tmp/testsuccess.output testsuccess.output +testsuccess grep -q -e 'Translation-ast_DE$' testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' 'without Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-[^a][^s]' && msgfail || msgpass +testwarning --nomsg aptget update -o Acquire::Languages=ast_DE +testfailure grep -q -e 'Translation-[^a][^s]' rootdir/tmp/testsuccess.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing if none is forced' 'without Index' -aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass +testwarning --nomsg aptget update -o Acquire::Languages=none +testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE msgtest 'Download of builtin files' 'without Index' -aptget update | grep -q -e 'Translation-ast_DE' && msgpass || msgfail +testwarning --nomsg aptget update +cp rootdir/tmp/testsuccess.output testsuccess.output +testsuccess grep -q -e 'Translation-ast_DE' testsuccess.output rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE msgtest 'Download of nothing (even builtin) if none is forced' 'without Index' -aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass +testwarning --nomsg aptget update -o Acquire::Languages=none +testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output rm -rf rootdir/var/lib/apt/lists -- cgit v1.2.3 From 374f8492e6f109e8427816a8f513e5e8feda9049 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 9 Nov 2014 15:40:19 +0100 Subject: allow uninstalled packages to be put on hold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dpkg wants to know about a package before it can be put on hold, so we have to at least hint about its existance in the available file it "maintaince" to know about such stuff. The simple thing would probably be to just feed all Packages files into dpkg as well, but what would be the point really? Exactly, so we take a shortcut here and just create dummies in the available file if we need to which isn't going to be that common as usually you are holding packages back and not off. Who would have thought that a simple feature like setting a package on hold requires more than 200 lines of code… at least with the testcase it is now explicitly tested code. --- test/integration/test-apt-mark | 72 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 test/integration/test-apt-mark (limited to 'test') diff --git a/test/integration/test-apt-mark b/test/integration/test-apt-mark new file mode 100755 index 000000000..69e0f933d --- /dev/null +++ b/test/integration/test-apt-mark @@ -0,0 +1,72 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertpackage 'unstable' 'bar' 'amd64,i386' '1' +insertpackage 'unstable' 'uninstalled' 'all' '1' +insertpackage 'unstable' 'uninstalled-native' 'amd64' '1' + +insertinstalledpackage 'foo' 'all' '1' +insertinstalledpackage 'bar' 'amd64' '1' + +setupaptarchive + +# dpkg is "installed" by our test framework +testdpkginstalled dpkg + +testnoautopkg() { + testempty aptmark showauto + testequal 'bar +dpkg +foo' aptmark showmanual + testequal 'bar +foo' aptmark showmanual bar foo uninstalled +} +testmarkonpkgasauto() { + testsuccess aptmark $1 foo + testequal 'foo' aptmark showauto + testequal 'foo' aptmark showauto foo + testequal 'bar +dpkg' aptmark showmanual + testequal 'bar' aptmark showmanual bar + + testsuccess aptmark $2 foo + testnoautopkg +} + +testequal 'E: No packages found' aptmark auto +testequal 'E: No packages found' aptmark manual + +testnoautopkg +testmarkonpkgasauto 'auto' 'manual' +testmarkonpkgasauto 'markauto' 'unmarkauto' + +testnoholdpkg() { + testempty aptmark showhold + testempty aptmark showholds # typical "typo" + testempty aptmark showhold dpkg + testempty aptmark showholds dpkg +} +testmarkonepkgashold() { + testsuccess aptmark hold $1 + testequal "$1" aptmark showhold + testequal "$1" aptmark showholds + testsuccess aptmark unhold $1 + testnoholdpkg +} + +testequal 'E: No packages found' aptmark hold +testequal 'E: No packages found' aptmark unhold + +testnoholdpkg +testmarkonepkgashold 'foo' +testmarkonepkgashold 'bar' +testmarkonepkgashold 'uninstalled' +testmarkonepkgashold 'uninstalled-native' + +testequal 'uninstalled set on hold.' aptmark hold uninstalled +testequal 'uninstalled-native set on hold.' aptmark hold uninstalled-native -- cgit v1.2.3 From 546dbfc82ad9ff0308b365bca3731a1118b1d251 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 9 Nov 2014 21:26:20 +0100 Subject: disable the lock disabling in the tests We create our own directories here and work without root in them, so we can also test the locking with them as it is how we usually operate. Git-Dch: Ignore --- test/integration/framework | 3 +-- test/integration/test-apt-get-update-unauth-warning | 5 +++-- test/integration/test-apt-update-transactions | 1 + test/integration/test-ubuntu-bug-346386-apt-get-update-paywall | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 0da9e2aab..d28085ee4 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -236,7 +236,6 @@ setupenvironment() { echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf - echo "Debug::NoLocking \"true\";" >> aptconfig.conf echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf # store apt-key were we can access it, even if we run it as a different user @@ -1412,7 +1411,7 @@ aptautotest() { aptautotest_aptget_update() { if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi # all copied files are properly chmodded - for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f); do + for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f ! -name 'lock'); do testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:644" done } diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index 0389415c1..80c51152d 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -27,8 +27,9 @@ W: The repository 'file: unstable Release' does not have a Release file. This is E: Use --allow-insecure-repositories to force the update" aptget update --no-allow-insecure-repositories # no package foo -testequal "Listing..." apt list foo -testequal "partial" ls rootdir/var/lib/apt/lists +testequal 'Listing...' apt list foo +testequal 'lock +partial' ls rootdir/var/lib/apt/lists # allow override testequal "Ign file: unstable InRelease diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index fe352c762..bf425a22e 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -49,6 +49,7 @@ testsetup() { msgmsg 'Test with no initial data over' "$1" rm -rf rootdir/var/lib/apt/lists mkdir -m 700 -p rootdir/var/lib/apt/lists/partial + touch rootdir/var/lib/apt/lists/lock if [ "$(id -u)" = '0' ]; then chown _apt:root rootdir/var/lib/apt/lists/partial fi diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall index df2c69cf6..ea516fc12 100755 --- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -40,7 +40,8 @@ msgtest 'Got expected failure message' 'apt-get update' aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 -testequal 'partial' ls $LISTS +testequal 'lock +partial' ls $LISTS # and again with pre-existing files with "valid data" which should remain for f in Release Release.gpg main_binary-amd64_Packages main_source_Sources; do -- cgit v1.2.3 From 3f439e2b7126fb82952cd7bc12b8d6cb01352219 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 18 Aug 2013 23:17:05 +0200 Subject: add a simple container for HashStrings APT supports more than just one HashString and even allows to enforce the usage of a specific hash. This class is intended to help with storage and passing around of the HashStrings. The cherry-pick here the un-const-ification of HashType() compared to f4c3850ea335545e297504941dc8c7a8f1c83358. The point of this commit is adding infrastructure for the next one. All by itself, it just adds new symbols. Git-Dch: Ignore --- test/libapt/hashsums_test.cc | 64 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index c06d85e03..ac7d41582 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -207,16 +207,56 @@ TEST(HashSumsTest, FileBased) } fd.Close(); - { - HashString sha2("SHA256", sha256.Value()); - EXPECT_TRUE(sha2.VerifyFile(__FILE__)); - } - { - HashString sha2("SHA512", sha512.Value()); - EXPECT_TRUE(sha2.VerifyFile(__FILE__)); - } - { - HashString sha2("SHA256:" + sha256.Value()); - EXPECT_TRUE(sha2.VerifyFile(__FILE__)); - } + HashString sha2file("SHA512", sha512.Value()); + EXPECT_TRUE(sha2file.VerifyFile(__FILE__)); + HashString sha2wrong("SHA512", "00000000000"); + EXPECT_FALSE(sha2wrong.VerifyFile(__FILE__)); + EXPECT_EQ(sha2file, sha2file); + EXPECT_TRUE(sha2file == sha2file); + EXPECT_NE(sha2file, sha2wrong); + EXPECT_TRUE(sha2file != sha2wrong); + + HashString sha2big("SHA256", sha256.Value()); + EXPECT_TRUE(sha2big.VerifyFile(__FILE__)); + HashString sha2small("sha256:" + sha256.Value()); + EXPECT_TRUE(sha2small.VerifyFile(__FILE__)); + EXPECT_EQ(sha2big, sha2small); + EXPECT_TRUE(sha2big == sha2small); + EXPECT_FALSE(sha2big != sha2small); + + HashStringList hashes; + EXPECT_TRUE(hashes.empty()); + EXPECT_TRUE(hashes.push_back(sha2file)); + EXPECT_FALSE(hashes.empty()); + EXPECT_EQ(1, hashes.size()); + + HashStringList wrong; + EXPECT_TRUE(wrong.push_back(sha2wrong)); + EXPECT_NE(wrong, hashes); + EXPECT_FALSE(wrong == hashes); + EXPECT_TRUE(wrong != hashes); + + HashStringList similar; + EXPECT_TRUE(similar.push_back(sha2big)); + EXPECT_NE(similar, hashes); + EXPECT_FALSE(similar == hashes); + EXPECT_TRUE(similar != hashes); + + EXPECT_TRUE(hashes.push_back(sha2big)); + EXPECT_EQ(2, hashes.size()); + EXPECT_TRUE(hashes.push_back(sha2small)); + EXPECT_EQ(2, hashes.size()); + EXPECT_FALSE(hashes.push_back(sha2wrong)); + EXPECT_EQ(2, hashes.size()); + EXPECT_TRUE(hashes.VerifyFile(__FILE__)); + + EXPECT_EQ(similar, hashes); + EXPECT_TRUE(similar == hashes); + EXPECT_FALSE(similar != hashes); + similar.clear(); + EXPECT_TRUE(similar.empty()); + EXPECT_EQ(0, similar.size()); + EXPECT_NE(similar, hashes); + EXPECT_FALSE(similar == hashes); + EXPECT_TRUE(similar != hashes); } -- cgit v1.2.3 From 3a2b39ee602dd5a98b8fdaee2f1c8e0b13a276e2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 18 Aug 2013 23:27:24 +0200 Subject: use 'best' hash for source authentication Collect all hashes we can get from the source record and put them into a HashStringList so that 'apt-get source' can use it instead of using always the MD5sum. We therefore also deprecate the MD5 struct member in favor of the list. While at it, the parsing of the Files is enhanced so that records which miss "Files" (aka MD5 checksums) are still searched for other checksums as they include just as much data, just not with a nice and catchy name. This is a cherry-pick of 1262d35 with some dirty tricks to preserve ABI. LP: 1098738 --- .../test-ubuntu-bug-1098738-apt-get-source-md5sum | 260 +++++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100755 test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum (limited to 'test') diff --git a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum new file mode 100755 index 000000000..9bdc81264 --- /dev/null +++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum @@ -0,0 +1,260 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'native' + +cat > aptarchive/Sources < +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.tar.gz + +Package: pkg-sha256-ok +Binary: pkg-sha256-ok +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.tar.gz + +Package: pkg-sha256-bad +Binary: pkg-sha256-bad +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.tar.gz +Checksums-Sha256: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-sha256-bad_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-sha256-bad_1.0.tar.gz + +Package: pkg-no-md5 +Binary: pkg-no-md5 +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-no-md5_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-no-md5_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-no-md5_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-no-md5_1.0.tar.gz + +Package: pkg-mixed-ok +Binary: pkg-mixed-ok +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-mixed-ok_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-mixed-ok_1.0.dsc + +Package: pkg-mixed-sha1-bad +Binary: pkg-mixed-sha1-bad +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Checksums-Sha1: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-mixed-sha1-bad_1.0.dsc +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-mixed-sha1-bad_1.0.tar.gz + +Package: pkg-mixed-sha2-bad +Binary: pkg-mixed-sha2-bad +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-mixed-sha2-bad_1.0.dsc +Checksums-Sha256: + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-mixed-sha2-bad_1.0.tar.gz + +Package: pkg-md5-disagree +Binary: pkg-md5-disagree +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-disagree_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-disagree_1.0.tar.gz + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-md5-disagree_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-md5-disagree_1.0.tar.gz + +Package: pkg-md5-agree +Binary: pkg-md5-agree +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.tar.gz + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.tar.gz + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-agree_1.0.dsc + +Package: pkg-sha256-disagree +Binary: pkg-sha256-disagree +Version: 1.0 +Maintainer: Joe Sixpack +Architecture: all +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-disagree_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-disagree_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-disagree_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-disagree_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-disagree_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-disagree_1.0.tar.gz + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 0 pkg-sha256-disagree_1.0.dsc + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 pkg-sha256-disagree_1.0.tar.gz +EOF + +# create fetchable files +for x in 'pkg-md5-ok' 'pkg-sha256-ok' 'pkg-sha256-bad' 'pkg-no-md5' \ + 'pkg-mixed-ok' 'pkg-mixed-sha1-bad' 'pkg-mixed-sha2-bad' \ + 'pkg-md5-agree' 'pkg-md5-disagree' 'pkg-sha256-disagree'; do + touch aptarchive/${x}_1.0.dsc aptarchive/${x}_1.0.tar.gz +done + +setupaptarchive +changetowebserver +testsuccess aptget update + +testok() { + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) +Get:2 http://localhost:8080/ $1 1.0 (tar) +Download complete and in download only mode" aptget source -d "$@" + msgtest 'Files were successfully downloaded for' "$1" + testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz +} + +testkeep() { + touch ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Skipping already downloaded file '${1}_1.0.dsc' +Skipping already downloaded file '${1}_1.0.tar.gz' +Need to get 0 B of source archives. +Download complete and in download only mode" aptget source -d "$@" + msgtest 'Files already downloaded are kept for' "$1" + testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz +} + +testmismatch() { + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) +Get:2 http://localhost:8080/ $1 1.0 (tar) +E: Failed to fetch http://localhost:8080/${1}_1.0.dsc Hash Sum mismatch + +E: Failed to fetch http://localhost:8080/${1}_1.0.tar.gz Hash Sum mismatch + +E: Failed to fetch some archives." aptget source -d "$@" + msgtest 'Files were not download as they have hashsum mismatches for' "$1" + testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz + + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Skipping download of file 'pkg-sha256-bad_1.0.dsc' as requested hashsum is not available for authentication +Skipping download of file 'pkg-sha256-bad_1.0.tar.gz' as requested hashsum is not available for authentication +Need to get 0 B of source archives. +Download complete and in download only mode" aptget source -d "$@" -o Acquire::ForceHash=ROT26 + msgtest 'Files were not download as hash is unavailable for' "$1" + testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz + + rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz + testequal "Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ $1 1.0 (dsc) +Get:2 http://localhost:8080/ $1 1.0 (tar) +Download complete and in download only mode" aptget source --allow-unauthenticated -d "$@" -o Acquire::ForceHash=ROT26 + msgtest 'Files were downloaded unauthenticated as user allowed it' "$1" + testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz +} + +testok pkg-md5-ok +testkeep pkg-md5-ok +testok pkg-sha256-ok +testkeep pkg-sha256-ok + +# pkg-sha256-bad has a bad SHA sum, but good MD5 sum. If apt is +# checking the best available hash (as it should), this will trigger +# a hash mismatch. +testmismatch pkg-sha256-bad +testmismatch pkg-sha256-bad +testok pkg-sha256-bad -o Acquire::ForceHash=MD5Sum + +# not having MD5 sum doesn't mean the file doesn't exist at all … +testok pkg-no-md5 +testok pkg-no-md5 -o Acquire::ForceHash=SHA256 +testequal "Reading package lists... +Building dependency tree... +Skipping download of file 'pkg-no-md5_1.0.dsc' as requested hashsum is not available for authentication +Skipping download of file 'pkg-no-md5_1.0.tar.gz' as requested hashsum is not available for authentication +Need to get 0 B of source archives. +Download complete and in download only mode" aptget source -d pkg-no-md5 -o Acquire::ForceHash=MD5Sum +msgtest 'Files were not download as MD5 is not available for this package' 'pkg-no-md5' +testfailure --nomsg test -e pkg-no-md5_1.0.dsc -a -e pkg-no-md5_1.0.tar.gz + +# deal with cases in which we haven't for all files the same checksum type +# mostly pathologic as this shouldn't happen, but just to be sure +testok pkg-mixed-ok +testequal 'Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (tar) +Get:2 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (dsc) +E: Failed to fetch http://localhost:8080/pkg-mixed-sha1-bad_1.0.dsc Hash Sum mismatch + +E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha1-bad +msgtest 'Only tar file is downloaded as the dsc has hashsum mismatch' 'pkg-mixed-sha1-bad' +testsuccess --nomsg test ! -e pkg-mixed-sha1-bad_1.0.dsc -a -e pkg-mixed-sha1-bad_1.0.tar.gz +testequal 'Reading package lists... +Building dependency tree... +Need to get 0 B of source archives. +Get:1 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (tar) +Get:2 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (dsc) +E: Failed to fetch http://localhost:8080/pkg-mixed-sha2-bad_1.0.tar.gz Hash Sum mismatch + +E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha2-bad +msgtest 'Only dsc file is downloaded as the tar has hashsum mismatch' 'pkg-mixed-sha2-bad' +testsuccess --nomsg test -e pkg-mixed-sha2-bad_1.0.dsc -a ! -e pkg-mixed-sha2-bad_1.0.tar.gz + +# it gets even more pathologic: multiple entries for one file, some even disagreeing! +testok pkg-md5-agree +testequal 'Reading package lists... +Building dependency tree... +E: Error parsing checksum in Files of source package pkg-md5-disagree' aptget source -d pkg-md5-disagree +testequal 'Reading package lists... +Building dependency tree... +E: Error parsing checksum in Checksums-SHA256 of source package pkg-sha256-disagree' aptget source -d pkg-sha256-disagree -- cgit v1.2.3 From c505fa33a6441b451971ce6c636cf2ca4dacdc1d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 28 Sep 2014 01:25:21 +0200 Subject: allow options between command and -- on commandline This used to work before we implemented a stricter commandline parser and e.g. the dd-schroot-cmd command constructs commandlines like this. Reported-By: Helmut Grohne --- test/libapt/commandline_test.cc | 68 +++++++++++++++++++++++++++++++++++++++++ test/libapt/makefile | 4 +-- 2 files changed, 70 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc index e403a28c8..627f1b486 100644 --- a/test/libapt/commandline_test.cc +++ b/test/libapt/commandline_test.cc @@ -2,6 +2,7 @@ #include #include +#include #include @@ -85,3 +86,70 @@ TEST(CommandLineTest, BoolParsing) } } + +bool DoVoid(CommandLine &) { return false; } + +TEST(CommandLineTest,GetCommand) +{ + CommandLine::Dispatch Cmds[] = { {"install",&DoVoid}, {"remove", &DoVoid}, {0,0} }; + { + char const * argv[] = { "apt-get", "-t", "unstable", "remove", "-d", "foo" }; + char const * com = CommandLine::GetCommand(Cmds, sizeof(argv)/sizeof(argv[0]), argv); + EXPECT_STREQ("remove", com); + std::vector Args = getCommandArgs("apt-get", com); + ::Configuration c; + CommandLine CmdL(Args.data(), &c); + ASSERT_TRUE(CmdL.Parse(sizeof(argv)/sizeof(argv[0]), argv)); + EXPECT_EQ(c.Find("APT::Default-Release"), "unstable"); + EXPECT_TRUE(c.FindB("APT::Get::Download-Only")); + ASSERT_EQ(2, CmdL.FileSize()); + EXPECT_EQ(std::string(CmdL.FileList[0]), "remove"); + EXPECT_EQ(std::string(CmdL.FileList[1]), "foo"); + } + { + char const * argv[] = {"apt-get", "-t", "unstable", "remove", "--", "-d", "foo" }; + char const * com = CommandLine::GetCommand(Cmds, sizeof(argv)/sizeof(argv[0]), argv); + EXPECT_STREQ("remove", com); + std::vector Args = getCommandArgs("apt-get", com); + ::Configuration c; + CommandLine CmdL(Args.data(), &c); + ASSERT_TRUE(CmdL.Parse(sizeof(argv)/sizeof(argv[0]), argv)); + EXPECT_EQ(c.Find("APT::Default-Release"), "unstable"); + EXPECT_FALSE(c.FindB("APT::Get::Download-Only")); + ASSERT_EQ(3, CmdL.FileSize()); + EXPECT_EQ(std::string(CmdL.FileList[0]), "remove"); + EXPECT_EQ(std::string(CmdL.FileList[1]), "-d"); + EXPECT_EQ(std::string(CmdL.FileList[2]), "foo"); + } + { + char const * argv[] = {"apt-get", "-t", "unstable", "--", "remove", "-d", "foo" }; + char const * com = CommandLine::GetCommand(Cmds, sizeof(argv)/sizeof(argv[0]), argv); + EXPECT_STREQ("remove", com); + std::vector Args = getCommandArgs("apt-get", com); + ::Configuration c; + CommandLine CmdL(Args.data(), &c); + ASSERT_TRUE(CmdL.Parse(sizeof(argv)/sizeof(argv[0]), argv)); + EXPECT_EQ(c.Find("APT::Default-Release"), "unstable"); + EXPECT_FALSE(c.FindB("APT::Get::Download-Only")); + ASSERT_EQ(CmdL.FileSize(), 3); + EXPECT_EQ(std::string(CmdL.FileList[0]), "remove"); + EXPECT_EQ(std::string(CmdL.FileList[1]), "-d"); + EXPECT_EQ(std::string(CmdL.FileList[2]), "foo"); + } + { + char const * argv[] = {"apt-get", "install", "-t", "unstable", "--", "remove", "-d", "foo" }; + char const * com = CommandLine::GetCommand(Cmds, sizeof(argv)/sizeof(argv[0]), argv); + EXPECT_STREQ("install", com); + std::vector Args = getCommandArgs("apt-get", com); + ::Configuration c; + CommandLine CmdL(Args.data(), &c); + ASSERT_TRUE(CmdL.Parse(sizeof(argv)/sizeof(argv[0]), argv)); + EXPECT_EQ(c.Find("APT::Default-Release"), "unstable"); + EXPECT_FALSE(c.FindB("APT::Get::Download-Only")); + ASSERT_EQ(CmdL.FileSize(), 4); + EXPECT_EQ(std::string(CmdL.FileList[0]), "install"); + EXPECT_EQ(std::string(CmdL.FileList[1]), "remove"); + EXPECT_EQ(std::string(CmdL.FileList[2]), "-d"); + EXPECT_EQ(std::string(CmdL.FileList[3]), "foo"); + } +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 69a13fd92..7f23ace46 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -14,8 +14,8 @@ test: $(BIN)/gtest$(BASENAME) $(BIN)/gtest$(BASENAME): $(LIB)/gtest.a PROGRAM = gtest${BASENAME} -SLIBS = -lapt-pkg -pthread $(LIB)/gtest.a -LIB_MAKES = apt-pkg/makefile +SLIBS = -lapt-pkg -lapt-private -pthread $(LIB)/gtest.a +LIB_MAKES = apt-pkg/makefile apt-private/makefile SOURCE = gtest_runner.cc $(wildcard *-helpers.cc *_test.cc) include $(PROGRAM_H) -- cgit v1.2.3 From 8cc3535f2cdcfe1301b641dae8dfadf99658c732 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 18 Oct 2014 14:44:41 +0200 Subject: reenable support for -s (and co) in apt-get source The conversion to accept only relevant options for commands has forgotten another one, so adding it again even through the usecase might very well be equally good served by --print-uris. Closes: 742578 --- test/integration/test-apt-get-source | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source index 33bd980d0..b27cbbe96 100755 --- a/test/integration/test-apt-get-source +++ b/test/integration/test-apt-get-source @@ -82,3 +82,7 @@ testequal "$HEADER Need to get 0 B of source archives. 'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris -t unstable foo=0.0.1 + +testequal "$HEADER +Need to get 0 B of source archives. +Fetch source foo" aptget source -q -s foo -- cgit v1.2.3 From 081c9d442a6d39fb9bc419fe3ce697cc791cb844 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 9 Nov 2014 21:38:53 +0100 Subject: various small additional tests and testcases Usually they don't provide a lot in terms of what they test, but they help in covering many lines from strictly anecdotal commands (stats, moo) and error messages, so that stuff which really needs to be tested, but isn't is better visible in coverage reports. Git-Dch: Ignore --- test/integration/framework | 2 +- test/integration/test-00-commands-have-help | 11 ++ test/integration/test-apt-cache | 124 +++++++++++++++++++++ test/integration/test-apt-cli-search | 3 + test/integration/test-apt-cli-show | 11 ++ test/integration/test-apt-cli-update | 7 ++ test/integration/test-apt-config | 36 ++++++ test/integration/test-apt-helper | 12 +- test/integration/test-apt-mark | 34 ++++-- test/integration/test-apt-update-stale | 6 +- .../test-external-dependency-solver-protocol | 32 +++++- 11 files changed, 261 insertions(+), 17 deletions(-) create mode 100755 test/integration/test-apt-cache create mode 100755 test/integration/test-apt-config (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index d28085ee4..c9f62c141 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -300,7 +300,7 @@ getarchitecture() { } getarchitectures() { - echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" + aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' } getarchitecturesfromcommalist() { diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help index ebf8b8cfa..bbd1475eb 100755 --- a/test/integration/test-00-commands-have-help +++ b/test/integration/test-00-commands-have-help @@ -50,3 +50,14 @@ done for CMD in 'apt-dump-solver' 'apt-internal-solver'; do checkoptions "$(echo "$CMD" | tr -d '-')" done + +# in times of need, we all look for super cow to save the day +testsuccess aptget moo +testsuccess aptget moo -q=2 +testsuccess aptget moo moo +testsuccess aptget moo moo -q=2 +testsuccess aptget moo moo --color +testsuccess aptget moo moo moo +testsuccess aptget moo moo moo -q=2 +testsuccess aptget moo moo moo moo +testsuccess aptget moo moo moo moo -q=2 diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache new file mode 100755 index 000000000..f47c0e08b --- /dev/null +++ b/test/integration/test-apt-cache @@ -0,0 +1,124 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' 'i386' + +DESCR='Some description + That has multiple lines' +insertpackage 'unstable' 'fancy' 'all' '1' +insertpackage 'unstable,installed' 'foo' 'all' '1' 'Depends: bar +Conflicts: foobar +Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR" +insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar +Breaks: foo (<< 1) +Replaces: foo (<< 1)' "$DESCR" + +setupaptarchive + +# dpkg is installed by our framework +testdpkginstalled 'dpkg' +testempty aptcache unmet dpkg + +# FIXME: Find some usecase for unmet as it seems kinda useless/broken +#testsuccess aptcache unmet +#testsuccess aptcache unmet foo + +# not too useful to test, but makes coverage green… +testsuccess aptcache stats +cp rootdir/tmp/testsuccess.output stats.output +testsuccess test -s stats.output +testsuccess aptcache xvcg foo +cp rootdir/tmp/testsuccess.output xvcg.output +testsuccess test -s xvcg.output +testsuccess aptcache dotty foo +cp rootdir/tmp/testsuccess.output dotty.output +testsuccess test -s dotty.output +# for this, even the sourcecode says it is useless (expect debugging) +testsuccess aptcache dump +cp rootdir/tmp/testsuccess.output dump.output +testsuccess test -s dump.output + +testequal 'dpkg +bar +fancy +foo' aptcache pkgnames +testequal 'bar' aptcache pkgnames bar +testequal 'fancy +foo' aptcache pkgnames f + +testequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo + +### depends + +testequal 'foo + Depends: bar + |Recommends: + Recommends: + Conflicts: + Conflicts: ' aptcache depends foo +testequal 'foo + Depends: bar + Recommends: + Conflicts: + Conflicts: ' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 +testequal 'foo + Depends: bar + |Recommends: (>= 2) + Recommends: (<< 5) + Conflicts: + Conflicts: ' aptcache depends foo -o APT::Cache::ShowVersion=1 +testequal 'foo + Depends: bar + Conflicts: + Conflicts: ' aptcache depends foo --no-recommends +testequal 'foo + Depends: bar' aptcache depends foo --important +testequal 'foo + Conflicts: + Conflicts: ' aptcache depends foo --important --no-depends --conflicts +testequal 'foo + Depends: bar + |Recommends: + Recommends: + Conflicts: + Conflicts: +bar + Depends: bar + Breaks: foo + Breaks: + Replaces: foo + Replaces: + + + + +' aptcache depends foo --recurse +testequal 'foo + Depends: bar +bar + Depends: bar + Replaces: foo + Replaces: +' aptcache depends foo --recurse --important --replaces + +## rdpends + +testequal 'foo +Reverse Depends: + bar + bar' aptcache rdepends foo +testequal 'foo +Reverse Depends: + Replaces: bar + Breaks: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 +testequal 'foo +Reverse Depends: + Replaces: bar (<< 1) + Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 +testequal 'foo +Reverse Depends: + Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search index 8f009d57c..1a28ba4da 100755 --- a/test/integration/test-apt-cli-search +++ b/test/integration/test-apt-cli-search @@ -25,6 +25,9 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) +testequal 'E: You must give at least one search pattern' aptcache search +testequal 'E: You must give at least one search pattern' apt search + # with OP progress testequal "Sorting... Full Text Search... diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index 4c8e134d6..930e591e0 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -36,3 +36,14 @@ APT-Sources: file:$APTARCHIVE/ unstable/main i386 Packages Description: Some description That has multiple lines " apt show foo + +# this is the default, but disabled by the testcases +testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0 +cp rootdir/tmp/testsuccess.output aptshow.output +testsuccess grep '^WARNING: ' aptshow.output + +if [ "$(id -u)" != '0' ]; then + testsuccess apt install foo -s -o APT::Get::Show-User-Simulation-Note=1 + cp rootdir/tmp/testsuccess.output aptshow.output + testsuccess grep '^NOTE: ' aptshow.output +fi diff --git a/test/integration/test-apt-cli-update b/test/integration/test-apt-cli-update index 987bb9adb..83cc94b93 100755 --- a/test/integration/test-apt-cli-update +++ b/test/integration/test-apt-cli-update @@ -8,10 +8,17 @@ setupenvironment configarchitecture "i386" insertpackage 'unstable' 'foo' 'all' '2.0' +cp rootdir/var/lib/dpkg/status dpkg.status insertinstalledpackage 'foo' 'all' '1.0' setupaptarchive --no-update APTARCHIVE=$(readlink -f ./aptarchive) +testequal 'E: The update command takes no arguments' apt update -q arguments + testequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q + +cp dpkg.status rootdir/var/lib/dpkg/status +insertinstalledpackage 'foo' 'all' '2.0' +testequal 'All packages are up to date.' apt update -q diff --git a/test/integration/test-apt-config b/test/integration/test-apt-config new file mode 100755 index 000000000..2f2ff9d38 --- /dev/null +++ b/test/integration/test-apt-config @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +testsuccess aptconfig dump +testequal 'APT::Architecture "amd64";' aptconfig dump APT::Architecture +testempty aptconfig dump config::which::does::not::exist + +testequal 'APT::Architectures ""; +APT::Architectures:: "amd64";' aptconfig dump APT::Architectures +testequal 'APT::Architectures:: "amd64";' aptconfig dump --no-empty APT::Architectures +testequal 'amd64' aptconfig dump --no-empty --format='%v%n' APT::Architectures + +testempty aptconfig shell +testequal 'E: Arguments not in pairs' aptconfig shell APT::Architecture +testempty aptconfig shell APT::Architecture ARCH # incorrect order +testequal "ARCH='amd64'" aptconfig shell ARCH APT::Architecture + +ROOTDIR="$(readlink -f rootdir)" +testequal "CONFIG='apt.conf'" aptconfig shell CONFIG Dir::Etc::main +testequal "CONFIG='${ROOTDIR}/etc/apt/apt.conf'" aptconfig shell CONFIG Dir::Etc::main/f +testequal "CONFIG='etc/apt/'" aptconfig shell CONFIG Dir::Etc +testequal "CONFIG='${ROOTDIR}/etc/apt/'" aptconfig shell CONFIG Dir::Etc/ # old style +testequal "CONFIG='${ROOTDIR}/etc/apt/'" aptconfig shell CONFIG Dir::Etc/d + +testempty aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles +export DEB_BUILD_PROFILES='nodoc stage1' +testequal 'nodoc +stage1' aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles +unset DEB_BUILD_PROFILES +testempty aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index 06e497ff7..3c1d393a6 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -53,7 +53,7 @@ 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 - + testequal "Using proxy 'http://some-proxy' for URL 'http://www.example.com/'" apthelper auto-detect-proxy http://www.example.com @@ -64,13 +64,15 @@ 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 - - testequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com - - + testequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com } test_apt_helper_download test_apt_helper_detect_proxy +# test failure modes +testequal 'E: Invalid operation download' apthelper download +testequal 'E: Must specify at least one pair url/filename' apthelper download-file +testequal 'E: Must specify at least one pair url/filename' apthelper download-file http://example.org/ +testequal 'E: Need one URL as argument' apthelper auto-detect-proxy diff --git a/test/integration/test-apt-mark b/test/integration/test-apt-mark index 69e0f933d..0f62a12b4 100755 --- a/test/integration/test-apt-mark +++ b/test/integration/test-apt-mark @@ -20,21 +20,31 @@ testdpkginstalled dpkg testnoautopkg() { testempty aptmark showauto + testempty aptcache showauto testequal 'bar dpkg foo' aptmark showmanual testequal 'bar foo' aptmark showmanual bar foo uninstalled } -testmarkonpkgasauto() { - testsuccess aptmark $1 foo +testfooisauto() { testequal 'foo' aptmark showauto + testequal 'foo' aptcache showauto testequal 'foo' aptmark showauto foo + testequal 'foo' aptcache showauto foo testequal 'bar dpkg' aptmark showmanual testequal 'bar' aptmark showmanual bar +} +testmarkonpkgasauto() { + testsuccess $1 $2 foo + testfooisauto + testsuccess $1 $2 foo + testfooisauto - testsuccess aptmark $2 foo + testsuccess $1 $3 foo + testnoautopkg + testsuccess $1 $3 foo testnoautopkg } @@ -42,8 +52,9 @@ testequal 'E: No packages found' aptmark auto testequal 'E: No packages found' aptmark manual testnoautopkg -testmarkonpkgasauto 'auto' 'manual' -testmarkonpkgasauto 'markauto' 'unmarkauto' +testmarkonpkgasauto 'aptmark' 'auto' 'manual' +testmarkonpkgasauto 'aptmark' 'markauto' 'unmarkauto' +testmarkonpkgasauto 'aptget' 'markauto' 'unmarkauto' testnoholdpkg() { testempty aptmark showhold @@ -51,10 +62,19 @@ testnoholdpkg() { testempty aptmark showhold dpkg testempty aptmark showholds dpkg } -testmarkonepkgashold() { - testsuccess aptmark hold $1 +testpkgonhold() { testequal "$1" aptmark showhold testequal "$1" aptmark showholds + testequal "$1" aptmark showhold $1 + testequal "$1" aptmark showholds $1 +} +testmarkonepkgashold() { + testsuccess aptmark hold $1 + testpkgonhold $1 + testsuccess aptmark hold $1 + testpkgonhold $1 + testsuccess aptmark unhold $1 + testnoholdpkg testsuccess aptmark unhold $1 testnoholdpkg } diff --git a/test/integration/test-apt-update-stale b/test/integration/test-apt-update-stale index 52f94591f..277aa5b09 100755 --- a/test/integration/test-apt-update-stale +++ b/test/integration/test-apt-update-stale @@ -14,9 +14,11 @@ configarchitecture "i386" insertpackage 'unstable' 'foo' 'all' '1.0' -setupaptarchive +setupaptarchive --no-update changetowebserver -aptget update -qq + +echo "Acquire::Languages \"none\";" > rootdir/etc/apt/apt.conf.d/00nolanguages +testsuccess aptget update listcurrentlistsdirectory > lists.before # insert new version diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol index 07d2441b6..fd68578c5 100755 --- a/test/integration/test-external-dependency-solver-protocol +++ b/test/integration/test-external-dependency-solver-protocol @@ -12,7 +12,10 @@ insertinstalledpackage 'stuff' 'all' '1' insertpackage 'unstable' 'cool' 'all' '2' 'Multi-Arch: foreign' insertpackage 'unstable' 'stuff' 'all' '2' 'Multi-Arch: foreign' insertpackage 'unstable' 'coolstuff' 'i386,amd64' '2' 'Depends: cool, stuff' -insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign' +insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign +Conflicts: badstuff' +insertpackage 'unstable' 'badstuff' 'all' '2' 'Multi-Arch: foreign +Conflicts: awesome' insertpackage 'unstable' 'awesomecoolstuff' 'i386' '2' 'Depends: coolstuff, awesome' insertpackage 'experimental' 'cool' 'all' '3' 'Multi-Arch: foreign' @@ -44,6 +47,14 @@ The following NEW packages will be installed: Inst coolstuff (3 experimental [amd64]) Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s +testequal 'Reading package lists... +Building dependency tree... +Execute external solver... +The following packages will be REMOVED: + cool* +0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded. +Purg cool [1]' aptget purge --solver apt cool -s + testsuccess aptget install awesomecoolstuff:i386 -s testsuccess aptget install --solver apt awesomecoolstuff:i386 -s @@ -57,9 +68,13 @@ testsuccess aptget dist-upgrade -s --solver apt testsuccess aptget upgrade -s testsuccess aptget upgrade -s --solver apt +testfailure aptget install awesome badstuff -s +testfailure aptget install awesome badstuff -s --solver apt +testsuccess grep 'ERR_UNSOLVABLE' rootdir/tmp/testfailure.output + configarchitecture 'armel' msgtest 'Test direct calling is okay for' 'apt-internal-solver' -cat /tmp/dump.edsp | aptinternalsolver > solver.result 2>&1 || true +cat /tmp/dump.edsp | aptinternalsolver -q=0 > solver.result 2>&1 || true if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then msgpass else @@ -69,3 +84,16 @@ fi rm -f /tmp/dump.edsp testfailure aptget install --solver apt awesomecoolstuff:i386 -s + +testsuccess aptinternalsolver scenario +testequal 'Package: stuff +Source: stuff +Architecture: all +Version: 1 +Installed: yes +APT-ID: 2 +Priority: optional +Section: other +APT-Pin: 100 +APT-Candidate: yes +' aptinternalsolver scenario stuff -- cgit v1.2.3 From 8fe964f148344b8a55252fe52b6292a4ab86ea98 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 14 Nov 2014 18:01:09 +0100 Subject: create our cache and lib directory always with mode 755 We autocreate for a while now the last two directories in /var/lib/apt/lists (similar for /var/cache/apt/archives) which is very nice for systems having any of those on tmpfs or other non-persistent storage. This also means though that this creation is effected by the default umask, so for people with aggressive umasks like 027 the directories will be created with 750, which means all non-root users are left out, which is usually exactly what we want then this umask is set, but the cache and lib directories contain public knowledge. There isn't any need to protect them from viewers and they render apt completely useless if not readable. --- test/integration/framework | 24 ++++++++++++++++++++++-- test/integration/test-apt-cdrom | 1 - test/integration/test-apt-update-transactions | 6 +----- 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index c9f62c141..191e205ce 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -203,7 +203,7 @@ setupenvironment() { mkdir rootdir aptarchive keys cd rootdir mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d - mkdir -p usr/bin var/cache var/lib/apt var/log tmp + mkdir -p usr/bin var/cache var/lib var/log tmp mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers touch var/lib/dpkg/available mkdir -p usr/lib/apt @@ -1341,7 +1341,7 @@ testfilestats() { msgpass else echo >&2 - ls -l >&2 "$1" + ls -ld >&2 "$1" echo -n >&2 "stat(1) reports for $2: " stat --format "$2" "$1" msgfail @@ -1386,6 +1386,24 @@ listcurrentlistsdirectory() { done } +### convinience hacks ### +mkdir() { + # creating some directories by hand is a tedious task, so make it look simple + if [ "$*" = '-p rootdir/var/lib/apt/lists' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" ] || + [ "$*" = '-p rootdir/var/lib/apt/lists/partial' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" ]; then + # only the last directory created by mkdir is effected by the -m ! + command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" + command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" + command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" + touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" + if [ "$(id -u)" = '0' ]; then + chown _apt:root "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" + fi + else + command mkdir "$@" + fi +} + ### The following tests are run by most test methods automatically to check ### general things about commands executed without writing the test every time. @@ -1410,6 +1428,8 @@ aptautotest() { aptautotest_aptget_update() { if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi + testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${USER}:${USER}:755" + testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${USER}:${USER}:755" # all copied files are properly chmodded for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f ! -name 'lock'); do testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:644" diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 3a33219fe..7da645e83 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -125,7 +125,6 @@ $CDROM_POST" aptcdromlog add msgtest 'Test for the german description translation of' 'testing' aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail rm -rf rootdir/var/lib/apt/lists -mkdir -p rootdir/var/lib/apt/lists/partial testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures $CDROM_POST" aptcdromlog add diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index bf425a22e..b325733ac 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -48,11 +48,7 @@ testrun() { testsetup() { msgmsg 'Test with no initial data over' "$1" rm -rf rootdir/var/lib/apt/lists - mkdir -m 700 -p rootdir/var/lib/apt/lists/partial - touch rootdir/var/lib/apt/lists/lock - if [ "$(id -u)" = '0' ]; then - chown _apt:root rootdir/var/lib/apt/lists/partial - fi + mkdir -p rootdir/var/lib/apt/lists/partial listcurrentlistsdirectory > listsdir.lst testrun 'listsdir.lst' -- cgit v1.2.3 From 4bb006d1ddcf1807474067dcbef9fb0bb5def0ac Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 17 Nov 2014 22:54:29 +0100 Subject: fix file ownership tests to work on kfreebsd While on linux files are created in /tmp with $USER:$USER, on my kfreebsd testmachine they are created with $USER:root, so we pull some strings here to make it work on both. --- test/integration/framework | 14 +++++++++++--- test/integration/test-apt-cdrom | 2 +- test/integration/test-apt-get-changelog | 4 ++-- test/integration/test-apt-get-source-authenticated | 1 - test/integration/test-authentication-basic | 4 ++-- 5 files changed, 16 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 191e205ce..51c7b8cae 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -272,6 +272,14 @@ setupenvironment() { echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary configcompression '.' 'gz' #'bz2' 'lzma' 'xz' + # create some files in /tmp and look at user/group to get what this means + TEST_DEFAULT_USER="$USER" + if [ "$(uname)" = 'GNU/kFreeBSD' ]; then + TEST_DEFAULT_GROUP='root' + else + TEST_DEFAULT_GROUP="$USER" + fi + # Acquire::AllowInsecureRepositories=false is not yet the default # but we want it to be the default soon configallowinsecurerepositories "false"; @@ -1428,11 +1436,11 @@ aptautotest() { aptautotest_aptget_update() { if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi - testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${USER}:${USER}:755" - testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${USER}:${USER}:755" + testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" + testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" # all copied files are properly chmodded for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f ! -name 'lock'); do - testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:644" + testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" done } aptautotest_apt_update() { aptautotest_aptget_update "$@"; } diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 7da645e83..7f4b3c257 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -146,5 +146,5 @@ testcdromusage msgmsg 'Check that nothing touched our' 'CD-ROM' for file in $(find rootdir/media/cdrom-unmounted/dists); do - testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:555" + testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555" done diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 648dccf40..01f2bd393 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -33,7 +33,7 @@ testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/apt_ testsuccess aptget changelog apt -d testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0/changelog)" -testfilestats 'apt.changelog' '%U:%G:%a' '=' "${USER}:${USER}:644" +testfilestats 'apt.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" rm -f apt.changelog ../aptarchive/pool/apt_1.0/changelog testequal "$(cat ../aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ @@ -41,7 +41,7 @@ testequal "$(cat ../aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ testsuccess aptget changelog apt -d testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0.changelog)" -testfilestats 'apt.changelog' '%U:%G:%a' '=' "${USER}:${USER}:644" +testfilestats 'apt.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" rm -f apt.changelog ../aptarchive/pool/apt_1.0.changelog testequal 'E: changelog download failed' aptget changelog apt -qq -d -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated index f68c32386..685bc566b 100755 --- a/test/integration/test-apt-get-source-authenticated +++ b/test/integration/test-apt-get-source-authenticated @@ -31,4 +31,3 @@ testfailure test -e foo_2.0.dsc # allow overriding the warning testsuccess aptget source --allow-unauthenticated foo -o Debug::pkgAcquire::Worker=1 testsuccess test -s foo_2.0.dsc -a -L foo_2.0.dsc -testaccessrights 'foo_2.0.dsc' '777' diff --git a/test/integration/test-authentication-basic b/test/integration/test-authentication-basic index 21b024970..7e74726be 100755 --- a/test/integration/test-authentication-basic +++ b/test/integration/test-authentication-basic @@ -24,7 +24,7 @@ testauthfailure() { testauthsuccess() { testsuccess apthelper download-file "${1}/bash" ./downloaded/bash testfileequal ./downloaded/bash "$(cat aptarchive/bash)" - testfilestats ./downloaded/bash '%U:%G:%a' '=' "${USER}:${USER}:644" + testfilestats ./downloaded/bash '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" rm -f ./downloaded/bash # lets see if got/retains acceptable permissions @@ -32,7 +32,7 @@ testauthsuccess() { if [ "$(id -u)" = '0' ]; then testfilestats "$AUTHCONF" '%U:%G:%a' '=' "_apt:root:600" else - testfilestats "$AUTHCONF" '%U:%G:%a' '=' "${USER}:${USER}:600" + testfilestats "$AUTHCONF" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:600" fi fi -- cgit v1.2.3 From 0c78757010a17173bdc79b818133697e7dcbf6a4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 17 Nov 2014 15:06:35 +0100 Subject: close leaking slave fd after setting up pty magic The fd moves out of scope here anyway, so we should close it properly instead of leaking it which will tickle down to dpkg maintainer scripts. Closes: 767774 --- test/integration/framework | 71 ++++++++++++++++++---- test/integration/test-failing-maintainer-scripts | 46 +------------- .../test-no-fds-leaked-to-maintainer-scripts | 40 ++++++++++++ 3 files changed, 99 insertions(+), 58 deletions(-) create mode 100755 test/integration/test-no-fds-leaked-to-maintainer-scripts (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 51c7b8cae..ff059f59e 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -358,6 +358,54 @@ configdpkg() { fi } +configdpkgnoopchroot() { + # create a library to noop chroot() and rewrite maintainer script executions + # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown + # chroot directory dpkg could chroot into to execute the maintainer scripts + msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' + cat << EOF > noopchroot.c +#define _GNU_SOURCE +#include +#include +#include +#include + +static char * chrootdir = NULL; + +int chroot(const char *path) { + printf("WARNING: CHROOTing to %s was ignored!\n", path); + free(chrootdir); + chrootdir = strdup(path); + return 0; +} +int execvp(const char *file, char *const argv[]) { + static int (*func_execvp) (const char *, char * const []) = NULL; + if (func_execvp == NULL) + func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); + if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) + return func_execvp(file, argv); + printf("REWRITE execvp call %s into %s\n", file, chrootdir); + char newfile[strlen(chrootdir) + strlen(file)]; + strcpy(newfile, chrootdir); + strcat(newfile, file); + return func_execvp(newfile, argv); +} +EOF + testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl + + mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" + DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" + echo "#!/bin/sh +if [ -n \"\$LD_PRELOAD\" ]; then + export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\" +else + export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\" +fi +dpkg \"\$@\"" > $DPKG + chmod +x $DPKG + sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf +} + configallowinsecurerepositories() { echo "Acquire::AllowInsecureRepositories \"$1\";" > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf @@ -480,7 +528,7 @@ buildsimplenativepackage() { fi local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION} - msgninfo "Build package ${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}… " + msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" mkdir -p $BUILDDIR/debian/source echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES echo "#!/bin/sh @@ -512,7 +560,10 @@ Package: $NAME" >> ${BUILDDIR}/debian/control echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control echo '3.0 (native)' > ${BUILDDIR}/debian/source/format - (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \ + cd ${BUILDDIR}/.. + testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} + cd - >/dev/null + sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output \ | while read SRC; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then @@ -524,6 +575,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control done for arch in $(getarchitecturesfromcommalist "$ARCH"); do + msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" rm -rf ${BUILDDIR}/debian/tmp mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} @@ -537,11 +589,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" # ensure the right permissions as dpkg-deb ensists chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN - if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then - cat $LOG - false - fi - rm $LOG + testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist done @@ -559,15 +607,13 @@ buildpackage() { local ARCH=$(getarchitecture $4) local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" - msgninfo "Build package ${PKGNAME} for ${RELEASE} in ${SECTION}… " + msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" cd $BUILDDIR if [ "$ARCH" = "all" ]; then ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" fi - if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then - cat $BUILDLOG - false - fi + testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH + cp ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output $BUILDLOG local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")" local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')" cd - > /dev/null @@ -577,7 +623,6 @@ buildpackage() { for SRC in $SRCS; do echo "pool/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist done - msgdone "info" } buildaptarchive() { diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts index 3dd7d643e..953506aa5 100755 --- a/test/integration/test-failing-maintainer-scripts +++ b/test/integration/test-failing-maintainer-scripts @@ -6,6 +6,7 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'native' +configdpkgnoopchroot # create a bunch of failures createfailure() { @@ -25,51 +26,6 @@ createfailure 'postrm' setupaptarchive -# create a library to noop chroot() and rewrite maintainer script executions -# via execvp() as used by dpkg as we don't want our rootdir to be a fullblown -# chroot directory dpkg could chroot into to execute the maintainer scripts -cat << EOF > noopchroot.c -#define _GNU_SOURCE -#include -#include -#include -#include - -static char * chrootdir = NULL; - -int chroot(const char *path) { - printf("WARNING: CHROOTing to %s was ignored!\n", path); - free(chrootdir); - chrootdir = strdup(path); - return 0; -} -int execvp(const char *file, char *const argv[]) { - static int (*func_execvp) (const char *, char * const []) = NULL; - if (func_execvp == NULL) - func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); - if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) - return func_execvp(file, argv); - printf("REWRITE execvp call %s into %s\n", file, chrootdir); - char newfile[strlen(chrootdir) + strlen(file)]; - strcpy(newfile, chrootdir); - strcat(newfile, file); - return func_execvp(newfile, argv); -} -EOF -testsuccess gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl - -mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" -DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" -echo "#!/bin/sh -if [ -n \"\$LD_PRELOAD\" ]; then - export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\" -else - export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\" -fi -dpkg \"\$@\"" > $DPKG -chmod +x $DPKG -sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf - # setup some pre- and post- invokes to check the output isn't garbled later APTHOOK="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apthook" echo '#!/bin/sh diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts new file mode 100755 index 000000000..6ed120090 --- /dev/null +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -0,0 +1,40 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'native' +configdpkgnoopchroot + +setupsimplenativepackage "fdleaks" 'native' '1.0' 'unstable' +BUILDDIR="incoming/fdleaks-1.0" +for script in 'preinst' 'postinst' 'prerm' 'postrm'; do + echo '#!/bin/sh +ls -l /proc/self/fd/' > ${BUILDDIR}/debian/$script +done +buildpackage "$BUILDDIR" 'unstable' 'main' 'native' +rm -rf "$BUILDDIR" + +setupaptarchive + +testsuccess aptget install -y fdleaks +msgtest 'Check if fds were not' 'leaked' +if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then + msgpass +else + echo + cat rootdir/tmp/testsuccess.output + msgfail +fi + +testsuccess aptget purge -y fdleaks +msgtest 'Check if fds were not' 'leaked' +if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then + msgpass +else + echo + cat rootdir/tmp/testsuccess.output + msgfail +fi -- cgit v1.2.3 From 150bdc9ca5d656f9fba94d37c5f4f183b02bd746 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 18 Nov 2014 00:59:39 +0100 Subject: fix PTY interaction on linux and kfreebsd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We run dpkg on its own pty, so we can log its output and have our own output around it (like the progress bar), while also allowing debconf and configfile prompts to happen. In commit 223ae57d468fdcac451209a095047a07a5698212 we changed to constantly reopening the slave for kfreebsd. This has the sideeffect though that in some cases slave and master will lose their connection on linux, so that no output is passed along anymore. We fix this by having always an fd referencing the slave open (linux), but we don't use it (kfreebsd). Failing to get our PTY up and running has many (bad) consequences including (not limited to, nor all at ones or in any case) garbled ouput, no output, no logging, a (partial) mixture of the previous items, … This commit is therefore also reshuffling quiet a bit of the creation code to get especially the output part up and running on linux and the logging for kfreebsd. Note that the testcase tries to cover some cases, but this is an interactivity issue so only interactive usage can really be a good test. Closes: 765687 --- .../test-no-fds-leaked-to-maintainer-scripts | 40 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 6ed120090..3c6457cab 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -8,7 +8,7 @@ setupenvironment configarchitecture 'native' configdpkgnoopchroot -setupsimplenativepackage "fdleaks" 'native' '1.0' 'unstable' +setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable' BUILDDIR="incoming/fdleaks-1.0" for script in 'preinst' 'postinst' 'prerm' 'postrm'; do echo '#!/bin/sh @@ -19,7 +19,8 @@ rm -rf "$BUILDDIR" setupaptarchive -testsuccess aptget install -y fdleaks +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +testsuccess aptget install -y fdleaks -qq < /dev/null msgtest 'Check if fds were not' 'leaked' if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then msgpass @@ -29,7 +30,23 @@ else msgfail fi -testsuccess aptget purge -y fdleaks +cp rootdir/tmp/testsuccess.output terminal.output +tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log +testfileequal 'terminal.log' "$(cat terminal.output)" + +testequal 'startup archives unpack +install fdleaks:all 1.0 +status half-installed fdleaks:all 1.0 +status unpacked fdleaks:all 1.0 +status unpacked fdleaks:all 1.0 +startup packages configure +configure fdleaks:all 1.0 +status unpacked fdleaks:all 1.0 +status half-configured fdleaks:all 1.0 +status installed fdleaks:all 1.0' cut -f 3- -d' ' rootdir/var/log/dpkg.log + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +testsuccess aptget purge -y fdleaks -qq msgtest 'Check if fds were not' 'leaked' if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then msgpass @@ -38,3 +55,20 @@ else cat rootdir/tmp/testsuccess.output msgfail fi +cp rootdir/tmp/testsuccess.output terminal.output +tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log +testfileequal 'terminal.log' "$(cat terminal.output)" + +testequal 'startup packages purge +status installed fdleaks:all 1.0 +remove fdleaks:all 1.0 +status half-configured fdleaks:all 1.0 +status half-installed fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +purge fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status not-installed fdleaks:all ' cut -f 3- -d' ' rootdir/var/log/dpkg.log -- cgit v1.2.3 From b8ef7ef414600109b931fc8eebb1dfafdfe390cd Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 18 Nov 2014 13:06:53 +0100 Subject: fix test to support non-multiarch dpkg versions On travis we work with a pre-multiarch version of dpkg, so the output is slightly different in regards to package names. Git-Dch: Ignore --- .../test-no-fds-leaked-to-maintainer-scripts | 51 ++++++++++++---------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'test') diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 3c6457cab..428db46ef 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -5,7 +5,7 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture 'native' +configarchitecture 'amd64' 'i386' configdpkgnoopchroot setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable' @@ -17,6 +17,11 @@ done buildpackage "$BUILDDIR" 'unstable' 'main' 'native' rm -rf "$BUILDDIR" +PKGNAME='fdleaks:all' +if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null; then + PKGNAME='fdleaks' +fi + setupaptarchive rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log @@ -34,16 +39,16 @@ cp rootdir/tmp/testsuccess.output terminal.output tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log testfileequal 'terminal.log' "$(cat terminal.output)" -testequal 'startup archives unpack -install fdleaks:all 1.0 -status half-installed fdleaks:all 1.0 -status unpacked fdleaks:all 1.0 -status unpacked fdleaks:all 1.0 +testequal "startup archives unpack +install $PKGNAME 1.0 +status half-installed $PKGNAME 1.0 +status unpacked $PKGNAME 1.0 +status unpacked $PKGNAME 1.0 startup packages configure -configure fdleaks:all 1.0 -status unpacked fdleaks:all 1.0 -status half-configured fdleaks:all 1.0 -status installed fdleaks:all 1.0' cut -f 3- -d' ' rootdir/var/log/dpkg.log +configure $PKGNAME 1.0 +status unpacked $PKGNAME 1.0 +status half-configured $PKGNAME 1.0 +status installed $PKGNAME 1.0" cut -f 3- -d' ' rootdir/var/log/dpkg.log rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess aptget purge -y fdleaks -qq @@ -59,16 +64,16 @@ cp rootdir/tmp/testsuccess.output terminal.output tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log testfileequal 'terminal.log' "$(cat terminal.output)" -testequal 'startup packages purge -status installed fdleaks:all 1.0 -remove fdleaks:all 1.0 -status half-configured fdleaks:all 1.0 -status half-installed fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -purge fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status not-installed fdleaks:all ' cut -f 3- -d' ' rootdir/var/log/dpkg.log +testequal "startup packages purge +status installed $PKGNAME 1.0 +remove $PKGNAME 1.0 +status half-configured $PKGNAME 1.0 +status half-installed $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +purge $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status not-installed $PKGNAME " cut -f 3- -d' ' rootdir/var/log/dpkg.log -- cgit v1.2.3 From 1d838084dc775c0a4184edb4f3b9138903ac27fb Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 18 Nov 2014 13:41:18 +0100 Subject: use dpkg --merge-avail only if needed in apt-mark Only "recent" versions of dpkg support stdin for merge instead of a file, so as a quick fix we delay calling it until we really need it which fixes most of the problem already. Checking for a specific dpkg version here is deemed too much work, just like using a temporary file here and depends a too high requirement for this minor usecase. After all, it didn't work at all before, so we break nobody here and can fix it if someone complains (with a patch). --- test/integration/test-apt-mark | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-mark b/test/integration/test-apt-mark index 0f62a12b4..5a3ae4b2f 100755 --- a/test/integration/test-apt-mark +++ b/test/integration/test-apt-mark @@ -85,6 +85,15 @@ testequal 'E: No packages found' aptmark unhold testnoholdpkg testmarkonepkgashold 'foo' testmarkonepkgashold 'bar' + +msgtest 'dpkg supports --merge-avail via' 'stdin' +if dpkg --merge-avail - < /dev/null >/dev/null 2>&1; then + msgpass +else + msgskip 'dpkg version too old' + exit 0 +fi + testmarkonepkgashold 'uninstalled' testmarkonepkgashold 'uninstalled-native' -- cgit v1.2.3 From 9fc0b435593839de47098212f0ae5f15b6263099 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 17 Nov 2014 15:06:35 +0100 Subject: close leaking slave fd after setting up pty magic The fd moves out of scope here anyway, so we should close it properly instead of leaking it which will tickle down to dpkg maintainer scripts. Closes: 767774 --- test/integration/framework | 78 ++++++++++++++++++---- test/integration/test-failing-maintainer-scripts | 46 +------------ .../test-no-fds-leaked-to-maintainer-scripts | 40 +++++++++++ 3 files changed, 105 insertions(+), 59 deletions(-) create mode 100755 test/integration/test-no-fds-leaked-to-maintainer-scripts (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 7923e23d9..df1942ff9 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -325,6 +325,59 @@ configdpkg() { fi } +configdpkgnoopchroot() { + # create a library to noop chroot() and rewrite maintainer script executions + # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown + # chroot directory dpkg could chroot into to execute the maintainer scripts + msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' + cat << EOF > noopchroot.c +#define _GNU_SOURCE +#include +#include +#include +#include + +static char * chrootdir = NULL; + +int chroot(const char *path) { + printf("WARNING: CHROOTing to %s was ignored!\n", path); + free(chrootdir); + chrootdir = strdup(path); + return 0; +} +int execvp(const char *file, char *const argv[]) { + static int (*func_execvp) (const char *, char * const []) = NULL; + if (func_execvp == NULL) + func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); + if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) + return func_execvp(file, argv); + printf("REWRITE execvp call %s into %s\n", file, chrootdir); + char newfile[strlen(chrootdir) + strlen(file)]; + strcpy(newfile, chrootdir); + strcat(newfile, file); + return func_execvp(newfile, argv); +} +EOF + testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl + + mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" + DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" + echo "#!/bin/sh +if [ -n \"\$LD_PRELOAD\" ]; then + export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\" +else + export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\" +fi +dpkg \"\$@\"" > $DPKG + chmod +x $DPKG + sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf +} + +configallowinsecurerepositories() { + echo "Acquire::AllowInsecureRepositories \"$1\";" > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf + +} + configcompression() { while [ -n "$1" ]; do case "$1" in @@ -442,7 +495,7 @@ buildsimplenativepackage() { fi local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION} - msgninfo "Build package ${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}… " + msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" mkdir -p $BUILDDIR/debian/source echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES echo "#!/bin/sh @@ -474,7 +527,10 @@ Package: $NAME" >> ${BUILDDIR}/debian/control echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control echo '3.0 (native)' > ${BUILDDIR}/debian/source/format - (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \ + cd ${BUILDDIR}/.. + testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} + cd - >/dev/null + sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output \ | while read SRC; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then @@ -486,6 +542,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control done for arch in $(getarchitecturesfromcommalist "$ARCH"); do + msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" rm -rf ${BUILDDIR}/debian/tmp mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} @@ -499,11 +556,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" # ensure the right permissions as dpkg-deb ensists chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN - if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then - cat $LOG - false - fi - rm $LOG + testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist done @@ -521,15 +574,13 @@ buildpackage() { local ARCH=$(getarchitecture $4) local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" - msgninfo "Build package ${PKGNAME} for ${RELEASE} in ${SECTION}… " + msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" cd $BUILDDIR if [ "$ARCH" = "all" ]; then ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" fi - if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then - cat $BUILDLOG - false - fi + testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH + cp ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output $BUILDLOG local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")" local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')" cd - > /dev/null @@ -539,7 +590,6 @@ buildpackage() { for SRC in $SRCS; do echo "pool/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist done - msgdone "info" } buildaptarchive() { @@ -1072,7 +1122,7 @@ testequal() { if [ -n "$MSG" ]; then msgtest "$MSG" "$*" fi - $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail + "$@" 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } testequalor2() { diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts index 3dd7d643e..953506aa5 100755 --- a/test/integration/test-failing-maintainer-scripts +++ b/test/integration/test-failing-maintainer-scripts @@ -6,6 +6,7 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'native' +configdpkgnoopchroot # create a bunch of failures createfailure() { @@ -25,51 +26,6 @@ createfailure 'postrm' setupaptarchive -# create a library to noop chroot() and rewrite maintainer script executions -# via execvp() as used by dpkg as we don't want our rootdir to be a fullblown -# chroot directory dpkg could chroot into to execute the maintainer scripts -cat << EOF > noopchroot.c -#define _GNU_SOURCE -#include -#include -#include -#include - -static char * chrootdir = NULL; - -int chroot(const char *path) { - printf("WARNING: CHROOTing to %s was ignored!\n", path); - free(chrootdir); - chrootdir = strdup(path); - return 0; -} -int execvp(const char *file, char *const argv[]) { - static int (*func_execvp) (const char *, char * const []) = NULL; - if (func_execvp == NULL) - func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); - if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) - return func_execvp(file, argv); - printf("REWRITE execvp call %s into %s\n", file, chrootdir); - char newfile[strlen(chrootdir) + strlen(file)]; - strcpy(newfile, chrootdir); - strcat(newfile, file); - return func_execvp(newfile, argv); -} -EOF -testsuccess gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl - -mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" -DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" -echo "#!/bin/sh -if [ -n \"\$LD_PRELOAD\" ]; then - export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\" -else - export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\" -fi -dpkg \"\$@\"" > $DPKG -chmod +x $DPKG -sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf - # setup some pre- and post- invokes to check the output isn't garbled later APTHOOK="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apthook" echo '#!/bin/sh diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts new file mode 100755 index 000000000..6ed120090 --- /dev/null +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -0,0 +1,40 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'native' +configdpkgnoopchroot + +setupsimplenativepackage "fdleaks" 'native' '1.0' 'unstable' +BUILDDIR="incoming/fdleaks-1.0" +for script in 'preinst' 'postinst' 'prerm' 'postrm'; do + echo '#!/bin/sh +ls -l /proc/self/fd/' > ${BUILDDIR}/debian/$script +done +buildpackage "$BUILDDIR" 'unstable' 'main' 'native' +rm -rf "$BUILDDIR" + +setupaptarchive + +testsuccess aptget install -y fdleaks +msgtest 'Check if fds were not' 'leaked' +if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then + msgpass +else + echo + cat rootdir/tmp/testsuccess.output + msgfail +fi + +testsuccess aptget purge -y fdleaks +msgtest 'Check if fds were not' 'leaked' +if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then + msgpass +else + echo + cat rootdir/tmp/testsuccess.output + msgfail +fi -- cgit v1.2.3 From 299aea924ccef428219ed6f1a026c122678429e6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 18 Nov 2014 00:59:39 +0100 Subject: fix PTY interaction on linux and kfreebsd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We run dpkg on its own pty, so we can log its output and have our own output around it (like the progress bar), while also allowing debconf and configfile prompts to happen. In commit 223ae57d468fdcac451209a095047a07a5698212 we changed to constantly reopening the slave for kfreebsd. This has the sideeffect though that in some cases slave and master will lose their connection on linux, so that no output is passed along anymore. We fix this by having always an fd referencing the slave open (linux), but we don't use it (kfreebsd). Failing to get our PTY up and running has many (bad) consequences including (not limited to, nor all at ones or in any case) garbled ouput, no output, no logging, a (partial) mixture of the previous items, … This commit is therefore also reshuffling quiet a bit of the creation code to get especially the output part up and running on linux and the logging for kfreebsd. Note that the testcase tries to cover some cases, but this is an interactivity issue so only interactive usage can really be a good test. Closes: 765687 --- .../test-no-fds-leaked-to-maintainer-scripts | 40 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 6ed120090..3c6457cab 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -8,7 +8,7 @@ setupenvironment configarchitecture 'native' configdpkgnoopchroot -setupsimplenativepackage "fdleaks" 'native' '1.0' 'unstable' +setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable' BUILDDIR="incoming/fdleaks-1.0" for script in 'preinst' 'postinst' 'prerm' 'postrm'; do echo '#!/bin/sh @@ -19,7 +19,8 @@ rm -rf "$BUILDDIR" setupaptarchive -testsuccess aptget install -y fdleaks +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +testsuccess aptget install -y fdleaks -qq < /dev/null msgtest 'Check if fds were not' 'leaked' if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then msgpass @@ -29,7 +30,23 @@ else msgfail fi -testsuccess aptget purge -y fdleaks +cp rootdir/tmp/testsuccess.output terminal.output +tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log +testfileequal 'terminal.log' "$(cat terminal.output)" + +testequal 'startup archives unpack +install fdleaks:all 1.0 +status half-installed fdleaks:all 1.0 +status unpacked fdleaks:all 1.0 +status unpacked fdleaks:all 1.0 +startup packages configure +configure fdleaks:all 1.0 +status unpacked fdleaks:all 1.0 +status half-configured fdleaks:all 1.0 +status installed fdleaks:all 1.0' cut -f 3- -d' ' rootdir/var/log/dpkg.log + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +testsuccess aptget purge -y fdleaks -qq msgtest 'Check if fds were not' 'leaked' if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then msgpass @@ -38,3 +55,20 @@ else cat rootdir/tmp/testsuccess.output msgfail fi +cp rootdir/tmp/testsuccess.output terminal.output +tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log +testfileequal 'terminal.log' "$(cat terminal.output)" + +testequal 'startup packages purge +status installed fdleaks:all 1.0 +remove fdleaks:all 1.0 +status half-configured fdleaks:all 1.0 +status half-installed fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +purge fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status config-files fdleaks:all 1.0 +status not-installed fdleaks:all ' cut -f 3- -d' ' rootdir/var/log/dpkg.log -- cgit v1.2.3 From 69d8b8537af1dd52db5f2e0e785bdce3e52fdf8d Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 28 Nov 2014 14:21:06 +0100 Subject: support long keyids in "apt-key del" instead of ignoring them apt-key given a long keyid reports just "OK" all the time, but doesn't delete the mentioned key as it doesn't find the key. Note: In debian/experimental this was closed with 29f1b977100aeb6d6ebd38923eeb7a623e264ffe which just added the testcase as the rewrite of apt-key had fixed this as well. Closes: 754436 --- test/integration/test-apt-key | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index 68b3f9710..47230cb55 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -105,3 +105,9 @@ testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ + +msgtest 'Test key removal with' '8 byte key ID' +cleanplate +cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg +testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE +testempty aptkey list -- cgit v1.2.3 From 4e6a7e260eb713318b1b5019a72073050242ac3c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Nov 2014 10:50:58 +0100 Subject: properly handle already reinstall pkgs in ordering The bugreport itself describes the case of the ordering code detecting a loop where none is present, but the testcase finds also cases in which there is actually a loop and we fail to realize it. --reinstall can be considered an interactive command through and it usually doesn't encounter such "hard" problems (= looping essentials), so this is less serious than it sounds at first. Closes: 770291 --- test/integration/test-bug-770291-reinstall | 98 ++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 test/integration/test-bug-770291-reinstall (limited to 'test') diff --git a/test/integration/test-bug-770291-reinstall b/test/integration/test-bug-770291-reinstall new file mode 100755 index 000000000..ea1f57ede --- /dev/null +++ b/test/integration/test-bug-770291-reinstall @@ -0,0 +1,98 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +insertpackage 'unstable,installed' 'libc6' 'i386' '1' +insertpackage 'unstable,installed' 'libselinux1' 'i386' '1' + +cp rootdir/var/lib/dpkg/status dpkg.status + +insertpackage 'unstable,installed' 'init' 'i386' '1' 'Depends: systemd-sysv +Essential: yes' +insertpackage 'unstable,installed' 'systemd-sysv' 'i386' '215-5+b1' 'Depends: systemd (= 215-5+b1) +Pre-Depends: systemd' +# fun fact: we need these two pre-depends to get systemd ordered before systemd-sysv as +# many pre-depends mean: do early (as they are a pain, so get them out of the way early) +insertpackage 'unstable,installed' 'systemd' 'i386' '215-5+b1' 'Pre-Depends: libc6, libselinux1' + +# depends loop +insertpackage 'unstable,installed' 'dependsA' 'i386' '1' 'Depends: dependsB +Essential: yes' +insertpackage 'unstable,installed' 'dependsB' 'i386' '1' 'Depends: dependsA +Essential: yes' + +# pre-depends loop +insertpackage 'unstable,installed' 'predependsA' 'i386' '1' 'Pre-Depends: predependsB +Essential: yes' +insertpackage 'unstable,installed' 'predependsB' 'i386' '1' 'Pre-Depends: predependsA +Essential: yes' + +# pre-depends-to-depends loop +insertpackage 'unstable,installed' 'predependsdependsA' 'i386' '1' 'Pre-Depends: predependsdependsB +Essential: yes' +insertpackage 'unstable,installed' 'predependsdependsB' 'i386' '1' 'Depends: predependsdependsA +Essential: yes' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. +Inst systemd [215-5+b1] (215-5+b1 unstable [i386]) +Conf systemd (215-5+b1 unstable [i386]) +Inst systemd-sysv [215-5+b1] (215-5+b1 unstable [i386]) +Conf systemd-sysv (215-5+b1 unstable [i386])' aptget install --reinstall systemd systemd-sysv -s + +testequal 'Reading package lists... +Building dependency tree... +0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. +Inst dependsA [1] (1 unstable [i386]) +Inst dependsB [1] (1 unstable [i386]) +Conf dependsB (1 unstable [i386]) +Conf dependsA (1 unstable [i386])' aptget install --reinstall dependsA dependsB -s + +# there is a chance dpkg can actually do these, BUT this depends on the maintainerscripts (not) present +# which is very very risky to depend on (and apt doesn't know about that anyhow). +testfailure aptget install --reinstall predependsA predependsB -s -o Debug::pkgPackageManager=1 +testequal "E: Couldn't configure predependsA:i386, probably a dependency cycle." tail -n1 rootdir/tmp/testfailure.output + +# FIXME: the error message is a catch all here, not like the one above +testfailure aptget install --reinstall predependsdependsA predependsdependsB -s -o Debug::pkgPackageManager=1 +testequal "E: Could not configure 'predependsdependsB:i386'. " tail -n1 rootdir/tmp/testfailure.output + + +msgmsg 'While we are at it, lets try these loops without reinstall as well' +cp dpkg.status rootdir/var/lib/dpkg/status + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + systemd systemd-sysv +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst systemd (215-5+b1 unstable [i386]) +Conf systemd (215-5+b1 unstable [i386]) +Inst systemd-sysv (215-5+b1 unstable [i386]) +Conf systemd-sysv (215-5+b1 unstable [i386])' aptget install systemd systemd-sysv -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + dependsA dependsB +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst dependsA (1 unstable [i386]) [] +Inst dependsB (1 unstable [i386]) +Conf dependsB (1 unstable [i386]) +Conf dependsA (1 unstable [i386])' aptget install dependsA dependsB -s + +# there is a chance dpkg can actually do these, BUT this depends on the maintainerscripts (not) present +# which is very very risky to depend on (and apt doesn't know about that anyhow). +testfailure aptget install predependsA predependsB -s -o Debug::pkgPackageManager=1 +testequal "E: Couldn't configure predependsA:i386, probably a dependency cycle." tail -n1 rootdir/tmp/testfailure.output + +# FIXME: the error message is a catch all here, not like the one above +testfailure aptget install predependsdependsA predependsdependsB -s -o Debug::pkgPackageManager=1 +testequal "E: Could not configure 'predependsdependsB:i386'. " tail -n1 rootdir/tmp/testfailure.output -- cgit v1.2.3 From 016bea8214e1826b289025f03890f70a5805db87 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Nov 2014 12:10:15 +0100 Subject: correct architecture detection for 'rc' packages for purge We were already considering these cases, but the code was flawed, so that packages changing architectures are incorrectly handled and hence the wrong architecture is used to call dpkg with, so that dpkg says the package isn't installed (which it isn't for the requested architecture). Closes: 770898 --- test/integration/framework | 24 ++++++--- .../test-ubuntu-bug-761175-remove-purge | 62 ++++++++++++++-------- 2 files changed, 59 insertions(+), 27 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index ff059f59e..298f4c9b2 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -635,12 +635,8 @@ buildaptarchive() { createaptftparchiveconfig() { local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')" - COMPRESSORS="${COMPRESSORS%* }" - local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#' | tr '\n' ' ')" - if [ -z "$ARCHS" ]; then - # the pool is empty, so we will operate on faked packages - let us use the configured archs - ARCHS="$(getarchitectures)" - fi + local COMPRESSORS="${COMPRESSORS%* }" + local ARCHS="$(getarchitectures)" echo -n 'Dir { ArchiveDir "' >> ftparchive.conf echo -n $(readlink -f .) >> ftparchive.conf @@ -1489,3 +1485,19 @@ aptautotest_aptget_update() { done } aptautotest_apt_update() { aptautotest_aptget_update "$@"; } + +testaptautotestnodpkgwarning() { + local TESTCALL="$1" + while [ -n "$2" ]; do + if [ "$2" = '-s' ]; then return; fi + shift + done + testfailure grep '^dpkg: warning:.*ignor.*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" +} + +aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } +aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } +aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } +aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } +aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } +aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } diff --git a/test/integration/test-ubuntu-bug-761175-remove-purge b/test/integration/test-ubuntu-bug-761175-remove-purge index 14648e9b8..0b5a91246 100755 --- a/test/integration/test-ubuntu-bug-761175-remove-purge +++ b/test/integration/test-ubuntu-bug-761175-remove-purge @@ -4,33 +4,53 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture 'native' - -setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable' -BUILDDIR='incoming/compiz-core-1.0' -mkdir -p ${BUILDDIR}/debian/compiz-core/etc -echo 'foo=bar;' > ${BUILDDIR}/compiz.conf -echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install -buildpackage "$BUILDDIR" 'unstable' 'main' 'native' -rm -rf "$BUILDDIR" +configarchitecture 'amd64' 'i386' + +buildcompizpkg() { + setupsimplenativepackage "compiz-core-$1" "$2" "$3" "$4" + BUILDDIR="incoming/compiz-core-$1-$3" + mkdir -p ${BUILDDIR}/debian/compiz-core/etc + echo 'foo=bar;' > ${BUILDDIR}/compiz.conf + echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install + buildpackage "$BUILDDIR" "$4" 'main' "$2" + rm -rf "$BUILDDIR" +} +buildcompizpkg 'native' 'all' '1.0' 'stable' +buildcompizpkg 'all' 'native' '1.0' 'stable' +buildcompizpkg 'native' 'native' '2.0' 'unstable' +buildcompizpkg 'all' 'all' '2.0' 'unstable' setupaptarchive +runtests() { + testdpkgnotinstalled compiz-core-$1 + testsuccess aptget install compiz-core-$1 -t "${2:-unstable}" + testdpkginstalled compiz-core-$1 -testdpkgnotinstalled compiz-core -testsuccess aptget install compiz-core -testdpkginstalled compiz-core - -testsuccess aptget remove compiz-core -y -testdpkgnotinstalled compiz-core - -msgtest 'Check that conffiles are still around for' 'compiz-core' -dpkg -l compiz-core | grep -q '^rc' && msgpass || msgfail + testsuccess aptget remove compiz-core-$1 -y + testdpkgnotinstalled compiz-core-$1 + testdpkgstatus 'rc' '1' "compiz-core-$1" -testequal 'Reading package lists... + testequal "Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: - compiz-core* + compiz-core-$1* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. -Purg compiz-core' aptget purge compiz-core -s +Purg compiz-core-$1" aptget purge compiz-core-$1 -s + testsuccess aptget purge compiz-core-$1 -y + testequal "dpkg-query: no packages found matching compiz-core-$1" dpkg -l compiz-core-$1 +} + +msgmsg 'Test in multi arch environment' +runtests 'native' +runtests 'all' +runtests 'native' 'stable' +runtests 'all' 'stable' + +msgmsg 'Test in single arch environment' +configarchitecture 'amd64' +runtests 'native' +runtests 'all' +runtests 'native' 'stable' +runtests 'all' 'stable' -- cgit v1.2.3 From ecb777ddb4d13bb7a18bbf2ebb8e2c810dcaeb72 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 18 Nov 2014 19:53:56 +0100 Subject: always run 'dpkg --configure -a' at the end of our dpkg callings dpkg checks now for dependencies before running triggers, so that packages can now end up in trigger states (especially those we are not touching at all with our calls) after apt is done running. The solution to this is trivial: Just tell dpkg to configure everything after we have (supposely) configured everything already. In the worst case this means dpkg will have to run a bunch of triggers, usually it will just do nothing though. The code to make this happen was already available, so we just flip a config option here to cause it to be run. This way we can keep pretending that triggers are an implementation detail of dpkg. --triggers-only would supposely work as well, but --configure is more robust in regards to future changes to dpkg and something we will hopefully make use of in future versions anyway (as it was planed at the time this and related options were implemented). Closes: 769609 --- test/integration/framework | 25 ++++--- test/integration/test-apt-progress-fd | 67 ++++++++++--------- test/integration/test-apt-progress-fd-deb822 | 18 +++-- test/integration/test-apt-progress-fd-error | 2 +- ...est-bug-769609-triggers-still-pending-after-run | 78 ++++++++++++++++++++++ .../test-no-fds-leaked-to-maintainer-scripts | 6 +- 6 files changed, 142 insertions(+), 54 deletions(-) create mode 100755 test/integration/test-bug-769609-triggers-still-pending-after-run (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 298f4c9b2..930ab9367 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1237,10 +1237,13 @@ testnopackage() { fi } -testdpkginstalled() { - msgtest "Test for correctly installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)" - if [ "$PKGS" != $# ]; then +testdpkgstatus() { + local STATE="$1" + local NR="$2" + shift 2 + msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" + local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" + if [ "$PKGS" != $NR ]; then echo >&2 $PKGS dpkg -l "$@" | grep '^[a-z]' >&2 msgfail @@ -1249,16 +1252,12 @@ testdpkginstalled() { fi } +testdpkginstalled() { + testdpkgstatus 'ii' "$#" "$@" +} + testdpkgnotinstalled() { - msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)" - if [ "$PKGS" != 0 ]; then - echo - dpkg -l "$@" | grep '^[a-z]' >&2 - msgfail - else - msgpass - fi + testdpkgstatus 'ii' '0' "$@" } testmarkedauto() { diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd index af022f582..90e6ef7e4 100755 --- a/test/integration/test-apt-progress-fd +++ b/test/integration/test-apt-progress-fd @@ -19,13 +19,14 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) -pmstatus:testing:20:Preparing testing (amd64) -pmstatus:testing:40:Unpacking testing (amd64) -pmstatus:testing:60:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:60:Running dpkg -pmstatus:testing:60:Configuring testing (amd64) -pmstatus:testing:80:Configuring testing (amd64) -pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log +pmstatus:testing:16.6667:Preparing testing (amd64) +pmstatus:testing:33.3333:Unpacking testing (amd64) +pmstatus:testing:50:Preparing to configure testing (amd64) +pmstatus:dpkg-exec:50:Running dpkg +pmstatus:testing:50:Configuring testing (amd64) +pmstatus:testing:66.6667:Configuring testing (amd64) +pmstatus:testing:83.3333:Installed testing (amd64) +pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log # upgrade exec 3> apt-progress.log @@ -34,13 +35,14 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) -pmstatus:testing:20:Preparing testing (amd64) -pmstatus:testing:40:Unpacking testing (amd64) -pmstatus:testing:60:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:60:Running dpkg -pmstatus:testing:60:Configuring testing (amd64) -pmstatus:testing:80:Configuring testing (amd64) -pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log +pmstatus:testing:16.6667:Preparing testing (amd64) +pmstatus:testing:33.3333:Unpacking testing (amd64) +pmstatus:testing:50:Preparing to configure testing (amd64) +pmstatus:dpkg-exec:50:Running dpkg +pmstatus:testing:50:Configuring testing (amd64) +pmstatus:testing:66.6667:Configuring testing (amd64) +pmstatus:testing:83.3333:Installed testing (amd64) +pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log # reinstall exec 3> apt-progress.log @@ -49,22 +51,24 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) -pmstatus:testing:20:Preparing testing (amd64) -pmstatus:testing:40:Unpacking testing (amd64) -pmstatus:testing:60:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:60:Running dpkg -pmstatus:testing:60:Configuring testing (amd64) -pmstatus:testing:80:Configuring testing (amd64) -pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log +pmstatus:testing:16.6667:Preparing testing (amd64) +pmstatus:testing:33.3333:Unpacking testing (amd64) +pmstatus:testing:50:Preparing to configure testing (amd64) +pmstatus:dpkg-exec:50:Running dpkg +pmstatus:testing:50:Configuring testing (amd64) +pmstatus:testing:66.6667:Configuring testing (amd64) +pmstatus:testing:83.3333:Installed testing (amd64) +pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log # and remove exec 3> apt-progress.log testsuccess aptget remove testing -y -o APT::Status-Fd=3 testequal "pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Removing testing (amd64) -pmstatus:testing:33.3333:Preparing for removal of testing (amd64) -pmstatus:testing:66.6667:Removing testing (amd64) -pmstatus:testing:100:Removed testing (amd64)" cat apt-progress.log +pmstatus:testing:25:Preparing for removal of testing (amd64) +pmstatus:testing:50:Removing testing (amd64) +pmstatus:testing:75:Removed testing (amd64) +pmstatus:dpkg-exec:75:Running dpkg" cat apt-progress.log # install non-native and ensure we get proper progress info exec 3> apt-progress.log @@ -75,12 +79,13 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing2:0:Installing testing2 (i386) -pmstatus:testing2:20:Preparing testing2 (i386) -pmstatus:testing2:40:Unpacking testing2 (i386) -pmstatus:testing2:60:Preparing to configure testing2 (i386) -pmstatus:dpkg-exec:60:Running dpkg -pmstatus:testing2:60:Configuring testing2 (i386) -pmstatus:testing2:80:Configuring testing2 (i386) -pmstatus:testing2:100:Installed testing2 (i386)" cat apt-progress.log +pmstatus:testing2:16.6667:Preparing testing2 (i386) +pmstatus:testing2:33.3333:Unpacking testing2 (i386) +pmstatus:testing2:50:Preparing to configure testing2 (i386) +pmstatus:dpkg-exec:50:Running dpkg +pmstatus:testing2:50:Configuring testing2 (i386) +pmstatus:testing2:66.6667:Configuring testing2 (i386) +pmstatus:testing2:83.3333:Installed testing2 (i386) +pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log rm -f apt-progress*.log diff --git a/test/integration/test-apt-progress-fd-deb822 b/test/integration/test-apt-progress-fd-deb822 index 9d227942d..badc985e4 100755 --- a/test/integration/test-apt-progress-fd-deb822 +++ b/test/integration/test-apt-progress-fd-deb822 @@ -27,37 +27,41 @@ Message: Installing testing (amd64) Status: progress Package: testing:amd64 -Percent: 20 +Percent: 16.6667 Message: Preparing testing (amd64) Status: progress Package: testing:amd64 -Percent: 40 +Percent: 33.3333 Message: Unpacking testing (amd64) Status: progress Package: testing:amd64 -Percent: 60 +Percent: 50 Message: Preparing to configure testing (amd64) Status: progress -Percent: 60 +Percent: 50 Message: Running dpkg Status: progress Package: testing:amd64 -Percent: 60 +Percent: 50 Message: Configuring testing (amd64) Status: progress Package: testing:amd64 -Percent: 80 +Percent: 66.6667 Message: Configuring testing (amd64) Status: progress Package: testing:amd64 -Percent: 100 +Percent: 83.3333 Message: Installed testing (amd64) + +Status: progress +Percent: 83.3333 +Message: Running dpkg " cat apt-progress.log diff --git a/test/integration/test-apt-progress-fd-error b/test/integration/test-apt-progress-fd-error index a47095b9b..632300765 100755 --- a/test/integration/test-apt-progress-fd-error +++ b/test/integration/test-apt-progress-fd-error @@ -18,7 +18,7 @@ setupaptarchive exec 3> apt-progress.log testfailure aptget install foo1 foo2 -y -o APT::Status-Fd=3 msgtest "Ensure correct error message" -if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:40:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then +if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:36.3636:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then msgpass else cat apt-progress.log diff --git a/test/integration/test-bug-769609-triggers-still-pending-after-run b/test/integration/test-bug-769609-triggers-still-pending-after-run new file mode 100755 index 000000000..0588b793f --- /dev/null +++ b/test/integration/test-bug-769609-triggers-still-pending-after-run @@ -0,0 +1,78 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +msgtest 'Check if installed dpkg supports' 'noawait trigger' +if dpkg-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; then + msgpass +else + msgskip 'dpkg version too old' + exit 0 +fi +configdpkgnoopchroot + +buildtriggerpackages() { + local TYPE="$1" + setupsimplenativepackage "triggerable-$TYPE" 'all' '1.0' 'unstable' "Depends: trigdepends-$TYPE" + BUILDDIR="incoming/triggerable-${TYPE}-1.0" + cat >${BUILDDIR}/debian/postinst < ${BUILDDIR}/debian/triggers + buildpackage "$BUILDDIR" 'unstable' 'main' 'native' + rm -rf "$BUILDDIR" + buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable' +} + +# FIXME: implement test with activate-style triggers +#buildtriggerpackages 'interest' +buildtriggerpackages 'interest-noawait' + +buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable' + + +setupaptarchive + +runtests() { + local TYPE="$1" + msgmsg 'Working with trigger type' "$TYPE" + testsuccess aptget install triggerable-$TYPE -y + cp rootdir/tmp/testsuccess.output terminal.output + testsuccess grep '^REWRITE ' terminal.output + testdpkginstalled triggerable-$TYPE trigdepends-$TYPE + + testsuccess aptget install trigdepends-$TYPE -y --reinstall + cp rootdir/tmp/testsuccess.output terminal.output + testsuccess grep '^REWRITE ' terminal.output + testsuccess grep ' root root ' terminal.output + testdpkginstalled triggerable-$TYPE trigdepends-$TYPE + + testsuccess aptget install trigstuff -y + cp rootdir/tmp/testsuccess.output terminal.output + testsuccess grep '^REWRITE ' terminal.output + testsuccess grep ' root root ' terminal.output + testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff + + testsuccess aptget purge trigstuff -y + cp rootdir/tmp/testsuccess.output terminal.output + testsuccess grep '^REWRITE ' terminal.output + testsuccess grep ' root root ' terminal.output + testdpkginstalled triggerable-$TYPE trigdepends-$TYPE + testdpkgnotinstalled trigstuff + + testsuccess aptget purge trigdepends-$TYPE -y + cp rootdir/tmp/testsuccess.output terminal.output + testfailure grep '^REWRITE ' terminal.output + testfailure grep ' root root ' terminal.output + testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE +} +#runtests 'interest' +runtests 'interest-noawait' diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 428db46ef..cde987bd6 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -48,7 +48,8 @@ startup packages configure configure $PKGNAME 1.0 status unpacked $PKGNAME 1.0 status half-configured $PKGNAME 1.0 -status installed $PKGNAME 1.0" cut -f 3- -d' ' rootdir/var/log/dpkg.log +status installed $PKGNAME 1.0 +startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess aptget purge -y fdleaks -qq @@ -76,4 +77,5 @@ status config-files $PKGNAME 1.0 status config-files $PKGNAME 1.0 status config-files $PKGNAME 1.0 status config-files $PKGNAME 1.0 -status not-installed $PKGNAME " cut -f 3- -d' ' rootdir/var/log/dpkg.log +status not-installed $PKGNAME +startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log -- cgit v1.2.3 From ed793a19ec00b83254029509bc516e3ba911c75a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 29 Nov 2014 17:59:52 +0100 Subject: dispose http(s) 416 error page as non-content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Real webservers (like apache) actually send an error page with a 416 response, but our client didn't expect it leaving the page on the socket to be parsed as response for the next request (http) or as file content (https), which isn't what we want at all… Symptom is a "Bad header line" as html usually doesn't parse that well to an http-header. This manifests itself e.g. if we have a complete file (or larger) in partial/ which isn't discarded by If-Range as the server doesn't support it (or it is just newer, think: mirror rotation). It is a sort-of regression of 78c72d0ce22e00b194251445aae306df357d5c1a, which removed the filesize - 1 trick, but this had its own problems… To properly test this our webserver gains the ability to reply with transfer-encoding: chunked as most real webservers will use it to send the dynamically generated error pages. Closes: 768797 --- test/integration/framework | 4 +- test/integration/test-partial-file-support | 62 ++++++++- test/interactive-helper/aptwebserver.cc | 193 ++++++++++++++++++----------- 3 files changed, 180 insertions(+), 79 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 930ab9367..f7f69f5d5 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1119,8 +1119,8 @@ acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom } downloadfile() { - local PROTO="$(echo "$1" | cut -d':' -f 1 )" - apthelper -o Debug::Acquire::${PROTO}=1 \ + local PROTO="${1%%:*}" + apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ download-file "$1" "$2" 2>&1 || true # only if the file exists the download was successful if [ -r "$2" ]; then diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support index 98b2f242a..b6b305d25 100755 --- a/test/integration/test-partial-file-support +++ b/test/integration/test-partial-file-support @@ -24,13 +24,25 @@ testdownloadfile() { else msgpass fi - cat "$DOWNLOADLOG" | while read field hash; do + sed -e '/^ <- / s#%20# #g' -e '/^ <- / s#%0a#\n#g' "$DOWNLOADLOG" | grep '^.*-Hash: ' > receivedhashes.log + testsuccess test -s receivedhashes.log + local HASHES_OK=0 + local HASHES_BAD=0 + while read field hash; do local EXPECTED case "$field" in 'MD5Sum-Hash:') EXPECTED="$(md5sum "$TESTFILE" | cut -d' ' -f 1)";; 'SHA1-Hash:') EXPECTED="$(sha1sum "$TESTFILE" | cut -d' ' -f 1)";; 'SHA256-Hash:') EXPECTED="$(sha256sum "$TESTFILE" | cut -d' ' -f 1)";; 'SHA512-Hash:') EXPECTED="$(sha512sum "$TESTFILE" | cut -d' ' -f 1)";; + 'Checksum-FileSize-Hash:') + #filesize is too weak to check for != + if [ "$4" = '=' ]; then + EXPECTED="$(stat -c '%s' "$TESTFILE")" + else + continue + fi + ;; *) continue;; esac if [ "$4" = '=' ]; then @@ -40,15 +52,41 @@ testdownloadfile() { fi if [ "$EXPECTED" "$4" "$hash" ]; then msgpass + HASHES_OK=$((HASHES_OK+1)); else - cat >&2 "$DOWNLOADLOG" msgfail "expected: $EXPECTED ; got: $hash" + HASHES_BAD=$((HASHES_BAD+1)); fi - done + done < receivedhashes.log + msgtest 'At least one good hash and no bad ones' + if [ $HASHES_OK -eq 0 ] || [ $HASHES_BAD -ne 0 ]; then + cat >&2 "$DOWNLOADLOG" + msgfail + else + msgpass + fi } TESTFILE='aptarchive/testfile' cp -a ${TESTDIR}/framework $TESTFILE +cp -a ${TESTDIR}/framework "${TESTFILE}2" + +followuprequest() { + local DOWN='./downloaded/testfile' + + copysource $TESTFILE 1M $DOWN + testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' + testwebserverlaststatuscode '416' "$DOWNLOADLOG" + + copysource $TESTFILE 1M $DOWN + copysource "${TESTFILE}2" 20 "${DOWN}2" + msgtest 'Testing download of files with' 'completely downloaded file + partial file' + testsuccess --nomsg apthelper -o Debug::Acquire::${1%%:*}=1 -o Debug::pkgAcquire::Worker=1 \ + download-file "$1/testfile" "$DOWN" '' "$1/testfile2" "${DOWN}2" + testwebserverlaststatuscode '206' 'rootdir/tmp/testsuccess.output' + testsuccess diff -u "$TESTFILE" "${DOWN}" + testsuccess diff -u "${DOWN}" "${DOWN}2" +} testrun() { webserverconfig 'aptwebserver::support::range' 'true' @@ -66,9 +104,11 @@ testrun() { testdownloadfile 'invalid partial data' "${1}/testfile" "$DOWN" '!=' testwebserverlaststatuscode '206' "$DOWNLOADLOG" - copysource $TESTFILE 1M $DOWN - testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' - testwebserverlaststatuscode '416' "$DOWNLOADLOG" + webserverconfig 'aptwebserver::closeOnError' 'false' + followuprequest "$1" + webserverconfig 'aptwebserver::closeOnError' 'true' + followuprequest "$1" + webserverconfig 'aptwebserver::closeOnError' 'false' copysource /dev/zero 1M $DOWN testdownloadfile 'too-big partial file' "${1}/testfile" "$DOWN" '=' @@ -86,8 +126,18 @@ testrun() { testwebserverlaststatuscode '200' "$DOWNLOADLOG" } +msgmsg 'http: Test with Content-Length' +webserverconfig 'aptwebserver::chunked-transfer-encoding' 'false' +testrun 'http://localhost:8080' +msgmsg 'http: Test with Transfer-Encoding: chunked' +webserverconfig 'aptwebserver::chunked-transfer-encoding' 'true' testrun 'http://localhost:8080' changetohttpswebserver +msgmsg 'https: Test with Content-Length' +webserverconfig 'aptwebserver::chunked-transfer-encoding' 'false' +testrun 'https://localhost:4433' +msgmsg 'https: Test with Transfer-Encoding: chunked' +webserverconfig 'aptwebserver::chunked-transfer-encoding' 'true' testrun 'https://localhost:4433' diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 00004a524..ca6f88c58 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -19,6 +19,8 @@ #include #include #include + +#include #include #include #include @@ -79,12 +81,21 @@ static char const * httpcodeToStr(int const httpcode) /*{{{*/ return NULL; } /*}}}*/ +static bool chunkedTransferEncoding(std::list const &headers) { + if (std::find(headers.begin(), headers.end(), "Transfer-Encoding: chunked") != headers.end()) + return true; + if (_config->FindB("aptwebserver::chunked-transfer-encoding", false) == true) + return true; + return false; +} static void addFileHeaders(std::list &headers, FileFd &data)/*{{{*/ { - std::ostringstream contentlength; - contentlength << "Content-Length: " << data.FileSize(); - headers.push_back(contentlength.str()); - + if (chunkedTransferEncoding(headers) == false) + { + std::ostringstream contentlength; + contentlength << "Content-Length: " << data.FileSize(); + headers.push_back(contentlength.str()); + } std::string lastmodified("Last-Modified: "); lastmodified.append(TimeRFC1123(data.ModificationTime())); headers.push_back(lastmodified); @@ -92,9 +103,12 @@ static void addFileHeaders(std::list &headers, FileFd &data)/*{{{*/ /*}}}*/ static void addDataHeaders(std::list &headers, std::string &data)/*{{{*/ { - std::ostringstream contentlength; - contentlength << "Content-Length: " << data.size(); - headers.push_back(contentlength.str()); + if (chunkedTransferEncoding(headers) == false) + { + std::ostringstream contentlength; + contentlength << "Content-Length: " << data.size(); + headers.push_back(contentlength.str()); + } } /*}}}*/ static bool sendHead(int const client, int const httpcode, std::list &headers)/*{{{*/ @@ -114,6 +128,9 @@ static bool sendHead(int const client, int const httpcode, std::list>> RESPONSE to " << client << " >>>" << std::endl; bool Success = true; for (std::list::const_iterator h = headers.begin(); @@ -130,25 +147,55 @@ static bool sendHead(int const client, int const httpcode, std::list const &headers, FileFd &data)/*{{{*/ { bool Success = true; + bool const chunked = chunkedTransferEncoding(headers); char buffer[500]; unsigned long long actual = 0; while ((Success &= data.Read(buffer, sizeof(buffer), &actual)) == true) { if (actual == 0) break; - Success &= FileFd::Write(client, buffer, actual); + + if (chunked == true) + { + std::string size; + strprintf(size, "%llX\r\n", actual); + Success &= FileFd::Write(client, size.c_str(), size.size()); + Success &= FileFd::Write(client, buffer, actual); + Success &= FileFd::Write(client, "\r\n", strlen("\r\n")); + } + else + Success &= FileFd::Write(client, buffer, actual); + } + if (chunked == true) + { + char const * const finish = "0\r\n\r\n"; + Success &= FileFd::Write(client, finish, strlen(finish)); } if (Success == false) - std::cerr << "SENDFILE: READ/WRITE ERROR to " << client << std::endl; + std::cerr << "SENDFILE:" << (chunked ? " CHUNKED" : "") << " READ/WRITE ERROR to " << client << std::endl; return Success; } /*}}}*/ -static bool sendData(int const client, std::string const &data) /*{{{*/ +static bool sendData(int const client, std::list const &headers, std::string const &data)/*{{{*/ { - if (FileFd::Write(client, data.c_str(), data.size()) == false) + if (chunkedTransferEncoding(headers) == true) + { + unsigned long long const ullsize = data.length(); + std::string size; + strprintf(size, "%llX\r\n", ullsize); + char const * const finish = "\r\n0\r\n\r\n"; + if (FileFd::Write(client, size.c_str(), size.length()) == false || + FileFd::Write(client, data.c_str(), ullsize) == false || + FileFd::Write(client, finish, strlen(finish)) == false) + { + std::cerr << "SENDDATA: CHUNK WRITE ERROR to " << client << std::endl; + return false; + } + } + else if (FileFd::Write(client, data.c_str(), data.size()) == false) { std::cerr << "SENDDATA: WRITE ERROR to " << client << std::endl; return false; @@ -157,33 +204,38 @@ static bool sendData(int const client, std::string const &data) /*{{{*/ } /*}}}*/ static void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ - bool content, std::string const &error = "", std::list headers = std::list()) + bool const content, std::string const &error, std::list &headers) { std::string response(""); response.append(httpcodeToStr(httpcode)).append(""); response.append("

").append(httpcodeToStr(httpcode)).append("

"); if (httpcode != 200) - { - if (error.empty() == false) - response.append("

Error: ").append(error).append("

"); - response.append("This error is a result of the request:
");
-   }
+      response.append("

Error: "); + else + response.append("

Success: "); + if (error.empty() == false) + response.append(error); + else + response.append(httpcodeToStr(httpcode)); + if (httpcode != 200) + response.append("

This error is a result of the request:
");
    else
-   {
-      if (error.empty() == false)
-	 response.append("

Success: ").append(error).append("

"); response.append("The successfully executed operation was requested by:
");
-   }
    response.append(request).append("
"); + if (httpcode != 200) + { + if (_config->FindB("aptwebserver::closeOnError", false) == true) + headers.push_back("Connection: close"); + } addDataHeaders(headers, response); sendHead(client, httpcode, headers); if (content == true) - sendData(client, response); + sendData(client, headers, response); } static void sendSuccess(int const client, std::string const &request, - bool content, std::string const &error = "") + bool const content, std::string const &error, std::list &headers) { - sendError(client, 200, request, content, error); + sendError(client, 200, request, content, error, headers); } /*}}}*/ static void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/ @@ -220,7 +272,7 @@ static void sendRedirect(int const client, int const httpcode, std::string const headers.push_back(location); sendHead(client, httpcode, headers); if (content == true) - sendData(client, response); + sendData(client, headers, response); } /*}}}*/ static int filter_hidden_files(const struct dirent *a) /*{{{*/ @@ -262,16 +314,15 @@ static int grouped_alpha_case_sort(const struct dirent **a, const struct dirent } /*}}}*/ static void sendDirectoryListing(int const client, std::string const &dir,/*{{{*/ - std::string const &request, bool content) + std::string const &request, bool content, std::list &headers) { - std::list headers; std::ostringstream listing; struct dirent **namelist; int const counter = scandir(dir.c_str(), &namelist, filter_hidden_files, grouped_alpha_case_sort); if (counter == -1) { - sendError(client, 500, request, content); + sendError(client, 500, request, content, "scandir failed", headers); return; } @@ -310,18 +361,18 @@ static void sendDirectoryListing(int const client, std::string const &dir,/*{{{* addDataHeaders(headers, response); sendHead(client, 200, headers); if (content == true) - sendData(client, response); + sendData(client, headers, response); } /*}}}*/ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ std::string &filename, std::string ¶ms, bool &sendContent, - bool &closeConnection) + bool &closeConnection, std::list &headers) { if (strncmp(request.c_str(), "HEAD ", 5) == 0) sendContent = false; if (strncmp(request.c_str(), "GET ", 4) != 0) { - sendError(client, 501, request, true); + sendError(client, 501, request, true, "", headers); return false; } @@ -332,7 +383,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ if (lineend == std::string::npos || filestart == std::string::npos || fileend == std::string::npos || filestart == fileend) { - sendError(client, 500, request, sendContent, "Filename can't be extracted"); + sendError(client, 500, request, sendContent, "Filename can't be extracted", headers); return false; } @@ -344,14 +395,14 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ closeConnection = strcasecmp(LookupTag(request, "Connection", "Keep-Alive").c_str(), "close") == 0; else { - sendError(client, 500, request, sendContent, "Not a HTTP/1.{0,1} request"); + sendError(client, 500, request, sendContent, "Not a HTTP/1.{0,1} request", headers); return false; } filename = request.substr(filestart, fileend - filestart); if (filename.find(' ') != std::string::npos) { - sendError(client, 500, request, sendContent, "Filename contains an unencoded space"); + sendError(client, 500, request, sendContent, "Filename contains an unencoded space", headers); return false; } @@ -359,7 +410,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ if (host.empty() == true) { // RFC 2616 §14.23 requires Host - sendError(client, 400, request, sendContent, "Host header is required"); + sendError(client, 400, request, sendContent, "Host header is required", headers); return false; } host = "http://" + host; @@ -370,7 +421,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ { if (absolute.find("uri") == std::string::npos) { - sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that"); + sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that", headers); return false; } @@ -382,9 +433,9 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ if (authConf.empty() != auth.empty()) { if (auth.empty()) - sendError(client, 407, request, sendContent, "Proxy requires authentication"); + sendError(client, 407, request, sendContent, "Proxy requires authentication", headers); else - sendError(client, 407, request, sendContent, "Client wants to authenticate to proxy, but proxy doesn't need it"); + sendError(client, 407, request, sendContent, "Client wants to authenticate to proxy, but proxy doesn't need it", headers); return false; } if (authConf.empty() == false) @@ -395,7 +446,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ auth.erase(0, strlen(basic)); if (auth != authConf) { - sendError(client, 407, request, sendContent, "Proxy-Authentication doesn't match"); + sendError(client, 407, request, sendContent, "Proxy-Authentication doesn't match", headers); return false; } } @@ -410,7 +461,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ } else if (absolute.find("path") == std::string::npos && APT::String::Startswith(filename, "/_config/") == false) { - sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that"); + sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that", headers); return false; } @@ -421,9 +472,9 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ if (authConf.empty() != auth.empty()) { if (auth.empty()) - sendError(client, 401, request, sendContent, "Server requires authentication"); + sendError(client, 401, request, sendContent, "Server requires authentication", headers); else - sendError(client, 401, request, sendContent, "Client wants to authenticate to server, but server doesn't need it"); + sendError(client, 401, request, sendContent, "Client wants to authenticate to server, but server doesn't need it", headers); return false; } if (authConf.empty() == false) @@ -434,13 +485,12 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ auth.erase(0, strlen(basic)); if (auth != authConf) { - sendError(client, 401, request, sendContent, "Authentication doesn't match"); + sendError(client, 401, request, sendContent, "Authentication doesn't match", headers); return false; } } else { - std::list headers; headers.push_back("WWW-Authenticate: Basic"); sendError(client, 401, request, sendContent, "Unsupported Authentication Scheme", headers); return false; @@ -463,7 +513,8 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ filename.find_first_of("\r\n\t\f\v") != std::string::npos || filename.find("/../") != std::string::npos) { - sendError(client, 400, request, sendContent, "Filename contains illegal character (sequence)"); + std::list headers; + sendError(client, 400, request, sendContent, "Filename contains illegal character (sequence)", headers); return false; } @@ -499,7 +550,8 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ return true; } /*}}}*/ -static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector parts)/*{{{*/ +static bool handleOnTheFlyReconfiguration(int const client, std::string const &request,/*{{{*/ + std::vector parts, std::list &headers) { size_t const pcount = parts.size(); for (size_t i = 0; i < pcount; ++i) @@ -507,40 +559,38 @@ static bool handleOnTheFlyReconfiguration(int const client, std::string const &r if (pcount == 4 && parts[1] == "set") { _config->Set(parts[2], parts[3]); - sendSuccess(client, request, true, "Option '" + parts[2] + "' was set to '" + parts[3] + "'!"); + sendSuccess(client, request, true, "Option '" + parts[2] + "' was set to '" + parts[3] + "'!", headers); return true; } else if (pcount == 4 && parts[1] == "find") { - std::list headers; std::string response = _config->Find(parts[2], parts[3]); addDataHeaders(headers, response); sendHead(client, 200, headers); - sendData(client, response); + sendData(client, headers, response); return true; } else if (pcount == 3 && parts[1] == "find") { - std::list headers; if (_config->Exists(parts[2]) == true) { std::string response = _config->Find(parts[2]); addDataHeaders(headers, response); sendHead(client, 200, headers); - sendData(client, response); + sendData(client, headers, response); return true; } - sendError(client, 404, request, "Requested Configuration option doesn't exist."); + sendError(client, 404, request, true, "Requested Configuration option doesn't exist", headers); return false; } else if (pcount == 3 && parts[1] == "clear") { _config->Clear(parts[2]); - sendSuccess(client, request, true, "Option '" + parts[2] + "' was cleared."); + sendSuccess(client, request, true, "Option '" + parts[2] + "' was cleared.", headers); return true; } - sendError(client, 400, request, true, "Unknown on-the-fly configuration request"); + sendError(client, 400, request, true, "Unknown on-the-fly configuration request", headers); return false; } /*}}}*/ @@ -549,18 +599,22 @@ static void * handleClient(void * voidclient) /*{{{*/ int client = *((int*)(voidclient)); std::clog << "ACCEPT client " << client << std::endl; std::vector messages; - while (ReadMessages(client, messages)) + bool closeConnection = false; + std::list headers; + while (closeConnection == false && ReadMessages(client, messages)) { - bool closeConnection = false; + // if we announced a closing, do the close + if (std::find(headers.begin(), headers.end(), std::string("Connection: close")) != headers.end()) + break; + headers.clear(); for (std::vector::const_iterator m = messages.begin(); m != messages.end() && closeConnection == false; ++m) { std::clog << ">>> REQUEST from " << client << " >>>" << std::endl << *m << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; - std::list headers; std::string filename; std::string params; bool sendContent = true; - if (parseFirstLine(client, *m, filename, params, sendContent, closeConnection) == false) + if (parseFirstLine(client, *m, filename, params, sendContent, closeConnection, headers) == false) continue; // special webserver command request @@ -569,7 +623,7 @@ static void * handleClient(void * voidclient) /*{{{*/ std::vector parts = VectorizeString(filename, '/'); if (parts[0] == "_config") { - handleOnTheFlyReconfiguration(client, *m, parts); + handleOnTheFlyReconfiguration(client, *m, parts, headers); continue; } } @@ -601,7 +655,7 @@ static void * handleClient(void * voidclient) /*{{{*/ { char error[300]; regerror(res, pattern, error, sizeof(error)); - sendError(client, 500, *m, sendContent, error); + sendError(client, 500, *m, sendContent, error, headers); continue; } if (regexec(pattern, filename.c_str(), 0, 0, 0) == 0) @@ -620,7 +674,7 @@ static void * handleClient(void * voidclient) /*{{{*/ if (_config->FindB("aptwebserver::support::http", true) == false && LookupTag(*m, "Host").find(":4433") == std::string::npos) { - sendError(client, 400, *m, sendContent, "HTTP disabled, all requests must be HTTPS"); + sendError(client, 400, *m, sendContent, "HTTP disabled, all requests must be HTTPS", headers); continue; } else if (RealFileExists(filename) == true) @@ -676,17 +730,16 @@ static void * handleClient(void * voidclient) /*{{{*/ headers.push_back(contentrange.str()); sendHead(client, 206, headers); if (sendContent == true) - sendFile(client, data); + sendFile(client, headers, data); continue; } else { - headers.push_back("Content-Length: 0"); std::ostringstream contentrange; contentrange << "Content-Range: bytes */" << filesize; headers.push_back(contentrange.str()); - sendHead(client, 416, headers); - continue; + sendError(client, 416, *m, sendContent, "", headers); + break; } } } @@ -695,22 +748,20 @@ static void * handleClient(void * voidclient) /*{{{*/ addFileHeaders(headers, data); sendHead(client, 200, headers); if (sendContent == true) - sendFile(client, data); + sendFile(client, headers, data); } else if (DirectoryExists(filename) == true) { if (filename[filename.length()-1] == '/') - sendDirectoryListing(client, filename, *m, sendContent); + sendDirectoryListing(client, filename, *m, sendContent, headers); else sendRedirect(client, 301, filename.append("/"), *m, sendContent); } else - sendError(client, 404, *m, sendContent); + sendError(client, 404, *m, sendContent, "", headers); } _error->DumpErrors(std::cerr); messages.clear(); - if (closeConnection == true) - break; } close(client); std::clog << "CLOSE client " << client << std::endl; -- cgit v1.2.3 From c6bc9735cf1486d40d85bba90cfc3aaa6537a9c0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 10 Dec 2014 22:26:59 +0100 Subject: do not make PTY slave the controlling terminal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we have no controlling terminal opening a terminal will make this terminal our controller, which is a serious problem if this happens to be the pseudo terminal we created to run dpkg in as we will close this terminal at the end hanging ourself up in the process… The offending open is the one we do to have at least one slave fd open all the time, but for good measure, we apply the flag also to the slave fd opening in the child process as we set the controlling terminal explicitely here. This is a regression from 150bdc9ca5d656f9fba94d37c5f4f183b02bd746 with the slight twist that this usecase was silently broken before in that it wasn't logging the output in term.log (as a pseudo terminal wasn't created). Closes: 772641 --- .../test-no-fds-leaked-to-maintainer-scripts | 60 +++++++++++++--------- 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index cde987bd6..a7d556b87 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -26,20 +26,25 @@ setupaptarchive rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess aptget install -y fdleaks -qq < /dev/null -msgtest 'Check if fds were not' 'leaked' -if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then - msgpass -else - echo - cat rootdir/tmp/testsuccess.output - msgfail -fi -cp rootdir/tmp/testsuccess.output terminal.output -tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log -testfileequal 'terminal.log' "$(cat terminal.output)" +checkfdleak() { + msgtest 'Check if fds were not' 'leaked' + if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = "$1" ]; then + msgpass + else + echo + cat rootdir/tmp/testsuccess.output + msgfail + fi +} +checkinstall() { + checkfdleak 8 + + cp rootdir/tmp/testsuccess.output terminal.output + tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log + testfileequal 'terminal.log' "$(cat terminal.output)" -testequal "startup archives unpack + testequal "startup archives unpack install $PKGNAME 1.0 status half-installed $PKGNAME 1.0 status unpacked $PKGNAME 1.0 @@ -50,22 +55,19 @@ status unpacked $PKGNAME 1.0 status half-configured $PKGNAME 1.0 status installed $PKGNAME 1.0 startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log +} +checkinstall rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess aptget purge -y fdleaks -qq -msgtest 'Check if fds were not' 'leaked' -if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then - msgpass -else - echo - cat rootdir/tmp/testsuccess.output - msgfail -fi -cp rootdir/tmp/testsuccess.output terminal.output -tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log -testfileequal 'terminal.log' "$(cat terminal.output)" +checkpurge() { + checkfdleak 12 + + cp rootdir/tmp/testsuccess.output terminal.output + tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log + testfileequal 'terminal.log' "$(cat terminal.output)" -testequal "startup packages purge + testequal "startup packages purge status installed $PKGNAME 1.0 remove $PKGNAME 1.0 status half-configured $PKGNAME 1.0 @@ -79,3 +81,13 @@ status config-files $PKGNAME 1.0 status config-files $PKGNAME 1.0 status not-installed $PKGNAME startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log +} +checkpurge + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" install -y fdleaks -qq < /dev/null +checkinstall + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq +checkpurge -- cgit v1.2.3 From 92e8c1ff287ab829de825e00cdf94744e699ff97 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 29 Nov 2014 17:59:52 +0100 Subject: dispose http(s) 416 error page as non-content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Real webservers (like apache) actually send an error page with a 416 response, but our client didn't expect it leaving the page on the socket to be parsed as response for the next request (http) or as file content (https), which isn't what we want at all… Symptom is a "Bad header line" as html usually doesn't parse that well to an http-header. This manifests itself e.g. if we have a complete file (or larger) in partial/ which isn't discarded by If-Range as the server doesn't support it (or it is just newer, think: mirror rotation). It is a sort-of regression of 78c72d0ce22e00b194251445aae306df357d5c1a, which removed the filesize - 1 trick, but this had its own problems… To properly test this our webserver gains the ability to reply with transfer-encoding: chunked as most real webservers will use it to send the dynamically generated error pages. (The tests and their binary helpers had to be slightly modified to apply, but the patch to fix the issue itself is unchanged.) Closes: 768797 --- test/integration/framework | 6 +- test/integration/test-apt-helper | 24 ++-- test/integration/test-partial-file-support | 62 +++++++++- test/interactive-helper/aptwebserver.cc | 181 ++++++++++++++++++----------- 4 files changed, 188 insertions(+), 85 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index df1942ff9..ac482a7a0 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1064,8 +1064,8 @@ acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom } downloadfile() { - local PROTO="$(echo "$1" | cut -d':' -f 1 )" - apthelper -o Debug::Acquire::${PROTO}=1 \ + local PROTO="${1%%:*}" + apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ download-file "$1" "$2" 2>&1 || true # only if the file exists the download was successful if [ -e "$2" ]; then @@ -1221,7 +1221,7 @@ testsuccess() { msgtest 'Test for successful execution of' "$*" fi local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" - if $@ >${OUTPUT} 2>&1; then + if "$@" >${OUTPUT} 2>&1; then msgpass else echo >&2 diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index c749224ca..31e471677 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -10,34 +10,36 @@ configarchitecture "i386" changetohttpswebserver test_apt_helper_download() { - echo "foo" > aptarchive/foo + echo 'foo' > aptarchive/foo + echo 'bar' > aptarchive/foo2 msgtest 'apt-file download-file md5sum' - apthelper -qq download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 testfileequal foo2 'foo' msgtest 'apt-file download-file sha1' - apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 testfileequal foo1 'foo' msgtest 'apt-file download-file sha256' - apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c testfileequal foo3 'foo' msgtest 'apt-file download-file no-hash' - apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo4 testfileequal foo4 'foo' msgtest 'apt-file download-file wrong hash' - if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then - msgpass - else - msgfail - fi - testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch + testfailure --nomsg apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc + testfileequal rootdir/tmp/testfailure.output 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch E: Download Failed' testfileequal foo5.FAILED 'foo' + + msgtest 'apt-file download-file md5sum sha1' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo6 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 http://localhost:8080/foo2 foo7 SHA1:e242ed3bffccdf271b7fbaf34ed72d089537b42f + testfileequal foo6 'foo' + testfileequal foo7 'bar' } test_apt_helper_detect_proxy() { diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support index 5ab326def..160d451b6 100755 --- a/test/integration/test-partial-file-support +++ b/test/integration/test-partial-file-support @@ -24,13 +24,25 @@ testdownloadfile() { else msgpass fi - cat "$DOWNLOADLOG" | while read field hash; do + sed -e '/^ <- / s#%20# #g' -e '/^ <- / s#%0a#\n#g' "$DOWNLOADLOG" | grep '^.*-Hash: ' > receivedhashes.log + testsuccess test -s receivedhashes.log + local HASHES_OK=0 + local HASHES_BAD=0 + while read field hash; do local EXPECTED case "$field" in 'MD5Sum-Hash:') EXPECTED="$(md5sum "$TESTFILE" | cut -d' ' -f 1)";; 'SHA1-Hash:') EXPECTED="$(sha1sum "$TESTFILE" | cut -d' ' -f 1)";; 'SHA256-Hash:') EXPECTED="$(sha256sum "$TESTFILE" | cut -d' ' -f 1)";; 'SHA512-Hash:') EXPECTED="$(sha512sum "$TESTFILE" | cut -d' ' -f 1)";; + 'Checksum-FileSize-Hash:') + #filesize is too weak to check for != + if [ "$4" = '=' ]; then + EXPECTED="$(stat -c '%s' "$TESTFILE")" + else + continue + fi + ;; *) continue;; esac if [ "$4" = '=' ]; then @@ -40,15 +52,41 @@ testdownloadfile() { fi if [ "$EXPECTED" "$4" "$hash" ]; then msgpass + HASHES_OK=$((HASHES_OK+1)); else - cat >&2 "$DOWNLOADLOG" msgfail "expected: $EXPECTED ; got: $hash" + HASHES_BAD=$((HASHES_BAD+1)); fi - done + done < receivedhashes.log + msgtest 'At least one good hash and no bad ones' + if [ $HASHES_OK -eq 0 ] || [ $HASHES_BAD -ne 0 ]; then + cat >&2 "$DOWNLOADLOG" + msgfail + else + msgpass + fi } TESTFILE='aptarchive/testfile' cp -a ${TESTDIR}/framework $TESTFILE +cp -a ${TESTDIR}/framework "${TESTFILE}2" + +followuprequest() { + local DOWN='./testfile' + + copysource $TESTFILE 1M $DOWN + testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' + testwebserverlaststatuscode '416' "$DOWNLOADLOG" + + copysource $TESTFILE 1M $DOWN + copysource "${TESTFILE}2" 20 "${DOWN}2" + msgtest 'Testing download of files with' 'completely downloaded file + partial file' + testsuccess --nomsg apthelper -o Debug::Acquire::${1%%:*}=1 -o Debug::pkgAcquire::Worker=1 \ + download-file "$1/testfile" "$DOWN" '' "$1/testfile2" "${DOWN}2" + testwebserverlaststatuscode '206' 'rootdir/tmp/testsuccess.output' + testsuccess diff -u "$TESTFILE" "${DOWN}" + testsuccess diff -u "${DOWN}" "${DOWN}2" +} testrun() { webserverconfig 'aptwebserver::support::range' 'true' @@ -65,9 +103,11 @@ testrun() { testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!=' testwebserverlaststatuscode '206' "$DOWNLOADLOG" - copysource $TESTFILE 1M ./testfile - testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '416' "$DOWNLOADLOG" + webserverconfig 'aptwebserver::closeOnError' 'false' + followuprequest "$1" + webserverconfig 'aptwebserver::closeOnError' 'true' + followuprequest "$1" + webserverconfig 'aptwebserver::closeOnError' 'false' copysource /dev/zero 1M ./testfile testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '=' @@ -85,8 +125,18 @@ testrun() { testwebserverlaststatuscode '200' "$DOWNLOADLOG" } +msgmsg 'http: Test with Content-Length' +webserverconfig 'aptwebserver::chunked-transfer-encoding' 'false' +testrun 'http://localhost:8080' +msgmsg 'http: Test with Transfer-Encoding: chunked' +webserverconfig 'aptwebserver::chunked-transfer-encoding' 'true' testrun 'http://localhost:8080' changetohttpswebserver +msgmsg 'https: Test with Content-Length' +webserverconfig 'aptwebserver::chunked-transfer-encoding' 'false' +testrun 'https://localhost:4433' +msgmsg 'https: Test with Transfer-Encoding: chunked' +webserverconfig 'aptwebserver::chunked-transfer-encoding' 'true' testrun 'https://localhost:4433' diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 34476e1af..cd52da692 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -19,6 +19,8 @@ #include #include #include + +#include #include #include #include @@ -79,12 +81,21 @@ static char const * httpcodeToStr(int const httpcode) /*{{{*/ return NULL; } /*}}}*/ +static bool chunkedTransferEncoding(std::list const &headers) { + if (std::find(headers.begin(), headers.end(), "Transfer-Encoding: chunked") != headers.end()) + return true; + if (_config->FindB("aptwebserver::chunked-transfer-encoding", false) == true) + return true; + return false; +} static void addFileHeaders(std::list &headers, FileFd &data)/*{{{*/ { - std::ostringstream contentlength; - contentlength << "Content-Length: " << data.FileSize(); - headers.push_back(contentlength.str()); - + if (chunkedTransferEncoding(headers) == false) + { + std::ostringstream contentlength; + contentlength << "Content-Length: " << data.FileSize(); + headers.push_back(contentlength.str()); + } std::string lastmodified("Last-Modified: "); lastmodified.append(TimeRFC1123(data.ModificationTime())); headers.push_back(lastmodified); @@ -92,9 +103,12 @@ static void addFileHeaders(std::list &headers, FileFd &data)/*{{{*/ /*}}}*/ static void addDataHeaders(std::list &headers, std::string &data)/*{{{*/ { - std::ostringstream contentlength; - contentlength << "Content-Length: " << data.size(); - headers.push_back(contentlength.str()); + if (chunkedTransferEncoding(headers) == false) + { + std::ostringstream contentlength; + contentlength << "Content-Length: " << data.size(); + headers.push_back(contentlength.str()); + } } /*}}}*/ static bool sendHead(int const client, int const httpcode, std::list &headers)/*{{{*/ @@ -114,6 +128,9 @@ static bool sendHead(int const client, int const httpcode, std::list>> RESPONSE to " << client << " >>>" << std::endl; bool Success = true; for (std::list::const_iterator h = headers.begin(); @@ -130,25 +147,55 @@ static bool sendHead(int const client, int const httpcode, std::list const &headers, FileFd &data)/*{{{*/ { bool Success = true; + bool const chunked = chunkedTransferEncoding(headers); char buffer[500]; unsigned long long actual = 0; while ((Success &= data.Read(buffer, sizeof(buffer), &actual)) == true) { if (actual == 0) break; - Success &= FileFd::Write(client, buffer, actual); + + if (chunked == true) + { + std::string size; + strprintf(size, "%llX\r\n", actual); + Success &= FileFd::Write(client, size.c_str(), size.size()); + Success &= FileFd::Write(client, buffer, actual); + Success &= FileFd::Write(client, "\r\n", strlen("\r\n")); + } + else + Success &= FileFd::Write(client, buffer, actual); + } + if (chunked == true) + { + char const * const finish = "0\r\n\r\n"; + Success &= FileFd::Write(client, finish, strlen(finish)); } if (Success == false) - std::cerr << "SENDFILE: READ/WRITE ERROR to " << client << std::endl; + std::cerr << "SENDFILE:" << (chunked ? " CHUNKED" : "") << " READ/WRITE ERROR to " << client << std::endl; return Success; } /*}}}*/ -static bool sendData(int const client, std::string const &data) /*{{{*/ +static bool sendData(int const client, std::list const &headers, std::string const &data)/*{{{*/ { - if (FileFd::Write(client, data.c_str(), data.size()) == false) + if (chunkedTransferEncoding(headers) == true) + { + unsigned long long const ullsize = data.length(); + std::string size; + strprintf(size, "%llX\r\n", ullsize); + char const * const finish = "\r\n0\r\n\r\n"; + if (FileFd::Write(client, size.c_str(), size.length()) == false || + FileFd::Write(client, data.c_str(), ullsize) == false || + FileFd::Write(client, finish, strlen(finish)) == false) + { + std::cerr << "SENDDATA: CHUNK WRITE ERROR to " << client << std::endl; + return false; + } + } + else if (FileFd::Write(client, data.c_str(), data.size()) == false) { std::cerr << "SENDDATA: WRITE ERROR to " << client << std::endl; return false; @@ -157,34 +204,38 @@ static bool sendData(int const client, std::string const &data) /*{{{*/ } /*}}}*/ static void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ - bool content, std::string const &error = "") + bool const content, std::string const &error, std::list &headers) { - std::list headers; std::string response(""); response.append(httpcodeToStr(httpcode)).append(""); response.append("

").append(httpcodeToStr(httpcode)).append("

"); if (httpcode != 200) - { - if (error.empty() == false) - response.append("

Error: ").append(error).append("

"); - response.append("This error is a result of the request:
");
-   }
+      response.append("

Error: "); + else + response.append("

Success: "); + if (error.empty() == false) + response.append(error); + else + response.append(httpcodeToStr(httpcode)); + if (httpcode != 200) + response.append("

This error is a result of the request:
");
    else
-   {
-      if (error.empty() == false)
-	 response.append("

Success: ").append(error).append("

"); response.append("The successfully executed operation was requested by:
");
-   }
    response.append(request).append("
"); + if (httpcode != 200) + { + if (_config->FindB("aptwebserver::closeOnError", false) == true) + headers.push_back("Connection: close"); + } addDataHeaders(headers, response); sendHead(client, httpcode, headers); if (content == true) - sendData(client, response); + sendData(client, headers, response); } static void sendSuccess(int const client, std::string const &request, - bool content, std::string const &error = "") + bool const content, std::string const &error, std::list &headers) { - sendError(client, 200, request, content, error); + sendError(client, 200, request, content, error, headers); } /*}}}*/ static void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/ @@ -221,7 +272,7 @@ static void sendRedirect(int const client, int const httpcode, std::string const headers.push_back(location); sendHead(client, httpcode, headers); if (content == true) - sendData(client, response); + sendData(client, headers, response); } /*}}}*/ static int filter_hidden_files(const struct dirent *a) /*{{{*/ @@ -263,16 +314,15 @@ static int grouped_alpha_case_sort(const struct dirent **a, const struct dirent } /*}}}*/ static void sendDirectoryListing(int const client, std::string const &dir,/*{{{*/ - std::string const &request, bool content) + std::string const &request, bool content, std::list &headers) { - std::list headers; std::ostringstream listing; struct dirent **namelist; int const counter = scandir(dir.c_str(), &namelist, filter_hidden_files, grouped_alpha_case_sort); if (counter == -1) { - sendError(client, 500, request, content); + sendError(client, 500, request, content, "scandir failed", headers); return; } @@ -311,18 +361,18 @@ static void sendDirectoryListing(int const client, std::string const &dir,/*{{{* addDataHeaders(headers, response); sendHead(client, 200, headers); if (content == true) - sendData(client, response); + sendData(client, headers, response); } /*}}}*/ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ std::string &filename, std::string ¶ms, bool &sendContent, - bool &closeConnection) + bool &closeConnection, std::list &headers) { if (strncmp(request.c_str(), "HEAD ", 5) == 0) sendContent = false; if (strncmp(request.c_str(), "GET ", 4) != 0) { - sendError(client, 501, request, true); + sendError(client, 501, request, true, "", headers); return false; } @@ -333,7 +383,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ if (lineend == std::string::npos || filestart == std::string::npos || fileend == std::string::npos || filestart == fileend) { - sendError(client, 500, request, sendContent, "Filename can't be extracted"); + sendError(client, 500, request, sendContent, "Filename can't be extracted", headers); return false; } @@ -345,14 +395,14 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ closeConnection = strcasecmp(LookupTag(request, "Connection", "Keep-Alive").c_str(), "close") == 0; else { - sendError(client, 500, request, sendContent, "Not a HTTP/1.{0,1} request"); + sendError(client, 500, request, sendContent, "Not a HTTP/1.{0,1} request", headers); return false; } filename = request.substr(filestart, fileend - filestart); if (filename.find(' ') != std::string::npos) { - sendError(client, 500, request, sendContent, "Filename contains an unencoded space"); + sendError(client, 500, request, sendContent, "Filename contains an unencoded space", headers); return false; } @@ -360,7 +410,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ if (host.empty() == true) { // RFC 2616 §14.23 requires Host - sendError(client, 400, request, sendContent, "Host header is required"); + sendError(client, 400, request, sendContent, "Host header is required", headers); return false; } host = "http://" + host; @@ -371,7 +421,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ { if (absolute.find("uri") == std::string::npos) { - sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that"); + sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that", headers); return false; } // strip the host from the request to make it an absolute path @@ -379,7 +429,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ } else if (absolute.find("path") == std::string::npos) { - sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that"); + sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that", headers); return false; } @@ -398,7 +448,8 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ filename.find_first_of("\r\n\t\f\v") != std::string::npos || filename.find("/../") != std::string::npos) { - sendError(client, 400, request, sendContent, "Filename contains illegal character (sequence)"); + std::list headers; + sendError(client, 400, request, sendContent, "Filename contains illegal character (sequence)", headers); return false; } @@ -434,46 +485,45 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ return true; } /*}}}*/ -static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector const &parts)/*{{{*/ +static bool handleOnTheFlyReconfiguration(int const client, std::string const &request,/*{{{*/ + std::vector parts, std::list &headers) { size_t const pcount = parts.size(); if (pcount == 4 && parts[1] == "set") { _config->Set(parts[2], parts[3]); - sendSuccess(client, request, true, "Option '" + parts[2] + "' was set to '" + parts[3] + "'!"); + sendSuccess(client, request, true, "Option '" + parts[2] + "' was set to '" + parts[3] + "'!", headers); return true; } else if (pcount == 4 && parts[1] == "find") { - std::list headers; std::string response = _config->Find(parts[2], parts[3]); addDataHeaders(headers, response); sendHead(client, 200, headers); - sendData(client, response); + sendData(client, headers, response); return true; } else if (pcount == 3 && parts[1] == "find") { - std::list headers; if (_config->Exists(parts[2]) == true) { std::string response = _config->Find(parts[2]); addDataHeaders(headers, response); sendHead(client, 200, headers); - sendData(client, response); + sendData(client, headers, response); return true; } - sendError(client, 404, request, "Requested Configuration option doesn't exist."); + sendError(client, 404, request, true, "Requested Configuration option doesn't exist", headers); return false; } else if (pcount == 3 && parts[1] == "clear") { _config->Clear(parts[2]); - sendSuccess(client, request, true, "Option '" + parts[2] + "' was cleared."); + sendSuccess(client, request, true, "Option '" + parts[2] + "' was cleared.", headers); return true; } - sendError(client, 400, request, true, "Unknown on-the-fly configuration request"); + sendError(client, 400, request, true, "Unknown on-the-fly configuration request", headers); return false; } /*}}}*/ @@ -482,18 +532,22 @@ static void * handleClient(void * voidclient) /*{{{*/ int client = *((int*)(voidclient)); std::clog << "ACCEPT client " << client << std::endl; std::vector messages; - while (ReadMessages(client, messages)) + bool closeConnection = false; + std::list headers; + while (closeConnection == false && ReadMessages(client, messages)) { - bool closeConnection = false; + // if we announced a closing, do the close + if (std::find(headers.begin(), headers.end(), std::string("Connection: close")) != headers.end()) + break; + headers.clear(); for (std::vector::const_iterator m = messages.begin(); m != messages.end() && closeConnection == false; ++m) { std::clog << ">>> REQUEST from " << client << " >>>" << std::endl << *m << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; - std::list headers; std::string filename; std::string params; bool sendContent = true; - if (parseFirstLine(client, *m, filename, params, sendContent, closeConnection) == false) + if (parseFirstLine(client, *m, filename, params, sendContent, closeConnection, headers) == false) continue; // special webserver command request @@ -502,7 +556,7 @@ static void * handleClient(void * voidclient) /*{{{*/ std::vector parts = VectorizeString(filename, '/'); if (parts[0] == "_config") { - handleOnTheFlyReconfiguration(client, *m, parts); + handleOnTheFlyReconfiguration(client, *m, parts, headers); continue; } } @@ -534,7 +588,7 @@ static void * handleClient(void * voidclient) /*{{{*/ { char error[300]; regerror(res, pattern, error, sizeof(error)); - sendError(client, 500, *m, sendContent, error); + sendError(client, 500, *m, sendContent, error, headers); continue; } if (regexec(pattern, filename.c_str(), 0, 0, 0) == 0) @@ -553,7 +607,7 @@ static void * handleClient(void * voidclient) /*{{{*/ if (_config->FindB("aptwebserver::support::http", true) == false && LookupTag(*m, "Host").find(":4433") == std::string::npos) { - sendError(client, 400, *m, sendContent, "HTTP disabled, all requests must be HTTPS"); + sendError(client, 400, *m, sendContent, "HTTP disabled, all requests must be HTTPS", headers); continue; } else if (RealFileExists(filename) == true) @@ -609,17 +663,16 @@ static void * handleClient(void * voidclient) /*{{{*/ headers.push_back(contentrange.str()); sendHead(client, 206, headers); if (sendContent == true) - sendFile(client, data); + sendFile(client, headers, data); continue; } else { - headers.push_back("Content-Length: 0"); std::ostringstream contentrange; contentrange << "Content-Range: bytes */" << filesize; headers.push_back(contentrange.str()); - sendHead(client, 416, headers); - continue; + sendError(client, 416, *m, sendContent, "", headers); + break; } } } @@ -628,22 +681,20 @@ static void * handleClient(void * voidclient) /*{{{*/ addFileHeaders(headers, data); sendHead(client, 200, headers); if (sendContent == true) - sendFile(client, data); + sendFile(client, headers, data); } else if (DirectoryExists(filename) == true) { if (filename[filename.length()-1] == '/') - sendDirectoryListing(client, filename, *m, sendContent); + sendDirectoryListing(client, filename, *m, sendContent, headers); else sendRedirect(client, 301, filename.append("/"), *m, sendContent); } else - sendError(client, 404, *m, sendContent); + sendError(client, 404, *m, sendContent, "", headers); } _error->DumpErrors(std::cerr); messages.clear(); - if (closeConnection == true) - break; } close(client); std::clog << "CLOSE client " << client << std::endl; -- cgit v1.2.3 From e18f6133b254db9e1dc7b202366b067b15a68123 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 10 Dec 2014 22:26:59 +0100 Subject: do not make PTY slave the controlling terminal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we have no controlling terminal opening a terminal will make this terminal our controller, which is a serious problem if this happens to be the pseudo terminal we created to run dpkg in as we will close this terminal at the end hanging ourself up in the process… The offending open is the one we do to have at least one slave fd open all the time, but for good measure, we apply the flag also to the slave fd opening in the child process as we set the controlling terminal explicitely here. This is a regression from 150bdc9ca5d656f9fba94d37c5f4f183b02bd746 with the slight twist that this usecase was silently broken before in that it wasn't logging the output in term.log (as a pseudo terminal wasn't created). Closes: 772641 --- test/integration/framework | 2 +- .../test-no-fds-leaked-to-maintainer-scripts | 109 +++++++++++++-------- 2 files changed, 68 insertions(+), 43 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index ac482a7a0..9e183057f 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -102,7 +102,7 @@ runapt() { local CMD="$1" shift case $CMD in - sh|aptitude|*/*) ;; + sh|aptitude|*/*|command) ;; *) CMD="${BUILDDIRECTORY}/$CMD";; esac MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@" diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 3c6457cab..6eb033055 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -5,7 +5,7 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture 'native' +configarchitecture 'amd64' 'i386' configdpkgnoopchroot setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable' @@ -17,58 +17,83 @@ done buildpackage "$BUILDDIR" 'unstable' 'main' 'native' rm -rf "$BUILDDIR" +PKGNAME='fdleaks:all' +if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null >/dev/null 2>&1; then + PKGNAME='fdleaks' +fi + setupaptarchive rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess aptget install -y fdleaks -qq < /dev/null -msgtest 'Check if fds were not' 'leaked' -if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '8' ]; then - msgpass -else - echo - cat rootdir/tmp/testsuccess.output - msgfail -fi -cp rootdir/tmp/testsuccess.output terminal.output -tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log -testfileequal 'terminal.log' "$(cat terminal.output)" +checkfdleak() { + msgtest 'Check if fds were not' 'leaked' + if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = "$1" ]; then + msgpass + else + echo + cat rootdir/tmp/testsuccess.output + msgfail + fi +} +checkinstall() { + checkfdleak 8 + + cp rootdir/tmp/testsuccess.output terminal.output + tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log + testfileequal 'terminal.log' "$(cat terminal.output)" -testequal 'startup archives unpack -install fdleaks:all 1.0 -status half-installed fdleaks:all 1.0 -status unpacked fdleaks:all 1.0 -status unpacked fdleaks:all 1.0 + testequal "startup archives unpack +install $PKGNAME 1.0 +status half-installed $PKGNAME 1.0 +status unpacked $PKGNAME 1.0 +status unpacked $PKGNAME 1.0 startup packages configure -configure fdleaks:all 1.0 -status unpacked fdleaks:all 1.0 -status half-configured fdleaks:all 1.0 -status installed fdleaks:all 1.0' cut -f 3- -d' ' rootdir/var/log/dpkg.log +configure $PKGNAME 1.0 +status unpacked $PKGNAME 1.0 +status half-configured $PKGNAME 1.0 +status installed $PKGNAME 1.0" cut -f 3- -d' ' rootdir/var/log/dpkg.log +} +checkinstall rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess aptget purge -y fdleaks -qq -msgtest 'Check if fds were not' 'leaked' -if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = '12' ]; then +checkpurge() { + checkfdleak 12 + + cp rootdir/tmp/testsuccess.output terminal.output + tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log + testfileequal 'terminal.log' "$(cat terminal.output)" + + testequal "startup packages purge +status installed $PKGNAME 1.0 +remove $PKGNAME 1.0 +status half-configured $PKGNAME 1.0 +status half-installed $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +purge $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +status not-installed $PKGNAME " cut -f 3- -d' ' rootdir/var/log/dpkg.log +} +checkpurge + +msgtest 'setsid provided is new enough to support' '-w' +if dpkg-checkbuilddeps -d 'util-linux (>= 2.24.2-1)' /dev/null >/dev/null 2>&1; then msgpass else - echo - cat rootdir/tmp/testsuccess.output - msgfail + msgskip "$(command dpkg -l util-linux)" + exit fi -cp rootdir/tmp/testsuccess.output terminal.output -tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log -testfileequal 'terminal.log' "$(cat terminal.output)" -testequal 'startup packages purge -status installed fdleaks:all 1.0 -remove fdleaks:all 1.0 -status half-configured fdleaks:all 1.0 -status half-installed fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -purge fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status config-files fdleaks:all 1.0 -status not-installed fdleaks:all ' cut -f 3- -d' ' rootdir/var/log/dpkg.log +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" install -y fdleaks -qq < /dev/null +checkinstall + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq +checkpurge -- cgit v1.2.3 From a2a75ff4516f7609f4c55b42270abb8d08943c60 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 18 Nov 2014 19:53:56 +0100 Subject: always run 'dpkg --configure -a' at the end of our dpkg callings dpkg checks now for dependencies before running triggers, so that packages can now end up in trigger states (especially those we are not touching at all with our calls) after apt is done running. The solution to this is trivial: Just tell dpkg to configure everything after we have (supposely) configured everything already. In the worst case this means dpkg will have to run a bunch of triggers, usually it will just do nothing though. The code to make this happen was already available, so we just flip a config option here to cause it to be run. This way we can keep pretending that triggers are an implementation detail of dpkg. --triggers-only would supposely work as well, but --configure is more robust in regards to future changes to dpkg and something we will hopefully make use of in future versions anyway (as it was planed at the time this and related options were implemented). Note that dpkg currently has a workaround implemented to allow upgrades to jessie to be clean, so that the test works before and after. Also note that test (compared to the one in the bug) drops the await test as its is considered a loop by dpkg now. Closes: 769609 --- test/integration/framework | 25 ++++---- test/integration/test-apt-progress-fd | 67 ++++++++++--------- test/integration/test-apt-progress-fd-deb822 | 18 ++++-- test/integration/test-apt-progress-fd-error | 2 +- ...est-bug-769609-triggers-still-pending-after-run | 75 ++++++++++++++++++++++ .../test-no-fds-leaked-to-maintainer-scripts | 6 +- 6 files changed, 139 insertions(+), 54 deletions(-) create mode 100755 test/integration/test-bug-769609-triggers-still-pending-after-run (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 9e183057f..c9445065b 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1178,10 +1178,13 @@ testnopackage() { fi } -testdpkginstalled() { - msgtest "Test for correctly installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)" - if [ "$PKGS" != $# ]; then +testdpkgstatus() { + local STATE="$1" + local NR="$2" + shift 2 + msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" + local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" + if [ "$PKGS" != $NR ]; then echo >&2 $PKGS dpkg -l "$@" | grep '^[a-z]' >&2 msgfail @@ -1190,16 +1193,12 @@ testdpkginstalled() { fi } +testdpkginstalled() { + testdpkgstatus 'ii' "$#" "$@" +} + testdpkgnotinstalled() { - msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)" - if [ "$PKGS" != 0 ]; then - echo - dpkg -l "$@" | grep '^[a-z]' >&2 - msgfail - else - msgpass - fi + testdpkgstatus 'ii' '0' "$@" } testmarkedauto() { diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd index d72e7e72d..68cc0439c 100755 --- a/test/integration/test-apt-progress-fd +++ b/test/integration/test-apt-progress-fd @@ -19,13 +19,14 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:0:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) -pmstatus:testing:20:Preparing testing (amd64) -pmstatus:testing:40:Unpacking testing (amd64) -pmstatus:testing:60:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:60:Running dpkg -pmstatus:testing:60:Configuring testing (amd64) -pmstatus:testing:80:Configuring testing (amd64) -pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log +pmstatus:testing:16.6667:Preparing testing (amd64) +pmstatus:testing:33.3333:Unpacking testing (amd64) +pmstatus:testing:50:Preparing to configure testing (amd64) +pmstatus:dpkg-exec:50:Running dpkg +pmstatus:testing:50:Configuring testing (amd64) +pmstatus:testing:66.6667:Configuring testing (amd64) +pmstatus:testing:83.3333:Installed testing (amd64) +pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log # upgrade exec 3> apt-progress.log @@ -34,13 +35,14 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:0:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) -pmstatus:testing:20:Preparing testing (amd64) -pmstatus:testing:40:Unpacking testing (amd64) -pmstatus:testing:60:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:60:Running dpkg -pmstatus:testing:60:Configuring testing (amd64) -pmstatus:testing:80:Configuring testing (amd64) -pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log +pmstatus:testing:16.6667:Preparing testing (amd64) +pmstatus:testing:33.3333:Unpacking testing (amd64) +pmstatus:testing:50:Preparing to configure testing (amd64) +pmstatus:dpkg-exec:50:Running dpkg +pmstatus:testing:50:Configuring testing (amd64) +pmstatus:testing:66.6667:Configuring testing (amd64) +pmstatus:testing:83.3333:Installed testing (amd64) +pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log # reinstall exec 3> apt-progress.log @@ -49,22 +51,24 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:0:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) -pmstatus:testing:20:Preparing testing (amd64) -pmstatus:testing:40:Unpacking testing (amd64) -pmstatus:testing:60:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:60:Running dpkg -pmstatus:testing:60:Configuring testing (amd64) -pmstatus:testing:80:Configuring testing (amd64) -pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log +pmstatus:testing:16.6667:Preparing testing (amd64) +pmstatus:testing:33.3333:Unpacking testing (amd64) +pmstatus:testing:50:Preparing to configure testing (amd64) +pmstatus:dpkg-exec:50:Running dpkg +pmstatus:testing:50:Configuring testing (amd64) +pmstatus:testing:66.6667:Configuring testing (amd64) +pmstatus:testing:83.3333:Installed testing (amd64) +pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log # and remove exec 3> apt-progress.log testsuccess aptget remove testing -y -o APT::Status-Fd=3 testequal "pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Removing testing (amd64) -pmstatus:testing:33.3333:Preparing for removal of testing (amd64) -pmstatus:testing:66.6667:Removing testing (amd64) -pmstatus:testing:100:Removed testing (amd64)" cat apt-progress.log +pmstatus:testing:25:Preparing for removal of testing (amd64) +pmstatus:testing:50:Removing testing (amd64) +pmstatus:testing:75:Removed testing (amd64) +pmstatus:dpkg-exec:75:Running dpkg" cat apt-progress.log # install non-native and ensure we get proper progress info exec 3> apt-progress.log @@ -75,12 +79,13 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:0:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing2:0:Installing testing2 (i386) -pmstatus:testing2:20:Preparing testing2 (i386) -pmstatus:testing2:40:Unpacking testing2 (i386) -pmstatus:testing2:60:Preparing to configure testing2 (i386) -pmstatus:dpkg-exec:60:Running dpkg -pmstatus:testing2:60:Configuring testing2 (i386) -pmstatus:testing2:80:Configuring testing2 (i386) -pmstatus:testing2:100:Installed testing2 (i386)" cat apt-progress.log +pmstatus:testing2:16.6667:Preparing testing2 (i386) +pmstatus:testing2:33.3333:Unpacking testing2 (i386) +pmstatus:testing2:50:Preparing to configure testing2 (i386) +pmstatus:dpkg-exec:50:Running dpkg +pmstatus:testing2:50:Configuring testing2 (i386) +pmstatus:testing2:66.6667:Configuring testing2 (i386) +pmstatus:testing2:83.3333:Installed testing2 (i386) +pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log rm -f apt-progress*.log diff --git a/test/integration/test-apt-progress-fd-deb822 b/test/integration/test-apt-progress-fd-deb822 index 9d227942d..badc985e4 100755 --- a/test/integration/test-apt-progress-fd-deb822 +++ b/test/integration/test-apt-progress-fd-deb822 @@ -27,37 +27,41 @@ Message: Installing testing (amd64) Status: progress Package: testing:amd64 -Percent: 20 +Percent: 16.6667 Message: Preparing testing (amd64) Status: progress Package: testing:amd64 -Percent: 40 +Percent: 33.3333 Message: Unpacking testing (amd64) Status: progress Package: testing:amd64 -Percent: 60 +Percent: 50 Message: Preparing to configure testing (amd64) Status: progress -Percent: 60 +Percent: 50 Message: Running dpkg Status: progress Package: testing:amd64 -Percent: 60 +Percent: 50 Message: Configuring testing (amd64) Status: progress Package: testing:amd64 -Percent: 80 +Percent: 66.6667 Message: Configuring testing (amd64) Status: progress Package: testing:amd64 -Percent: 100 +Percent: 83.3333 Message: Installed testing (amd64) + +Status: progress +Percent: 83.3333 +Message: Running dpkg " cat apt-progress.log diff --git a/test/integration/test-apt-progress-fd-error b/test/integration/test-apt-progress-fd-error index a47095b9b..632300765 100755 --- a/test/integration/test-apt-progress-fd-error +++ b/test/integration/test-apt-progress-fd-error @@ -18,7 +18,7 @@ setupaptarchive exec 3> apt-progress.log testfailure aptget install foo1 foo2 -y -o APT::Status-Fd=3 msgtest "Ensure correct error message" -if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:40:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then +if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:36.3636:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then msgpass else cat apt-progress.log diff --git a/test/integration/test-bug-769609-triggers-still-pending-after-run b/test/integration/test-bug-769609-triggers-still-pending-after-run new file mode 100755 index 000000000..146fa766b --- /dev/null +++ b/test/integration/test-bug-769609-triggers-still-pending-after-run @@ -0,0 +1,75 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +msgtest 'Check if installed dpkg supports' 'noawait trigger' +if dpkg-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; then + msgpass +else + msgskip 'dpkg version too old' + exit 0 +fi +configdpkgnoopchroot + +buildtriggerpackages() { + local TYPE="$1" + setupsimplenativepackage "triggerable-$TYPE" 'all' '1.0' 'unstable' "Depends: trigdepends-$TYPE" + BUILDDIR="incoming/triggerable-${TYPE}-1.0" + cat >${BUILDDIR}/debian/postinst < ${BUILDDIR}/debian/triggers + buildpackage "$BUILDDIR" 'unstable' 'main' 'native' + rm -rf "$BUILDDIR" + buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable' +} + +#buildtriggerpackages 'interest' +buildtriggerpackages 'interest-noawait' +buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable' + +setupaptarchive + +runtests() { + local TYPE="$1" + msgmsg 'Working with trigger type' "$TYPE" + testsuccess aptget install triggerable-$TYPE -y + cp rootdir/tmp/testsuccess.output terminal.output + testsuccess grep '^REWRITE ' terminal.output + testdpkginstalled triggerable-$TYPE trigdepends-$TYPE + + testsuccess aptget install trigdepends-$TYPE -y --reinstall + cp rootdir/tmp/testsuccess.output terminal.output + testsuccess grep '^REWRITE ' terminal.output + testsuccess grep ' root root ' terminal.output + testdpkginstalled triggerable-$TYPE trigdepends-$TYPE + + testsuccess aptget install trigstuff -y + cp rootdir/tmp/testsuccess.output terminal.output + testsuccess grep '^REWRITE ' terminal.output + testsuccess grep ' root root ' terminal.output + testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff + + testsuccess aptget purge trigstuff -y + cp rootdir/tmp/testsuccess.output terminal.output + testsuccess grep '^REWRITE ' terminal.output + testsuccess grep ' root root ' terminal.output + testdpkginstalled triggerable-$TYPE trigdepends-$TYPE + testdpkgnotinstalled trigstuff + + testsuccess aptget purge trigdepends-$TYPE -y + cp rootdir/tmp/testsuccess.output terminal.output + testfailure grep '^REWRITE ' terminal.output + testfailure grep ' root root ' terminal.output + testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE +} +#runtests 'interest' +runtests 'interest-noawait' diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 6eb033055..7d0c1c6c1 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -53,7 +53,8 @@ startup packages configure configure $PKGNAME 1.0 status unpacked $PKGNAME 1.0 status half-configured $PKGNAME 1.0 -status installed $PKGNAME 1.0" cut -f 3- -d' ' rootdir/var/log/dpkg.log +status installed $PKGNAME 1.0 +startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log } checkinstall @@ -78,7 +79,8 @@ status config-files $PKGNAME 1.0 status config-files $PKGNAME 1.0 status config-files $PKGNAME 1.0 status config-files $PKGNAME 1.0 -status not-installed $PKGNAME " cut -f 3- -d' ' rootdir/var/log/dpkg.log +status not-installed $PKGNAME +startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log } checkpurge -- cgit v1.2.3 From 748a2177dcf8ff72bca90f5c7d516559ddd67352 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 22 Dec 2014 23:14:08 +0100 Subject: pass-through stdin fd instead of content if not a terminal Commit 299aea924ccef428219ed6f1a026c122678429e6 fixes the problem of not logging terminal in case stdin & stdout are not a terminal. The problem is that we are then trying to pass-through stdin content by reading from the apt-process stdin and writing it to the stdin of the child (dpkg), which works great for users who can control themselves, but pipes and co are a bit less forgiving causing us to pass everything to the first child process, which if the sending part of the pipe is e.g. 'yes' we will never see the end of it (as the pipe is full at some point and further writing blocks). There is a simple solution for that of course: If stdin isn't a terminal, we us the apt-process stdin as stdin for the child directly (We don't do this if it is a terminal to be able to save the typed input in the log). Closes: 773061 --- .../test-no-fds-leaked-to-maintainer-scripts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 7d0c1c6c1..41c057042 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -11,8 +11,14 @@ configdpkgnoopchroot setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable' BUILDDIR="incoming/fdleaks-1.0" for script in 'preinst' 'postinst' 'prerm' 'postrm'; do - echo '#!/bin/sh -ls -l /proc/self/fd/' > ${BUILDDIR}/debian/$script + cat > ${BUILDDIR}/debian/$script << EOF +#!/bin/sh +if [ -e "$(pwd)/rootdir/tmp/read_stdin" ]; then + read line; + echo "STDIN: -\$line-" +fi +ls -l /proc/self/fd/ +EOF done buildpackage "$BUILDDIR" 'unstable' 'main' 'native' rm -rf "$BUILDDIR" @@ -99,3 +105,15 @@ checkinstall rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq checkpurge + +touch rootdir/tmp/read_stdin + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +for i in $(seq 1 10); do echo "$i"; done | testsuccess aptget install -y fdleaks -qq +checkinstall +testequal '2' grep -c '^STDIN: ' rootdir/var/log/apt/term.log + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +yes '' | testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq +checkpurge +testequal '3' grep -c '^STDIN: ' rootdir/var/log/apt/term.log -- cgit v1.2.3 From d13f2ef5dd2cf41d7abd7f309a9e8965a77d2a63 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 6 Jan 2015 10:54:24 +0100 Subject: Add regression test for the previous commit The issue was that https.cc never called URIStart(), one way to detect this is that no download progress is generated without this call. The test now checks for this and as a side-effect will also ensure that we do not break download progress reporting and Acquire::{http,https}::Dl-Limit accidently. --- test/integration/test-apt-download-progress | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 test/integration/test-apt-download-progress (limited to 'test') diff --git a/test/integration/test-apt-download-progress b/test/integration/test-apt-download-progress new file mode 100755 index 000000000..0a9020bec --- /dev/null +++ b/test/integration/test-apt-download-progress @@ -0,0 +1,43 @@ +#!/bin/sh +# +# ensure downloading sends progress as a regression test for commit 9127d7ae +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +changetohttpswebserver + +assertprogress() { + T="$1" + testsuccess grep "dlstatus:1:0:Retrieving file 1 of 1" "$T" + if ! egrep -q "dlstatus:1:[0-9]{1,2}\.(.*):Retrieving file 1 of 1" "$T"; then + cat "$T" + msgfail "Failed to detect download progress" + fi + testsuccess grep "dlstatus:1:100:Retrieving file 1 of 1" "$T" + #cat $T +} + +# we need to ensure the file is reasonable big so that apt has a chance to +# actually report progress - but not too big to ensure its not delaying the +# test too much +TESTFILE=testfile.big +testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=800k count=1 + +msgtest 'download progress works via' 'http' +printf '\n' +exec 3> apt-progress.log +testsuccess apthelper download-file "http://localhost:8080/$TESTFILE" http-$TESTFILE -o APT::Status-Fd=3 -o Acquire::http::Dl-Limit=800 +assertprogress apt-progress.log + +msgtest 'download progress works via' 'https' +printf '\n' +exec 3> apt-progress.log +testsuccess apthelper download-file "https://localhost:4433/$TESTFILE" https-$TESTFILE -o APT::Status-Fd=3 -o Acquire::https::Dl-Limit=800 +assertprogress apt-progress.log + +# cleanup +rm -f apt-progress*.log -- cgit v1.2.3 From 31be38d205406d4c756684e20b93d62c4701e091 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 9 Jan 2015 01:03:31 +0100 Subject: 128 KiB DSC files ought to be enough for everyone Your mileage may vary, but don't worry: There is more than one way to do it, but our one size fits all is not a bigger hammer, but an entire roundhouse kick! So brace yourself for the tl;dr: The limit is gone.* Beware: This fixes also the problem that a double newline is unconditionally added 'later' which is an overcommitment in case the dsc filesize is limit-2 <= x <= limit. * limited to numbers fitting into an unsigned long long. Closes: 774893 --- test/integration/framework | 2 +- test/integration/test-apt-ftparchive-src-cachedb | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index c9445065b..70ad381e9 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -780,7 +780,7 @@ buildaptarchivefromincoming() { [ -e ftparchive.conf ] || createaptftparchiveconfig [ -e dists ] || buildaptftparchivedirectorystructure msgninfo "\tGenerate Packages, Sources and Contents files… " - aptftparchive -qq generate ftparchive.conf + testsuccess aptftparchive generate ftparchive.conf cd - > /dev/null msgdone "info" generatereleasefiles diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index adcca6217..0ac4d558f 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -180,10 +180,6 @@ testequal " E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid rm -f aptarchive/pool/invalid/invalid_1.0.dsc -dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null -testequal " -E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid - # ensure clean works rm -f aptarchive/pool/main/* aptftparchive clean apt-ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1 -- cgit v1.2.3 From 77b6f202e1629b7794a03b6522d636ff1436d074 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 10 Jan 2015 12:31:18 +0100 Subject: award points for positive dependencies again Commit 9ec748ff103840c4c65471ca00d3b72984131ce4 from Feb 23 last year adds a version check after 8daf68e366fa9fa2794ae667f51562663856237c added 8 days earlier negative points for breaks/conflicts with the intended that only dependencies which are satisfied propagate points (aka: old conflicts do not). The implementation was needlessly complex and flawed through preventing positive dependencies from gaining points like they did before these commits making library transitions harder instead of simpler. It worked out anyhow most of the time out of pure 'luck' (and other ways of gaining points) or got miss attributed to being a temporary hick-up. Closes: 774924 --- .../test-allow-scores-for-all-dependency-types | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test') diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types index a5c98f3d6..d60cb8daf 100755 --- a/test/integration/test-allow-scores-for-all-dependency-types +++ b/test/integration/test-allow-scores-for-all-dependency-types @@ -32,6 +32,11 @@ insertpackage 'multipleyes' 'foo' 'amd64' '2.2' 'Conflicts: bar (<= 3)' # having foo multiple times as conflict is a non-advisable hack in general insertpackage 'multipleyes' 'bar' 'amd64' '2.2' 'Conflicts: foo (<= 3), foo (<= 3)' +#774924 - slightly simplified +insertpackage 'jessie' 'login' 'amd64' '2' 'Pre-Depends: libaudit1 (>= 0)' +insertpackage 'jessie' 'libaudit1' 'amd64' '2' 'Depends: libaudit-common (>= 0)' +insertpackage 'jessie' 'libaudit-common' 'amd64' '2' 'Breaks: libaudit0, libaudit1 (<< 2)' + cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup setupaptarchive @@ -142,3 +147,26 @@ Inst foo [1] (2 versioned [amd64]) Inst baz (2 versioned [amd64]) Conf foo (2 versioned [amd64]) Conf baz (2 versioned [amd64])' aptget install baz -st versioned + +# recreating the exact situation is hard, so we pull tricks to get the score +cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status +insertinstalledpackage 'gdm3' 'amd64' '1' 'Depends: libaudit0, libaudit0' +insertinstalledpackage 'login' 'amd64' '1' 'Essential: yes' +insertinstalledpackage 'libaudit0' 'amd64' '1' +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + gdm3 libaudit0 +The following NEW packages will be installed: + libaudit-common libaudit1 +The following packages will be upgraded: + login +1 upgraded, 2 newly installed, 2 to remove and 0 not upgraded. +Remv gdm3 [1] +Remv libaudit0 [1] +Inst libaudit-common (2 jessie [amd64]) +Conf libaudit-common (2 jessie [amd64]) +Inst libaudit1 (2 jessie [amd64]) +Conf libaudit1 (2 jessie [amd64]) +Inst login [1] (2 jessie [amd64]) +Conf login (2 jessie [amd64])' aptget dist-upgrade -st jessie -- cgit v1.2.3 From b0be0e09cfbbcb033eb0b92eaf17ac31a6b9f423 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 22 Dec 2014 12:20:28 +0100 Subject: rework dpkg-wrapping in test framework We are able to run maintainer scripts if needed before, but we need to set ADMINDIR to be able to call dpkg tools like dpkg-trigger inside of them. Git-Dch: Ignore --- test/integration/framework | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index f7f69f5d5..2c794d1f3 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -131,7 +131,7 @@ aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } dpkg() { - command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" + "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" } dpkgcheckbuilddeps() { command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@" @@ -247,15 +247,28 @@ setupenvironment() { else echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf fi - echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf - echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf - echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf - echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf - echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf + + cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg + if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it… fi - echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf echo 'quiet::NoUpdate "true";' >> aptconfig.conf echo 'quiet::NoStatistic "true";' >> aptconfig.conf # too distracting for users, but helpful to detect changes @@ -388,22 +401,15 @@ int execvp(const char *file, char *const argv[]) { char newfile[strlen(chrootdir) + strlen(file)]; strcpy(newfile, chrootdir); strcat(newfile, file); + char const * const baseadmindir = "/var/lib/dpkg"; + char admindir[strlen(chrootdir) + strlen(baseadmindir)]; + strcpy(admindir, chrootdir); + strcat(admindir, baseadmindir); + setenv("DPKG_ADMINDIR", admindir, 1); return func_execvp(newfile, argv); } EOF testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl - - mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" - DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" - echo "#!/bin/sh -if [ -n \"\$LD_PRELOAD\" ]; then - export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\" -else - export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\" -fi -dpkg \"\$@\"" > $DPKG - chmod +x $DPKG - sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf } configallowinsecurerepositories() { -- cgit v1.2.3 From 905fba60a046646a26a56b4c5d4a5dc7d5906f0d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 9 Mar 2015 01:54:46 +0100 Subject: derive more of https from http method Bug #778375 uncovered that https wasn't properly integrated in the class family tree of http as it was supposed to be leading to a NULL pointer dereference. Fixing this 'properly' was deemed to much diff for practically no gain that late in the release, so commit 0c2dc43d4fe1d026650b5e2920a021557f9534a6 just fixed the synptom, while this commit here is fixing the cause plus adding a test. --- .../test-bug-778375-server-has-no-reason-phrase | 40 ++++++++++ test/interactive-helper/aptwebserver.cc | 88 +++++++++++----------- 2 files changed, 84 insertions(+), 44 deletions(-) create mode 100755 test/integration/test-bug-778375-server-has-no-reason-phrase (limited to 'test') diff --git a/test/integration/test-bug-778375-server-has-no-reason-phrase b/test/integration/test-bug-778375-server-has-no-reason-phrase new file mode 100755 index 000000000..23481ef88 --- /dev/null +++ b/test/integration/test-bug-778375-server-has-no-reason-phrase @@ -0,0 +1,40 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'native' + +echo 'found' > aptarchive/working +changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=/' \ + -o 'aptwebserver::httpcode::200=200' -o 'aptwebserver::httpcode::404=404' \ + -o 'aptwebserver::httpcode::301=301' + +testdownload() { + rm -f downfile + msgtest "download of a $1 via" "${3%%:*}" + $2 --nomsg downloadfile "$3" downfile + + cp rootdir/tmp/testsuccess.output download.log + #looking for "HTTP server doesn't give Reason-Phrase for 200" + testsuccess grep 'give Reason-Phrase for' download.log + + if [ "$2" = 'testsuccess' ]; then + testfileequal downfile 'found' + else + testfailure test -e downfile + fi +} + +runtest() { + testdownload 'file works' 'testsuccess' "$1/working" + testdownload 'file via redirect works' 'testsuccess' "$1/redirectme/working" + + testdownload 'non-existent file fails' 'testfailure' "$1/failing" + testdownload 'non-existent file via redirect fails' 'testfailure' "$1/redirectme/failing" +} + +runtest 'http://localhost:8080' +runtest 'https://localhost:4433' diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 3403bbdd2..644629a33 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -27,58 +27,58 @@ #include #include -static char const * httpcodeToStr(int const httpcode) /*{{{*/ +static std::string httpcodeToStr(int const httpcode) /*{{{*/ { switch (httpcode) { // Informational 1xx - case 100: return "100 Continue"; - case 101: return "101 Switching Protocols"; + case 100: return _config->Find("aptwebserver::httpcode::100", "100 Continue"); + case 101: return _config->Find("aptwebserver::httpcode::101", "101 Switching Protocols"); // Successful 2xx - case 200: return "200 OK"; - case 201: return "201 Created"; - case 202: return "202 Accepted"; - case 203: return "203 Non-Authoritative Information"; - case 204: return "204 No Content"; - case 205: return "205 Reset Content"; - case 206: return "206 Partial Content"; + case 200: return _config->Find("aptwebserver::httpcode::200", "200 OK"); + case 201: return _config->Find("aptwebserver::httpcode::201", "201 Created"); + case 202: return _config->Find("aptwebserver::httpcode::202", "202 Accepted"); + case 203: return _config->Find("aptwebserver::httpcode::203", "203 Non-Authoritative Information"); + case 204: return _config->Find("aptwebserver::httpcode::204", "204 No Content"); + case 205: return _config->Find("aptwebserver::httpcode::205", "205 Reset Content"); + case 206: return _config->Find("aptwebserver::httpcode::206", "206 Partial Content"); // Redirections 3xx - case 300: return "300 Multiple Choices"; - case 301: return "301 Moved Permanently"; - case 302: return "302 Found"; - case 303: return "303 See Other"; - case 304: return "304 Not Modified"; - case 305: return "304 Use Proxy"; - case 307: return "307 Temporary Redirect"; + case 300: return _config->Find("aptwebserver::httpcode::300", "300 Multiple Choices"); + case 301: return _config->Find("aptwebserver::httpcode::301", "301 Moved Permanently"); + case 302: return _config->Find("aptwebserver::httpcode::302", "302 Found"); + case 303: return _config->Find("aptwebserver::httpcode::303", "303 See Other"); + case 304: return _config->Find("aptwebserver::httpcode::304", "304 Not Modified"); + case 305: return _config->Find("aptwebserver::httpcode::305", "305 Use Proxy"); + case 307: return _config->Find("aptwebserver::httpcode::307", "307 Temporary Redirect"); // Client errors 4xx - case 400: return "400 Bad Request"; - case 401: return "401 Unauthorized"; - case 402: return "402 Payment Required"; - case 403: return "403 Forbidden"; - case 404: return "404 Not Found"; - case 405: return "405 Method Not Allowed"; - case 406: return "406 Not Acceptable"; - case 407: return "407 Proxy Authentication Required"; - case 408: return "408 Request Time-out"; - case 409: return "409 Conflict"; - case 410: return "410 Gone"; - case 411: return "411 Length Required"; - case 412: return "412 Precondition Failed"; - case 413: return "413 Request Entity Too Large"; - case 414: return "414 Request-URI Too Large"; - case 415: return "415 Unsupported Media Type"; - case 416: return "416 Requested range not satisfiable"; - case 417: return "417 Expectation Failed"; - case 418: return "418 I'm a teapot"; + case 400: return _config->Find("aptwebserver::httpcode::400", "400 Bad Request"); + case 401: return _config->Find("aptwebserver::httpcode::401", "401 Unauthorized"); + case 402: return _config->Find("aptwebserver::httpcode::402", "402 Payment Required"); + case 403: return _config->Find("aptwebserver::httpcode::403", "403 Forbidden"); + case 404: return _config->Find("aptwebserver::httpcode::404", "404 Not Found"); + case 405: return _config->Find("aptwebserver::httpcode::405", "405 Method Not Allowed"); + case 406: return _config->Find("aptwebserver::httpcode::406", "406 Not Acceptable"); + case 407: return _config->Find("aptwebserver::httpcode::407", "407 Proxy Authentication Required"); + case 408: return _config->Find("aptwebserver::httpcode::408", "408 Request Time-out"); + case 409: return _config->Find("aptwebserver::httpcode::409", "409 Conflict"); + case 410: return _config->Find("aptwebserver::httpcode::410", "410 Gone"); + case 411: return _config->Find("aptwebserver::httpcode::411", "411 Length Required"); + case 412: return _config->Find("aptwebserver::httpcode::412", "412 Precondition Failed"); + case 413: return _config->Find("aptwebserver::httpcode::413", "413 Request Entity Too Large"); + case 414: return _config->Find("aptwebserver::httpcode::414", "414 Request-URI Too Large"); + case 415: return _config->Find("aptwebserver::httpcode::415", "415 Unsupported Media Type"); + case 416: return _config->Find("aptwebserver::httpcode::416", "416 Requested range not satisfiable"); + case 417: return _config->Find("aptwebserver::httpcode::417", "417 Expectation Failed"); + case 418: return _config->Find("aptwebserver::httpcode::418", "418 I'm a teapot"); // Server error 5xx - case 500: return "500 Internal Server Error"; - case 501: return "501 Not Implemented"; - case 502: return "502 Bad Gateway"; - case 503: return "503 Service Unavailable"; - case 504: return "504 Gateway Time-out"; - case 505: return "505 HTTP Version not supported"; - } - return NULL; + case 500: return _config->Find("aptwebserver::httpcode::500", "500 Internal Server Error"); + case 501: return _config->Find("aptwebserver::httpcode::501", "501 Not Implemented"); + case 502: return _config->Find("aptwebserver::httpcode::502", "502 Bad Gateway"); + case 503: return _config->Find("aptwebserver::httpcode::503", "503 Service Unavailable"); + case 504: return _config->Find("aptwebserver::httpcode::504", "504 Gateway Time-out"); + case 505: return _config->Find("aptwebserver::httpcode::505", "505 HTTP Version not supported"); + } + return ""; } /*}}}*/ static bool chunkedTransferEncoding(std::list const &headers) { -- cgit v1.2.3 From 25b86db159fbc3c043628e285c0c1ef24dec2c6e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Mar 2015 00:59:44 +0100 Subject: test exitcode as well as string equality We use test{success,failure} now all over the place in the framework, so its only consequencial to do this in the situations in which we test for a specific output as well. Git-Dch: Ignore --- test/integration/framework | 24 +++++- .../test-allow-scores-for-all-dependency-types | 22 +++--- .../test-apt-bug-718329-support-data.tar | 34 --------- test/integration/test-apt-by-hash-update | 4 +- test/integration/test-apt-cache | 32 ++++---- test/integration/test-apt-cdrom | 18 ++--- test/integration/test-apt-cli-list | 21 +++--- test/integration/test-apt-cli-search | 26 +++---- test/integration/test-apt-cli-show | 2 +- test/integration/test-apt-cli-update | 6 +- test/integration/test-apt-cli-upgrade | 6 +- test/integration/test-apt-config | 24 +++--- test/integration/test-apt-extracttemplates | 2 +- test/integration/test-apt-ftparchive-cachedb | 12 +-- .../test-apt-ftparchive-cachedb-lp1274466 | 2 +- test/integration/test-apt-ftparchive-src-cachedb | 2 +- test/integration/test-apt-get-autoremove | 6 +- test/integration/test-apt-get-build-dep | 6 +- test/integration/test-apt-get-changelog | 4 +- test/integration/test-apt-get-install-deb | 2 +- test/integration/test-apt-get-source | 18 ++--- test/integration/test-apt-get-source-arch | 16 ++-- test/integration/test-apt-get-source-multisources | 4 +- .../integration/test-apt-get-update-unauth-warning | 8 +- test/integration/test-apt-get-upgrade | 6 +- test/integration/test-apt-helper | 14 ++-- test/integration/test-apt-key | 4 +- test/integration/test-apt-key-net-update | 4 +- test/integration/test-apt-mark | 36 ++++----- test/integration/test-apt-progress-fd | 20 ++--- test/integration/test-apt-progress-fd-deb822 | 5 +- .../test-apt-translation-has-no-packages | 4 +- test/integration/test-apt-update-expected-size | 2 +- test/integration/test-apt-update-nofallback | 12 +-- test/integration/test-apt-update-rollback | 20 ++--- test/integration/test-apt-update-stale | 2 +- .../test-architecture-specification-parsing | 20 ++--- test/integration/test-authentication-basic | 2 +- .../test-bug-470115-new-and-tighten-recommends | 20 ++--- .../test-bug-507998-dist-upgrade-recommends | 2 +- .../test-bug-543966-downgrade-below-1000-pin | 10 +-- ...est-bug-549968-install-depends-of-not-installed | 2 +- .../test-bug-590041-prefer-non-virtual-packages | 8 +- ...g-590438-broken-provides-thanks-to-remove-order | 2 +- test/integration/test-bug-591882-conkeror | 4 +- .../integration/test-bug-593360-modifiers-in-names | 16 ++-- .../test-bug-596498-trusted-unsigned-repo | 12 +-- ...test-bug-598669-install-postfix-gets-exim-heavy | 2 +- test/integration/test-bug-601961-install-info | 6 +- test/integration/test-bug-602412-dequote-redirect | 2 +- .../integration/test-bug-604222-new-and-autoremove | 10 +-- .../test-bug-605394-versioned-or-groups | 2 +- test/integration/test-bug-611729-mark-as-manual | 6 +- .../test-bug-612099-multiarch-conflicts | 30 ++++---- test/integration/test-bug-612557-garbage-upgrade | 6 +- .../test-bug-613420-new-garbage-dependency | 2 +- .../test-bug-618848-always-respect-user-requests | 2 +- .../test-bug-624218-Translation-file-handling | 17 ++--- .../test-bug-632221-cross-dependency-satisfaction | 30 ++++---- ...test-bug-64141-install-dependencies-for-on-hold | 4 +- .../test-bug-657695-resolver-breaks-on-virtuals | 2 +- .../test-bug-661537-build-profiles-support | 8 +- .../test-bug-675449-essential-are-protected | 10 +-- .../test-bug-679371-apt-get-autoclean-multiarch | 2 +- .../test-bug-680041-apt-mark-holds-correctly | 20 ++--- .../test-bug-683786-build-dep-on-virtual-packages | 18 ++--- .../test-bug-686346-package-missing-architecture | 10 +-- .../test-bug-689582-100-char-long-path-names | 2 +- .../test-bug-691453-apt-cache-search-multi-pattern | 12 +-- .../test-bug-709560-set-candidate-release | 2 +- .../test-bug-712435-missing-descriptions | 18 ++--- .../test-bug-717891-abolute-uris-for-proxies | 2 +- .../test-bug-718329-support-data.tar-uncompressed | 31 ++++++++ ...st-bug-719263-print-uris-removes-authentication | 2 +- test/integration/test-bug-720597-build-dep-purge | 4 +- .../test-bug-722207-print-uris-even-if-very-quiet | 14 ++-- .../test-bug-723586-any-stripped-in-single-arch | 10 +-- test/integration/test-bug-728500-tempdir | 2 +- test/integration/test-bug-732746-preferences | 2 +- .../test-bug-735967-lib32-to-i386-unavailable | 8 +- test/integration/test-bug-738785-switch-protocol | 4 +- .../test-bug-745036-new-foreign-invalidates-cache | 2 +- .../test-bug-745046-candidate-propagation-fails | 4 +- test/integration/test-bug-753297-upgradable | 4 +- .../test-bug-758153-versioned-provides-support | 88 +++++++++++++++++++--- test/integration/test-bug-770291-reinstall | 8 +- test/integration/test-bug-multiarch-upgrade | 2 +- .../test-cachecontainer-architecture-specification | 32 ++++---- test/integration/test-compressed-indexes | 26 +++---- test/integration/test-conflicts-loop | 2 +- .../integration/test-conflicts-real-multiarch-same | 6 +- .../test-cve-2013-1051-InRelease-parsing | 8 +- test/integration/test-essential-force-loopbreak | 2 +- .../test-external-dependency-solver-protocol | 8 +- test/integration/test-handling-broken-orgroups | 14 ++-- .../test-ignore-provides-if-versioned-breaks | 18 ++--- .../test-ignore-provides-if-versioned-conflicts | 18 ++--- .../test-implicit-conflicts-real-not-virtual | 8 +- test/integration/test-kernel-helper-autoremove | 6 +- test/integration/test-multiarch-foreign | 24 +++--- .../test-ordering-ignore-not-matching-breaks | 8 +- test/integration/test-package-reinstallation | 2 +- test/integration/test-pdiff-usage | 12 +-- test/integration/test-pin-non-existent-package | 12 +-- test/integration/test-policy-pinning | 4 +- .../test-prefer-higher-priority-providers | 14 ++-- ...prefer-native-architecture-over-higher-priority | 2 +- ...prevent-markinstall-multiarch-same-versionscrew | 6 +- test/integration/test-provides-gone-with-upgrade | 2 +- test/integration/test-release-candidate-switching | 32 ++++---- test/integration/test-releasefile-verification | 30 ++++---- .../test-resolve-by-keep-new-recommends | 2 +- test/integration/test-sourceslist-trusted-options | 4 +- .../test-specific-architecture-dependencies | 30 ++++---- .../test-suggest-installed-multiarch-silbing | 16 ++-- .../test-ubuntu-bug-1098738-apt-get-source-md5sum | 20 ++--- ...u-bug-1130419-prefer-installed-ma-same-siblings | 12 +-- ...t-ubuntu-bug-1304403-obsolete-priority-standard | 4 +- test/integration/test-ubuntu-bug-614993 | 2 +- .../test-ubuntu-bug-761175-remove-purge | 4 +- ...st-ubuntu-bug-784473-InRelease-one-message-only | 2 +- .../test-ubuntu-bug-802901-multiarch-early-remove | 2 +- .../test-ubuntu-bug-806274-install-suggests | 8 +- .../test-ubuntu-bug-859188-multiarch-reinstall | 8 +- ...ubuntu-bug-985852-pre-depends-or-group-ordering | 2 +- .../test-unpack-different-version-unpacked | 14 ++-- test/integration/test-xorg-break-providers | 6 +- 127 files changed, 725 insertions(+), 645 deletions(-) delete mode 100755 test/integration/test-apt-bug-718329-support-data.tar create mode 100755 test/integration/test-bug-718329-support-data.tar-uncompressed (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 5f13df1c0..ec23e41e6 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1338,7 +1338,7 @@ testwarning() { else msgtest 'Test for successful execution with warnings of' "$*" fi - local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" + local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" if "$@" >${OUTPUT} 2>&1; then if expr match "$1" '^apt.*' >/dev/null; then if grep -q -E ' runtime error: ' "$OUTPUT"; then @@ -1388,6 +1388,26 @@ testfailure() { aptautotest 'testfailure' "$@" } +testsuccessequal() { + local CMP="$1" + shift + testsuccess "$@" + testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$CMP" +} +testwarningequal() { + local CMP="$1" + shift + testwarning "$@" + testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" "$CMP" +} +testfailureequal() { + local CMP="$1" + shift + testfailure "$@" + testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP" +} + + testfilestats() { msgtest "Test that file $1 has $2 $3" "$4" if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then @@ -1493,7 +1513,7 @@ aptautotest_apt_update() { aptautotest_aptget_update "$@"; } testaptautotestnodpkgwarning() { local TESTCALL="$1" while [ -n "$2" ]; do - if [ "$2" = '-s' ]; then return; fi + if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi shift done testfailure grep '^dpkg: warning:.*ignor.*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types index e1d805ce9..56cfc9a69 100755 --- a/test/integration/test-allow-scores-for-all-dependency-types +++ b/test/integration/test-allow-scores-for-all-dependency-types @@ -42,7 +42,7 @@ setupaptarchive insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev' insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: @@ -57,7 +57,7 @@ Inst libdb-dev [5.1.7] (5.3.0 unversioned [amd64]) [] Inst libdb5.3-dev (5.3.28-3 unversioned [amd64]) Conf libdb5.3-dev (5.3.28-3 unversioned [amd64]) Conf libdb-dev (5.3.0 unversioned [amd64])' aptget dist-upgrade -st unversioned -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: @@ -76,25 +76,25 @@ Conf libdb-dev (5.3.0 versioned [amd64])' aptget dist-upgrade -st versioned cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status insertinstalledpackage 'foo' 'amd64' '1' insertinstalledpackage 'bar' 'amd64' '1' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages have been kept back: bar foo 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st unversioned -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages have been kept back: bar foo 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st versioned -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages have been kept back: bar foo 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st multipleno -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: @@ -106,14 +106,14 @@ Remv foo [1] Inst bar [1] (2.2 multipleyes [amd64]) Conf bar (2.2 multipleyes [amd64])' aptget dist-upgrade -st multipleyes -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: baz 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Inst baz (2 unversioned [amd64]) Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -130,14 +130,14 @@ Inst baz (2 versioned [amd64]) Conf foo (2 versioned [amd64]) Conf baz (2 versioned [amd64])' aptget install baz -st versioned -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: baz 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Inst baz (2 unversioned [amd64]) Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -159,7 +159,7 @@ cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status insertinstalledpackage 'gdm3' 'amd64' '1' 'Depends: libaudit0, libaudit0' insertinstalledpackage 'login' 'amd64' '1' 'Essential: yes' insertinstalledpackage 'libaudit0' 'amd64' '1' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: diff --git a/test/integration/test-apt-bug-718329-support-data.tar b/test/integration/test-apt-bug-718329-support-data.tar deleted file mode 100755 index 5cfb31917..000000000 --- a/test/integration/test-apt-bug-718329-support-data.tar +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -test_process_package_with_compression() { - COMPRESSOR="$1" - DATA_TAR="$2" - - msgtest "Testing apt-ftparchive with compression type: $COMPRESSOR" - - buildsimplenativepackage 'pkg' 'all' '1.0' '' '' 'some descr' '' '' '' "$COMPRESSOR" - testequal "debian-binary -control.tar.gz -$DATA_TAR" ar t incoming/pkg_1.0_all.deb - - testequal "Package: pkg" echo "$(aptftparchive packages incoming/|grep ^Package)" - - testequal "usr/bin/pkg-all pkg -usr/share/doc/pkg/FEATURES pkg -usr/share/doc/pkg/changelog pkg -usr/share/doc/pkg/copyright pkg" aptftparchive contents incoming/ - - rm -rf incoming/* -} - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework - -setupenvironment -test_process_package_with_compression "gzip" "data.tar.gz" -test_process_package_with_compression "none" "data.tar" -test_process_package_with_compression "xz" "data.tar.xz" - - - diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index d9d0b146f..8300c532c 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -29,7 +29,7 @@ mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512 testfailure aptget upate # ensure we do not know about "foo" -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... E: Unable to locate package foo" aptget install -q -s foo @@ -37,7 +37,7 @@ E: Unable to locate package foo" aptget install -q -s foo testsuccess aptget update -o APT::Acquire::By-Hash=1 -o Acquire::Languages=none # ensure it works -testequal "Inst foo (1.0 unstable [all]) +testsuccessequal "Inst foo (1.0 unstable [all]) Conf foo (1.0 unstable [all])" aptget install -qq -s foo # add magic string to Release file ... diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache index f47c0e08b..f3db8024f 100755 --- a/test/integration/test-apt-cache +++ b/test/integration/test-apt-cache @@ -42,45 +42,45 @@ testsuccess aptcache dump cp rootdir/tmp/testsuccess.output dump.output testsuccess test -s dump.output -testequal 'dpkg +testsuccessequal 'dpkg bar fancy foo' aptcache pkgnames -testequal 'bar' aptcache pkgnames bar -testequal 'fancy +testsuccessequal 'bar' aptcache pkgnames bar +testsuccessequal 'fancy foo' aptcache pkgnames f -testequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo +testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo ### depends -testequal 'foo +testsuccessequal 'foo Depends: bar |Recommends: Recommends: Conflicts: Conflicts: ' aptcache depends foo -testequal 'foo +testsuccessequal 'foo Depends: bar Recommends: Conflicts: Conflicts: ' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 -testequal 'foo +testsuccessequal 'foo Depends: bar |Recommends: (>= 2) Recommends: (<< 5) Conflicts: Conflicts: ' aptcache depends foo -o APT::Cache::ShowVersion=1 -testequal 'foo +testsuccessequal 'foo Depends: bar Conflicts: Conflicts: ' aptcache depends foo --no-recommends -testequal 'foo +testsuccessequal 'foo Depends: bar' aptcache depends foo --important -testequal 'foo +testsuccessequal 'foo Conflicts: Conflicts: ' aptcache depends foo --important --no-depends --conflicts -testequal 'foo +testsuccessequal 'foo Depends: bar |Recommends: Recommends: @@ -97,7 +97,7 @@ bar ' aptcache depends foo --recurse -testequal 'foo +testsuccessequal 'foo Depends: bar bar Depends: bar @@ -107,18 +107,18 @@ bar ## rdpends -testequal 'foo +testsuccessequal 'foo Reverse Depends: bar bar' aptcache rdepends foo -testequal 'foo +testsuccessequal 'foo Reverse Depends: Replaces: bar Breaks: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -testequal 'foo +testsuccessequal 'foo Reverse Depends: Replaces: bar (<< 1) Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 -testequal 'foo +testsuccessequal 'foo Reverse Depends: Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 7f4b3c257..9906795ca 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -49,12 +49,12 @@ deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main Unmounting CD-ROM... Repeat this process for the rest of the CDs in your set." -testequal "$CDROM_PRE +testsuccessequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures Found label 'Debian APT Testdisk 0.8.15' $CDROM_POST" aptcdromlog add -testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ +testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ Mounting CD-ROM... Stored label: Debian APT Testdisk 0.8.15 Unmounting CD-ROM..." aptcdromlog ident @@ -63,13 +63,13 @@ Unmounting CD-ROM..." aptcdromlog ident ident="$(LC_ALL=C aptcdrom ident 2>&1 )" CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')" CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")" -testequal "CD::${CD_ID} \"${CD_LABEL}\"; -CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list +testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\"; +CD::${CD_ID}::Label \"${CD_LABEL}\";" testcdromusage() { touch rootdir/var/lib/apt/extended_states - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -84,7 +84,7 @@ Conf testing (0.8.15 stable [amd64])' aptget install testing -s testsuccess aptget purge testing -y testdpkgnotinstalled testing - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -114,18 +114,18 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s testcdromusage # check Idempotence of apt-cdrom (and disabling of Translation dropping) -testequal "$CDROM_PRE +testsuccessequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures $CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0 # take Translations from previous runs as needed -testequal "$CDROM_PRE +testsuccessequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures $CDROM_POST" aptcdromlog add msgtest 'Test for the german description translation of' 'testing' aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail rm -rf rootdir/var/lib/apt/lists -testequal "$CDROM_PRE +testsuccessequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures $CDROM_POST" aptcdromlog add msgtest 'Test for the english description translation of' 'testing' diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list index 1487afd55..d3c44e126 100755 --- a/test/integration/test-apt-cli-list +++ b/test/integration/test-apt-cli-list @@ -27,50 +27,49 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) -testequal "Listing... +testsuccessequal "Listing... bar/now 1.0 i386 [installed,local] baz/unstable 2.0 all [upgradable from: 0.1] foo/unstable 1.0 all foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list -testequal "Listing... +testsuccessequal "Listing... foo/unstable 1.0 all foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list "foo*" -testequal "Listing... +testsuccessequal "Listing... baz/unstable 2.0 all [upgradable from: 0.1] foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list --upgradable # FIXME: hm, hm - does it make sense to have this different? shouldn't # we use "installed,upgradable" consitently? -testequal "Listing... +testsuccessequal "Listing... bar/now 1.0 i386 [installed,local] baz/now 0.1 all [installed,upgradable to: 2.0] foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed -testequal "Listing... +testsuccessequal "Listing... bar/now 1.0 i386 [installed,local] foobar/unstable 2.0 i386 [upgradable from: 1.0] foobar/now 1.0 i386 [installed,upgradable to: 2.0] " apt list bar foobar --all-versions -testequal "Listing... +testsuccessequal "Listing... bar/now 1.0 i386 [installed,local] an autogenerated dummy bar=1.0/installed " apt list bar --verbose # test for dpkg ^rc state insertinstalledpackage 'conf-only' 'i386' '1.0' '' '' 'deinstall ok config-files' -testequal "Listing... +testsuccessequal "Listing... conf-only/now 1.0 i386 [residual-config]" apt list conf-only # ensure that the users learns about multiple versions too -testequal "Listing... +testsuccessequal "Listing... baz/unstable 2.0 all [upgradable from: 0.1] N: There are 2 additional versions. Please use the '-a' switch to see them." apt list baz -o quiet=0 # test format strings for machine parseable output -apt list -qq bar baz -o APT::Cmd::use-format=true -o APT::Cmd::format="\${Package} - \${installed:Version} - \${candidate:Version}" > output.txt -testequal "bar - 1.0 - 1.0 -baz - 0.1 - 2.0" cat output.txt +testsuccessequal 'bar - 1.0 - 1.0 +baz - 0.1 - 2.0' apt list -qq bar baz -o APT::Cmd::use-format=true -o APT::Cmd::format="\${Package} - \${installed:Version} - \${candidate:Version}" diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search index 1a28ba4da..e86661dcb 100755 --- a/test/integration/test-apt-cli-search +++ b/test/integration/test-apt-cli-search @@ -25,51 +25,51 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) -testequal 'E: You must give at least one search pattern' aptcache search -testequal 'E: You must give at least one search pattern' apt search +testfailureequal 'E: You must give at least one search pattern' aptcache search +testfailureequal 'E: You must give at least one search pattern' apt search # with OP progress -testequal "Sorting... +testsuccessequal "Sorting... Full Text Search... foo/unstable 1.0 all $DESCR " apt search xxyyzz # without op progress -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR " apt search -qq xxyyzz testempty apt search -qq --names-only xxyyzz # search name -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR " apt search -qq foo -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR " apt search -qq --names-only foo # search with multiple words is a AND search -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR " apt search -qq aabbcc xxyyzz -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR " apt search -qq 'a+b+c+' 'i*xxy{0,2}zz' # search is not case-sensitive by default -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR " apt search -qq uppercase -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR " apt search -qq 'up[pP]erc[Aa]se' # search is done in the long description -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR " apt search -qq 'long description' -testequal "foo/unstable 1.0 all +testsuccessequal "foo/unstable 1.0 all $DESCR Long description of stuff and such, with lines . @@ -77,7 +77,7 @@ testequal "foo/unstable 1.0 all " apt search --full -qq 'long description' # output is sorted and search word finds both package -testequal "bar/testing 2.0 i386 +testsuccessequal "bar/testing 2.0 i386 $DESCR2 foo/unstable 1.0 all diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index 930e591e0..5604620fd 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -24,7 +24,7 @@ APTARCHIVE=$(readlink -f ./aptarchive) # note that we do not display Description-md5 with the "apt" cmd # and also show some additional fields that are calculated -testequal "Package: foo +testsuccessequal "Package: foo Priority: optional Section: other Installed-Size: 43.0 kB diff --git a/test/integration/test-apt-cli-update b/test/integration/test-apt-cli-update index 83cc94b93..d68ab25e4 100755 --- a/test/integration/test-apt-cli-update +++ b/test/integration/test-apt-cli-update @@ -15,10 +15,10 @@ setupaptarchive --no-update APTARCHIVE=$(readlink -f ./aptarchive) -testequal 'E: The update command takes no arguments' apt update -q arguments +testfailureequal 'E: The update command takes no arguments' apt update -q arguments -testequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q +testsuccessequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q cp dpkg.status rootdir/var/lib/dpkg/status insertinstalledpackage 'foo' 'all' '2.0' -testequal 'All packages are up to date.' apt update -q +testsuccessequal 'All packages are up to date.' apt update -q diff --git a/test/integration/test-apt-cli-upgrade b/test/integration/test-apt-cli-upgrade index b6ee2270b..54f2ecd11 100755 --- a/test/integration/test-apt-cli-upgrade +++ b/test/integration/test-apt-cli-upgrade @@ -23,7 +23,7 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) # default is to allow new dependencies -testequal "The following NEW packages will be installed: +testsuccessequal "The following NEW packages will be installed: foo-new-dependency The following packages will be upgraded: foo @@ -33,7 +33,7 @@ Inst foo [1.0] (2.0 unstable [all]) Conf foo-new-dependency (2.0 unstable [all]) Conf foo (2.0 unstable [all])" apt upgrade -qq -s -# ensure -testequal "The following packages have been kept back: +# ensure the 'old' way works as well +testsuccessequal "The following packages have been kept back: foo 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." apt upgrade -qq -s --no-new-pkgs diff --git a/test/integration/test-apt-config b/test/integration/test-apt-config index 2f2ff9d38..2eea9a0f8 100755 --- a/test/integration/test-apt-config +++ b/test/integration/test-apt-config @@ -8,29 +8,29 @@ setupenvironment configarchitecture 'amd64' testsuccess aptconfig dump -testequal 'APT::Architecture "amd64";' aptconfig dump APT::Architecture +testsuccessequal 'APT::Architecture "amd64";' aptconfig dump APT::Architecture testempty aptconfig dump config::which::does::not::exist -testequal 'APT::Architectures ""; +testsuccessequal 'APT::Architectures ""; APT::Architectures:: "amd64";' aptconfig dump APT::Architectures -testequal 'APT::Architectures:: "amd64";' aptconfig dump --no-empty APT::Architectures -testequal 'amd64' aptconfig dump --no-empty --format='%v%n' APT::Architectures +testsuccessequal 'APT::Architectures:: "amd64";' aptconfig dump --no-empty APT::Architectures +testsuccessequal 'amd64' aptconfig dump --no-empty --format='%v%n' APT::Architectures testempty aptconfig shell -testequal 'E: Arguments not in pairs' aptconfig shell APT::Architecture +testfailureequal 'E: Arguments not in pairs' aptconfig shell APT::Architecture testempty aptconfig shell APT::Architecture ARCH # incorrect order -testequal "ARCH='amd64'" aptconfig shell ARCH APT::Architecture +testsuccessequal "ARCH='amd64'" aptconfig shell ARCH APT::Architecture ROOTDIR="$(readlink -f rootdir)" -testequal "CONFIG='apt.conf'" aptconfig shell CONFIG Dir::Etc::main -testequal "CONFIG='${ROOTDIR}/etc/apt/apt.conf'" aptconfig shell CONFIG Dir::Etc::main/f -testequal "CONFIG='etc/apt/'" aptconfig shell CONFIG Dir::Etc -testequal "CONFIG='${ROOTDIR}/etc/apt/'" aptconfig shell CONFIG Dir::Etc/ # old style -testequal "CONFIG='${ROOTDIR}/etc/apt/'" aptconfig shell CONFIG Dir::Etc/d +testsuccessequal "CONFIG='apt.conf'" aptconfig shell CONFIG Dir::Etc::main +testsuccessequal "CONFIG='${ROOTDIR}/etc/apt/apt.conf'" aptconfig shell CONFIG Dir::Etc::main/f +testsuccessequal "CONFIG='etc/apt/'" aptconfig shell CONFIG Dir::Etc +testsuccessequal "CONFIG='${ROOTDIR}/etc/apt/'" aptconfig shell CONFIG Dir::Etc/ # old style +testsuccessequal "CONFIG='${ROOTDIR}/etc/apt/'" aptconfig shell CONFIG Dir::Etc/d testempty aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles export DEB_BUILD_PROFILES='nodoc stage1' -testequal 'nodoc +testsuccessequal 'nodoc stage1' aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles unset DEB_BUILD_PROFILES testempty aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles diff --git a/test/integration/test-apt-extracttemplates b/test/integration/test-apt-extracttemplates index 276862464..5dadc4933 100755 --- a/test/integration/test-apt-extracttemplates +++ b/test/integration/test-apt-extracttemplates @@ -35,7 +35,7 @@ Description: Some bar var OUT='rootdir/tmp/testsuccess.output' testequal "$1" cut -f1 -d' ' $OUT if [ -n "$2" ]; then - testequal '' cut -f2 -d' ' $OUT + testequal '' cut -s -f2 -d' ' $OUT else testequal '1.0' cut -f2 -d' ' $OUT fi diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index 866e5a469..3454ee36a 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -9,14 +9,14 @@ $(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | s Maintainer: Joe Sixpack Architecture: i386 Version: 1 -Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages +Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages } ensure_correct_contents_file() { - testequal "usr/bin/foo-i386 others/foo + testfileequal ./aptarchive/dists/test/Contents-i386 "usr/bin/foo-i386 others/foo usr/share/doc/foo/FEATURES others/foo usr/share/doc/foo/changelog others/foo -usr/share/doc/foo/copyright others/foo" cat ./aptarchive/dists/test/Contents-i386 +usr/share/doc/foo/copyright others/foo" } # @@ -99,8 +99,8 @@ testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 0 # and clean rm -rf aptarchive/pool/main/* -testequal "packages-main-i386.db" aptftparchive clean ftparchive.conf -q=0 +testsuccessequal "packages-main-i386.db" aptftparchive clean ftparchive.conf -q=0 testsuccess aptftparchive clean ftparchive.conf -q=0 -o Debug::APT::FTPArchive::Clean=1 cp rootdir/tmp/testsuccess.output clean-out.txt -testequal "0 Number of unique keys in the tree" grep unique clean-out.txt -testequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt +testsuccessequal "0 Number of unique keys in the tree" grep unique clean-out.txt +testsuccessequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466 index 579ae33a6..1f86e367f 100755 --- a/test/integration/test-apt-ftparchive-cachedb-lp1274466 +++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466 @@ -26,7 +26,7 @@ testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc testfailure grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump # regression test for corruption with previous generation of cachedb -testequal "Package: foo +testsuccessequal "Package: foo Priority: optional Section: others Installed-Size: 29 diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 28321e3c5..2a361ecc0 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -2,7 +2,7 @@ set -e assert_correct_sources_file() { - testequal "Package: bar + testsuccessequal "Package: bar Architecture: all Version: 1.0 Binary: bar diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index acde4b096..a0e4d3c24 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -20,7 +20,7 @@ testdpkgnotinstalled 'debhelper' testdpkginstalled 'po-debconf' 'unrelated' echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: @@ -55,7 +55,7 @@ testdpkginstalled 'unrelated' 'debhelper' 'po-debconf' testsuccess aptmark auto debhelper testmarkedauto 'debhelper' 'po-debconf' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: @@ -65,7 +65,7 @@ Remv debhelper [8.0.0] Remv po-debconf [1.0.16]' aptget autoremove -s testsuccess aptmark hold debhelper -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s diff --git a/test/integration/test-apt-get-build-dep b/test/integration/test-apt-get-build-dep index 87ec6e54d..f7af5b782 100755 --- a/test/integration/test-apt-get-build-dep +++ b/test/integration/test-apt-get-build-dep @@ -32,7 +32,7 @@ Files: 1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz EOF -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Note, using file '2vcard_0.5-3.dsc' to get the build dependencies The following NEW packages will be installed: @@ -75,7 +75,7 @@ z2UAn1oXgTai6opwhVfkxrlmJ+iRxzuc -----END PGP SIGNATURE----- EOF -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Note, using file '2vcard_0.5-3.dsc' to get the build dependencies The following NEW packages will be installed: @@ -117,7 +117,7 @@ Description: install packages using the apt protocol - common data EOF -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Note, using directory './foo-1.0' to get the build dependencies The following NEW packages will be installed: diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 01f2bd393..7e81c71b6 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -21,9 +21,9 @@ chmod -R -w rootdir/var/cache/apt/archives echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf -testequal "'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt --print-uris +testsuccessequal "'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt --print-uris -testequal "'http://localhost:8080/pool/apt_1.0/changelog' +testsuccessequal "'http://localhost:8080/pool/apt_1.0/changelog' 'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris cd downloaded diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb index f2e5229cd..0f34692fe 100755 --- a/test/integration/test-apt-get-install-deb +++ b/test/integration/test-apt-get-install-deb @@ -8,7 +8,7 @@ setupenvironment configarchitecture "i386" # regression test for #754904 -testequal 'E: Unable to locate package /dev/null' aptget install -qq /dev/null +testfailureequal 'E: Unable to locate package /dev/null' aptget install -qq /dev/null # and ensure we fail for invalid debs cat > foo.deb < rootdir/etc/apt/apt.conf.d/02proxy-detect - testequal "Using proxy 'http://some-proxy' for URL 'http://www.example.com/'" apthelper auto-detect-proxy http://www.example.com + 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 @@ -66,14 +66,14 @@ EOF chmod 755 apt-proxy-detect echo "Acquire::https::Proxy-Auto-Detect \"$(pwd)/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect - testequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com + testsuccessequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com } test_apt_helper_download test_apt_helper_detect_proxy # test failure modes -testequal 'E: Invalid operation download' apthelper download -testequal 'E: Must specify at least one pair url/filename' apthelper download-file -testequal 'E: Must specify at least one pair url/filename' apthelper download-file http://example.org/ -testequal 'E: Need one URL as argument' apthelper auto-detect-proxy +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/ +testfailureequal 'E: Need one URL as argument' apthelper auto-detect-proxy diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index b6b7b7909..989fe658c 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -17,7 +17,7 @@ testaptkeys() { if ! aptkey list | grep '^pub' > aptkey.list; then echo -n > aptkey.list fi - testequal "$1" cat ./aptkey.list + testfileequal './aptkey.list' "$1" } echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub"; @@ -35,7 +35,7 @@ testrun() { testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' - testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) " not changed + testsuccessequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) " not changed gpg: Total number processed: 1 gpg: unchanged: 1' aptkey --fakeroot update diff --git a/test/integration/test-apt-key-net-update b/test/integration/test-apt-key-net-update index b3c118555..2a0823bec 100755 --- a/test/integration/test-apt-key-net-update +++ b/test/integration/test-apt-key-net-update @@ -23,7 +23,7 @@ echo 'APT::Key::ArchiveKeyringURI "http://localhost:8080/ubuntu/project/test-arc echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf # test against the "real" webserver -testequal 'Checking for new archive signing keys now +testsuccessequal 'Checking for new archive signing keys now gpg: key F68C85A3: public key "Test Automatic Archive Signing Key " imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1)' aptkey --fakeroot net-update @@ -40,7 +40,7 @@ echo 'APT::Key::ArchiveKeyringURI "http://localhost:8080/ubuntu/project/marvinpa echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf # test against the "real" webserver -testequal "Checking for new archive signing keys now +testsuccessequal "Checking for new archive signing keys now Key 'DE66AECA9151AFA1877EC31DE8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update aptkey list | grep '^pub' > aptkey.list diff --git a/test/integration/test-apt-mark b/test/integration/test-apt-mark index 5a3ae4b2f..9b68945f9 100755 --- a/test/integration/test-apt-mark +++ b/test/integration/test-apt-mark @@ -21,20 +21,20 @@ testdpkginstalled dpkg testnoautopkg() { testempty aptmark showauto testempty aptcache showauto - testequal 'bar + testsuccessequal 'bar dpkg foo' aptmark showmanual - testequal 'bar + testsuccessequal 'bar foo' aptmark showmanual bar foo uninstalled } testfooisauto() { - testequal 'foo' aptmark showauto - testequal 'foo' aptcache showauto - testequal 'foo' aptmark showauto foo - testequal 'foo' aptcache showauto foo - testequal 'bar + testsuccessequal 'foo' aptmark showauto + testsuccessequal 'foo' aptcache showauto + testsuccessequal 'foo' aptmark showauto foo + testsuccessequal 'foo' aptcache showauto foo + testsuccessequal 'bar dpkg' aptmark showmanual - testequal 'bar' aptmark showmanual bar + testsuccessequal 'bar' aptmark showmanual bar } testmarkonpkgasauto() { testsuccess $1 $2 foo @@ -48,8 +48,8 @@ testmarkonpkgasauto() { testnoautopkg } -testequal 'E: No packages found' aptmark auto -testequal 'E: No packages found' aptmark manual +testfailureequal 'E: No packages found' aptmark auto +testfailureequal 'E: No packages found' aptmark manual testnoautopkg testmarkonpkgasauto 'aptmark' 'auto' 'manual' @@ -63,10 +63,10 @@ testnoholdpkg() { testempty aptmark showholds dpkg } testpkgonhold() { - testequal "$1" aptmark showhold - testequal "$1" aptmark showholds - testequal "$1" aptmark showhold $1 - testequal "$1" aptmark showholds $1 + testsuccessequal "$1" aptmark showhold + testsuccessequal "$1" aptmark showholds + testsuccessequal "$1" aptmark showhold $1 + testsuccessequal "$1" aptmark showholds $1 } testmarkonepkgashold() { testsuccess aptmark hold $1 @@ -79,8 +79,8 @@ testmarkonepkgashold() { testnoholdpkg } -testequal 'E: No packages found' aptmark hold -testequal 'E: No packages found' aptmark unhold +testfailureequal 'E: No packages found' aptmark hold +testfailureequal 'E: No packages found' aptmark unhold testnoholdpkg testmarkonepkgashold 'foo' @@ -97,5 +97,5 @@ fi testmarkonepkgashold 'uninstalled' testmarkonepkgashold 'uninstalled-native' -testequal 'uninstalled set on hold.' aptmark hold uninstalled -testequal 'uninstalled-native set on hold.' aptmark hold uninstalled-native +testsuccessequal 'uninstalled set on hold.' aptmark hold uninstalled +testsuccessequal 'uninstalled-native set on hold.' aptmark hold uninstalled-native diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd index 90e6ef7e4..0c11aba7e 100755 --- a/test/integration/test-apt-progress-fd +++ b/test/integration/test-apt-progress-fd @@ -15,7 +15,7 @@ setupaptarchive # install native exec 3> apt-progress.log testsuccess aptget install testing=0.1 -y -o APT::Status-Fd=3 -testequal "dlstatus:1:0:Retrieving file 1 of 1 +testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) @@ -26,12 +26,12 @@ pmstatus:dpkg-exec:50:Running dpkg pmstatus:testing:50:Configuring testing (amd64) pmstatus:testing:66.6667:Configuring testing (amd64) pmstatus:testing:83.3333:Installed testing (amd64) -pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log +pmstatus:dpkg-exec:83.3333:Running dpkg' # upgrade exec 3> apt-progress.log testsuccess aptget install testing=0.8.15 -y -o APT::Status-Fd=3 -testequal "dlstatus:1:0:Retrieving file 1 of 1 +testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) @@ -42,12 +42,12 @@ pmstatus:dpkg-exec:50:Running dpkg pmstatus:testing:50:Configuring testing (amd64) pmstatus:testing:66.6667:Configuring testing (amd64) pmstatus:testing:83.3333:Installed testing (amd64) -pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log +pmstatus:dpkg-exec:83.3333:Running dpkg' # reinstall exec 3> apt-progress.log testsuccess aptget install testing=0.8.15 --reinstall -y -o APT::Status-Fd=3 -testequal "dlstatus:1:0:Retrieving file 1 of 1 +testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Installing testing (amd64) @@ -58,24 +58,24 @@ pmstatus:dpkg-exec:50:Running dpkg pmstatus:testing:50:Configuring testing (amd64) pmstatus:testing:66.6667:Configuring testing (amd64) pmstatus:testing:83.3333:Installed testing (amd64) -pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log +pmstatus:dpkg-exec:83.3333:Running dpkg' # and remove exec 3> apt-progress.log testsuccess aptget remove testing -y -o APT::Status-Fd=3 -testequal "pmstatus:dpkg-exec:0:Running dpkg +testfileequal './apt-progress.log' 'pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing:0:Removing testing (amd64) pmstatus:testing:25:Preparing for removal of testing (amd64) pmstatus:testing:50:Removing testing (amd64) pmstatus:testing:75:Removed testing (amd64) -pmstatus:dpkg-exec:75:Running dpkg" cat apt-progress.log +pmstatus:dpkg-exec:75:Running dpkg' # install non-native and ensure we get proper progress info exec 3> apt-progress.log testsuccess aptget install testing2:i386 -y -o APT::Status-Fd=3 # and compare -testequal "dlstatus:1:0:Retrieving file 1 of 1 +testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg pmstatus:testing2:0:Installing testing2 (i386) @@ -86,6 +86,6 @@ pmstatus:dpkg-exec:50:Running dpkg pmstatus:testing2:50:Configuring testing2 (i386) pmstatus:testing2:66.6667:Configuring testing2 (i386) pmstatus:testing2:83.3333:Installed testing2 (i386) -pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log +pmstatus:dpkg-exec:83.3333:Running dpkg' rm -f apt-progress*.log diff --git a/test/integration/test-apt-progress-fd-deb822 b/test/integration/test-apt-progress-fd-deb822 index badc985e4..ca7f14cb9 100755 --- a/test/integration/test-apt-progress-fd-deb822 +++ b/test/integration/test-apt-progress-fd-deb822 @@ -16,7 +16,7 @@ setupaptarchive exec 3> apt-progress.log testsuccess aptget install testing=0.1 -y -o APT::Status-deb822-Fd=3 -testequal "Status: progress +testfileequal './apt-progress.log' 'Status: progress Percent: 0 Message: Running dpkg @@ -62,7 +62,6 @@ Message: Installed testing (amd64) Status: progress Percent: 83.3333 Message: Running dpkg -" cat apt-progress.log - +' rm -f apt-progress*.log diff --git a/test/integration/test-apt-translation-has-no-packages b/test/integration/test-apt-translation-has-no-packages index bb2353a33..440fd30cf 100755 --- a/test/integration/test-apt-translation-has-no-packages +++ b/test/integration/test-apt-translation-has-no-packages @@ -17,7 +17,7 @@ configarchitecture "amd64" if [ ! -x ${BUILDDIRECTORY}/apt ]; then msgmsg "No ${BUILDDIRECTORY}/apt" - msgskip + msgskip exit 0 fi @@ -33,7 +33,7 @@ cp $APTARCHIVE/dists/unstable/main/binary-amd64/Packages \ # ensure that there is no Version for the package foo generated out of # the corrupted Translation-en file -testequal "foo: +testsuccessequal "foo: Installed: (none) Candidate: 1.0 Version table: diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 045217a77..9711c293a 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -39,6 +39,6 @@ find aptarchive -name 'Packages*' | while read pkg; do done NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" rm -f rootdir/var/lib/apt/lists/localhost* -testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) +testfailureequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index e82a976a6..71576de81 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -31,14 +31,14 @@ EOF assert_update_is_refused_and_last_good_state_used() { - testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq + testfailureequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq assert_repo_is_intact } assert_repo_is_intact() { - testequal "foo/unstable 2.0 all" apt list -q + testsuccessequal "foo/unstable 2.0 all" apt list -q testsuccess aptget install -y -s foo testfailure aptget install -y evil testsuccess aptget source foo --print-uris @@ -97,7 +97,7 @@ test_from_inrelease_to_unsigned_with_override() testwarning aptget update --allow-insecure-repositories \ -o Acquire::AllowDowngradeToInsecureRepositories=1 # but that the individual packages are still considered untrusted - testequal "WARNING: The following packages cannot be authenticated! + testfailureequal "WARNING: The following packages cannot be authenticated! evil E: There are problems and -y was used without --force-yes" aptget install -qq -y evil } @@ -149,7 +149,7 @@ test_subvert_inrelease() # replace InRelease with something else mv $APTARCHIVE/dists/unstable/Release $APTARCHIVE/dists/unstable/InRelease - testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Does not start with a cleartext signature + testfailureequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Does not start with a cleartext signature E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq @@ -169,7 +169,7 @@ test_inrelease_to_invalid_inrelease() sed -i 's/Codename.*/Codename: evil!'/ $APTARCHIVE/dists/unstable/InRelease inject_evil_package - testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) + testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) @@ -193,7 +193,7 @@ test_release_gpg_to_invalid_release_release_gpg() echo "Some evil data" >> $APTARCHIVE/dists/unstable/Release inject_evil_package - testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release.gpg: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) + testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release.gpg: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index 9efc194a0..f4500b69d 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -38,7 +38,7 @@ start_with_good_inrelease() { create_fresh_archive testsuccess aptget update listcurrentlistsdirectory > lists.before - testequal "old/unstable 1.0 all" apt list -q + testsuccessequal "old/unstable 1.0 all" apt list -q } test_inrelease_to_new_inrelease() { @@ -47,7 +47,7 @@ test_inrelease_to_new_inrelease() { add_new_package '+1hour' testsuccess aptget update -o Debug::Acquire::Transaction=1 - testequal "new/unstable 1.0 all + testsuccessequal "new/unstable 1.0 all old/unstable 1.0 all" apt list -q } @@ -60,12 +60,12 @@ test_inrelease_to_broken_hash_reverts_all() { break_repository_sources_index '+1hour' # test the error condition - testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch + testfailureequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure that the Packages file is also rolled back testfileequal lists.before "$(listcurrentlistsdirectory)" - testequal "E: Unable to locate package new" aptget install new -s -qq + testfailureequal "E: Unable to locate package new" aptget install new -s -qq } test_inrelease_to_valid_release() { @@ -78,7 +78,7 @@ test_inrelease_to_valid_release() { rm $APTARCHIVE/dists/unstable/Release.gpg # update fails - testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq + testfailureequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # test that security downgrade was not successful testfileequal lists.before "$(listcurrentlistsdirectory)" @@ -101,7 +101,7 @@ test_inrelease_to_release_reverts_all() { break_repository_sources_index '+1hour' # ensure error - testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 + testfailureequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 # ensure that the Packages file is also rolled back testfileequal lists.before "$(listcurrentlistsdirectory)" @@ -119,7 +119,7 @@ test_unauthenticated_to_invalid_inrelease() { testwarning aptget update --allow-insecure-repositories listcurrentlistsdirectory > lists.before - testequal "WARNING: The following packages cannot be authenticated! + testfailureequal "WARNING: The following packages cannot be authenticated! old E: There are problems and -y was used without --force-yes" aptget install -qq -y old @@ -127,13 +127,13 @@ E: There are problems and -y was used without --force-yes" aptget install -qq -y add_new_package '+1hour' break_repository_sources_index '+1hour' - testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch + testfailureequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq testfileequal lists.before "$(listcurrentlistsdirectory)" testfailure ls rootdir/var/lib/apt/lists/*_InRelease - testequal "WARNING: The following packages cannot be authenticated! + testfailureequal "WARNING: The following packages cannot be authenticated! old E: There are problems and -y was used without --force-yes" aptget install -qq -y old } @@ -144,7 +144,7 @@ test_inrelease_to_unauth_inrelease() { signreleasefiles 'Marvin Paranoid' - testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 + testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 diff --git a/test/integration/test-apt-update-stale b/test/integration/test-apt-update-stale index 277aa5b09..05154641a 100755 --- a/test/integration/test-apt-update-stale +++ b/test/integration/test-apt-update-stale @@ -39,7 +39,7 @@ cp -p aptarchive/dists/unstable/main/binary-i386/saved/Packages* \ aptarchive/dists/unstable/main/binary-i386/ # ensure this raises an error -testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Hash Sum mismatch +testfailureequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq testfileequal lists.before "$(listcurrentlistsdirectory)" diff --git a/test/integration/test-architecture-specification-parsing b/test/integration/test-architecture-specification-parsing index d1f6011de..f5a5b123e 100755 --- a/test/integration/test-architecture-specification-parsing +++ b/test/integration/test-architecture-specification-parsing @@ -26,7 +26,7 @@ insertinstalledpackage 'build-essential' 'all' '11.5' 'Multi-Arch: foreign' setupaptarchive -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -38,7 +38,7 @@ Inst pkg-arch-foo (1.0 stable [${NATIVE}]) Conf foo (1.0 stable [${NATIVE}]) Conf pkg-arch-foo (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following NEW packages will be installed: pkg-arch-no-foo @@ -46,7 +46,7 @@ The following NEW packages will be installed: Inst pkg-arch-no-foo (1.0 stable [${NATIVE}]) Conf pkg-arch-no-foo (1.0 stable [${NATIVE}])" aptget install pkg-arch-no-foo -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -58,7 +58,7 @@ Inst pkg-arch-foo-unrelated-no (1.0 stable [${NATIVE}]) Conf foo (1.0 stable [${NATIVE}]) Conf pkg-arch-foo-unrelated-no (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo-unrelated-no -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -70,7 +70,7 @@ Inst pkg-arch-foo-unrelated-no2 (1.0 stable [${NATIVE}]) Conf foo (1.0 stable [${NATIVE}]) Conf pkg-arch-foo-unrelated-no2 (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo-unrelated-no2 -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following NEW packages will be installed: foo @@ -78,11 +78,11 @@ The following NEW packages will be installed: Inst foo (1.0 stable [${NATIVE}]) Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep pkg-arch-no-foo -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following NEW packages will be installed: foo @@ -90,7 +90,7 @@ The following NEW packages will be installed: Inst foo (1.0 stable [${NATIVE}]) Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo-unrelated-no -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following NEW packages will be installed: foo @@ -98,13 +98,13 @@ The following NEW packages will be installed: Inst foo (1.0 stable [${NATIVE}]) Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo-unrelated-no2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep no-depends -s # this is not really testing APT - more that dpkg is in line with us configarchitecture 'amd64' 'armel' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: no-depends:armel diff --git a/test/integration/test-authentication-basic b/test/integration/test-authentication-basic index 7e74726be..3a6897b59 100755 --- a/test/integration/test-authentication-basic +++ b/test/integration/test-authentication-basic @@ -38,7 +38,7 @@ testauthsuccess() { rm -rf rootdir/var/lib/apt/lists testsuccess aptget update - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo diff --git a/test/integration/test-bug-470115-new-and-tighten-recommends b/test/integration/test-bug-470115-new-and-tighten-recommends index 6bc22ea7b..0970e2f23 100755 --- a/test/integration/test-bug-470115-new-and-tighten-recommends +++ b/test/integration/test-bug-470115-new-and-tighten-recommends @@ -47,7 +47,7 @@ insertpackage 'unstable' 'now-satisfiable' 'all' '2' 'Recommends: cool (>= 2)' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: cool @@ -59,7 +59,7 @@ Inst tighten-cool [1] (2 unstable [all]) Conf cool (2 unstable [all]) Conf tighten-cool (2 unstable [all])' aptget install tighten-cool -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: stuff @@ -71,7 +71,7 @@ Inst tighten-coolorstuff [1] (2 unstable [all]) Conf stuff (2 unstable [all]) Conf tighten-coolorstuff (2 unstable [all])' aptget install tighten-coolorstuff -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: cool @@ -83,7 +83,7 @@ Inst tighten-coolorstuff2 [1] (2 unstable [all]) Conf cool (2 unstable [all]) Conf tighten-coolorstuff2 (2 unstable [all])' aptget install tighten-coolorstuff2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: cool @@ -95,7 +95,7 @@ Inst newrec-cool [1] (2 unstable [all]) Conf cool (2 unstable [all]) Conf newrec-cool (2 unstable [all])' aptget install newrec-cool -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: super @@ -109,7 +109,7 @@ Inst super (2 unstable [all]) Conf newrec-super (2 unstable [all]) Conf super (2 unstable [all])' aptget install newrec-super -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: cool @@ -121,7 +121,7 @@ Inst newrec-coolorstuff [1] (2 unstable [all]) Conf cool (2 unstable [all]) Conf newrec-coolorstuff (2 unstable [all])' aptget install newrec-coolorstuff -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: stuff @@ -133,7 +133,7 @@ Inst stuff [1] (2 unstable [all]) Conf cool-gone (2 unstable [all]) Conf stuff (2 unstable [all])' aptget install cool-gone -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: super @@ -149,7 +149,7 @@ Conf super-overtake (2 unstable [all])' aptget install super-overtake -s # if super would be in front, we would get a new here as it is new and # the first option in an or-group should be the preferred one… -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: cool @@ -163,7 +163,7 @@ Conf upgrade-over-new (2 unstable [all])' aptget install upgrade-over-new -s # the recommends wasn't used before so while we could do it now, # the user doesn't seem to need it so avoid upgrading it -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be upgraded: now-satisfiable diff --git a/test/integration/test-bug-507998-dist-upgrade-recommends b/test/integration/test-bug-507998-dist-upgrade-recommends index f3b4e04fb..70c6fb496 100755 --- a/test/integration/test-bug-507998-dist-upgrade-recommends +++ b/test/integration/test-bug-507998-dist-upgrade-recommends @@ -14,7 +14,7 @@ insertpackage 'unstable' 'wireshark' 'amd64' '1.2.1-2' 'Depends: wireshark-commo setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be upgraded: diff --git a/test/integration/test-bug-543966-downgrade-below-1000-pin b/test/integration/test-bug-543966-downgrade-below-1000-pin index f602bea95..d37539b9f 100755 --- a/test/integration/test-bug-543966-downgrade-below-1000-pin +++ b/test/integration/test-bug-543966-downgrade-below-1000-pin @@ -15,7 +15,7 @@ setupaptarchive STATUS=$(readlink -f rootdir/var/lib/dpkg/status) APTARCHIVE="$(readlink -f aptarchive)/" -testequal "base-files: +testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 Version table: @@ -28,7 +28,7 @@ echo 'Package: base-files Pin: release a=unstable Pin-Priority: 99' > rootdir/etc/apt/preferences -testequal "base-files: +testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 Package pin: 5.0.0 @@ -42,7 +42,7 @@ echo 'Package: base-files Pin: release a=unstable Pin-Priority: 100' > rootdir/etc/apt/preferences -testequal "base-files: +testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 Package pin: 5.0.0 @@ -56,7 +56,7 @@ echo 'Package: base-files Pin: release a=unstable Pin-Priority: 999' > rootdir/etc/apt/preferences -testequal "base-files: +testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 Package pin: 5.0.0 @@ -70,7 +70,7 @@ echo 'Package: base-files Pin: release a=unstable Pin-Priority: 1000' > rootdir/etc/apt/preferences -testequal "base-files: +testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0 Package pin: 5.0.0 diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed index 8c434b3ce..3ff4807de 100755 --- a/test/integration/test-bug-549968-install-depends-of-not-installed +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -14,7 +14,7 @@ setupaptarchive # We check the Markers here as the autoremove nuker will also # prevent it, but to late - its better to fail earlier -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1 Ignore MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) as its mode (Keep) is protected diff --git a/test/integration/test-bug-590041-prefer-non-virtual-packages b/test/integration/test-bug-590041-prefer-non-virtual-packages index 0ce4c1413..3bd7d436e 100755 --- a/test/integration/test-bug-590041-prefer-non-virtual-packages +++ b/test/integration/test-bug-590041-prefer-non-virtual-packages @@ -46,8 +46,8 @@ EOF setupaptarchive testshowvirtual libc6:i386 -testequal "$pkglibc6" aptcache show libc6:armel -testequal "$pkglibc6" aptcache show libc6 -testequal "$pkglibdb1" aptcache show libdb1:i386 +testsuccessequal "$pkglibc6" aptcache show libc6:armel +testsuccessequal "$pkglibc6" aptcache show libc6 +testsuccessequal "$pkglibdb1" aptcache show libdb1:i386 testnopackage libdb1:armel -testequal "$pkglibdb1" aptcache show libdb1 +testsuccessequal "$pkglibdb1" aptcache show libdb1 diff --git a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order index 645e86d7d..37426ec11 100755 --- a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order +++ b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order @@ -29,7 +29,7 @@ predependsgawk() { echo "$pkgbasefile Pre-Depends: $1 " >> rootdir/var/lib/dpkg/status - testequal "Inst gawk (1:3.1.7.dfsg-5 localhost [i386]) + testsuccessequal "Inst gawk (1:3.1.7.dfsg-5 localhost [i386]) Conf gawk (1:3.1.7.dfsg-5 localhost [i386]) Remv mawk [1.3.3-15]" aptget install gawk mawk- -sqq -o PreDepends=$(echo "$1" | sed 's/ //g') } diff --git a/test/integration/test-bug-591882-conkeror b/test/integration/test-bug-591882-conkeror index 891ddb8b7..b71d4d5fd 100755 --- a/test/integration/test-bug-591882-conkeror +++ b/test/integration/test-bug-591882-conkeror @@ -73,5 +73,5 @@ After this operation, 36.0 MB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." # Test that the old behavior can be restored with the option -testequal "$UPGRADEFAIL" aptget dist-upgrade --trivial-only -o pkgProblemResolver::FixByInstall=0 -testequal "$UPGRADESUCCESS" aptget dist-upgrade --trivial-only #-o pkgProblemResolver::FixByInstall=0 +testfailureequal "$UPGRADEFAIL" aptget dist-upgrade --trivial-only -o pkgProblemResolver::FixByInstall=0 +testfailureequal "$UPGRADESUCCESS" aptget dist-upgrade --trivial-only #-o pkgProblemResolver::FixByInstall=0 diff --git a/test/integration/test-bug-593360-modifiers-in-names b/test/integration/test-bug-593360-modifiers-in-names index 74826cbdb..57a24683e 100755 --- a/test/integration/test-bug-593360-modifiers-in-names +++ b/test/integration/test-bug-593360-modifiers-in-names @@ -7,7 +7,7 @@ setupenvironment configarchitecture "i386" setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: g++ @@ -15,12 +15,12 @@ The following NEW packages will be installed: Inst g++ (4:4.4.5-1 localhost [i386]) Conf g++ (4:4.4.5-1 localhost [i386])' aptget install g++ -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'g++' is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove g++ -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: g++ @@ -28,7 +28,7 @@ The following NEW packages will be installed: Inst g++ (4:4.4.5-1 localhost [i386]) Conf g++ (4:4.4.5-1 localhost [i386])' aptget install g+++ -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: g++ @@ -36,7 +36,7 @@ The following NEW packages will be installed: Inst g++ (4:4.4.5-1 localhost [i386]) Conf g++ (4:4.4.5-1 localhost [i386])' aptget purge g+++ -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: apt @@ -44,7 +44,7 @@ The following NEW packages will be installed: Inst apt (0.8.8 localhost [all]) Conf apt (0.8.8 localhost [all])' aptget install apt -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: apt+ @@ -52,7 +52,7 @@ The following NEW packages will be installed: Inst apt+ (0.8.8 localhost [all]) Conf apt+ (0.8.8 localhost [all])' aptget install apt+ -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: apt+ @@ -60,7 +60,7 @@ The following NEW packages will be installed: Inst apt+ (0.8.8 localhost [all]) Conf apt+ (0.8.8 localhost [all])' aptget install apt++ -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: apt+ diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo index 1e5e75b0e..4eb77b9a4 100755 --- a/test/integration/test-bug-596498-trusted-unsigned-repo +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -18,16 +18,16 @@ aptgetupdate() { PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)" DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list' -testequal "$PKGTEXT +testsuccessequal "$PKGTEXT Download complete and in download only mode" aptget install cool --assume-no -d -testequal "$PKGTEXT +testsuccessequal "$PKGTEXT Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE aptgetupdate 'testsuccess' -testequal "$PKGTEXT +testfailureequal "$PKGTEXT WARNING: The following packages cannot be authenticated! cool Install these packages without verification? [y/N] N @@ -37,13 +37,13 @@ find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete sed -i -e 's#deb \[trusted=no\]#deb#' $DEBFILE aptgetupdate -testequal "$PKGTEXT +testfailureequal "$PKGTEXT WARNING: The following packages cannot be authenticated! cool Install these packages without verification? [y/N] N E: Some packages could not be authenticated" aptget install cool --assume-no -d -testequal "$PKGTEXT +testsuccessequal "$PKGTEXT WARNING: The following packages cannot be authenticated! cool Authentication warning overridden. @@ -52,5 +52,5 @@ Download complete and in download only mode" aptget install cool --assume-no -d sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE aptgetupdate -testequal "$PKGTEXT +testsuccessequal "$PKGTEXT Download complete and in download only mode" aptget install cool --assume-no -d diff --git a/test/integration/test-bug-598669-install-postfix-gets-exim-heavy b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy index c3a77f346..2ec1d3d1c 100755 --- a/test/integration/test-bug-598669-install-postfix-gets-exim-heavy +++ b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy @@ -7,7 +7,7 @@ setupenvironment configarchitecture "i386" setupaptarchive -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... The following packages will be REMOVED: exim4 exim4-daemon-light diff --git a/test/integration/test-bug-601961-install-info b/test/integration/test-bug-601961-install-info index 914910597..806d3f547 100755 --- a/test/integration/test-bug-601961-install-info +++ b/test/integration/test-bug-601961-install-info @@ -7,7 +7,7 @@ setupenvironment configarchitecture "i386" setupaptarchive -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: findutils @@ -18,7 +18,7 @@ This should NOT be done unless you know exactly what you are doing! After this operation, 1745 kB disk space will be freed. E: Trivial Only specified but this is not a trivial operation.' aptget remove findutils --trivial-only -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: install-info @@ -26,7 +26,7 @@ The following packages will be REMOVED: After this operation, 262 kB disk space will be freed. E: Trivial Only specified but this is not a trivial operation.' aptget remove install-info --trivial-only -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: essentialpkg findutils diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index 6393f0c27..d3573a79a 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -20,7 +20,7 @@ testrun() { testsuccess --nomsg aptget update # check that I-M-S header is kept in redirections - testequal "Hit $1 unstable InRelease + testsuccessequal "Hit $1 unstable InRelease Hit $1 unstable/main Sources Hit $1 unstable/main amd64 Packages Hit $1 unstable/main Translation-en diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove index b29347f64..52992680b 100755 --- a/test/integration/test-bug-604222-new-and-autoremove +++ b/test/integration/test-bug-604222-new-and-autoremove @@ -11,7 +11,7 @@ touch rootdir/var/lib/apt/extended_states testsuccess aptmark markauto 'libvtk5.4' testmarkedauto 'libvtk5.4' -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Reading state information... The following package was automatically installed and is no longer required: @@ -23,7 +23,7 @@ The following NEW packages will be installed: Inst libavcodec52 (4:0.5.2-6 localhost [i386]) Conf libavcodec52 (4:0.5.2-6 localhost [i386])" aptget install libavcodec52 -s -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Reading state information... The following package was automatically installed and is no longer required: @@ -61,6 +61,6 @@ Need to get 0 B/6304 kB of archives. After this operation, 17.3 MB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation.' -testequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=0 -testequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=1 -testequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=small +testfailureequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=0 +testfailureequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=1 +testfailureequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=small diff --git a/test/integration/test-bug-605394-versioned-or-groups b/test/integration/test-bug-605394-versioned-or-groups index bb72d59e3..f938ba311 100755 --- a/test/integration/test-bug-605394-versioned-or-groups +++ b/test/integration/test-bug-605394-versioned-or-groups @@ -7,7 +7,7 @@ setupenvironment configarchitecture "i386" setupaptarchive -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be upgraded: diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual index e3d454f97..a7bde393b 100755 --- a/test/integration/test-bug-611729-mark-as-manual +++ b/test/integration/test-bug-611729-mark-as-manual @@ -34,14 +34,14 @@ testdpkgnotinstalled a testdpkginstalled b c testmarkedauto 'b' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... b is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b --only-upgrade testmarkedauto 'b' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... b is already the newest version. @@ -59,7 +59,7 @@ sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: testfileequal 'rootdir/var/log/apt/history.log' ' Reinstall: b:i386 (1.0)' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... b is already the newest version. diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts index c32600037..401b521a5 100755 --- a/test/integration/test-bug-612099-multiarch-conflicts +++ b/test/integration/test-bug-612099-multiarch-conflicts @@ -17,7 +17,7 @@ setupaptarchive testsuccess aptget install libc6:i386 -t stable -y testdpkginstalled libc6:i386 -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: @@ -29,7 +29,7 @@ Remv libc6 [1.0] Inst libc6:amd64 (1.0 stable [amd64]) Conf libc6:amd64 (1.0 stable [amd64])' aptget install libc6:amd64 -s -t stable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -38,7 +38,7 @@ The following NEW packages will be installed: Inst foobar (1.0 stable [i386]) Conf foobar (1.0 stable [i386])' aptget install foobar -st stable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: @@ -54,7 +54,7 @@ Inst foobar:amd64 (1.0 stable [amd64]) Conf libc6:amd64 (1.0 stable [amd64]) Conf foobar:amd64 (1.0 stable [amd64])' aptget install foobar:amd64 -st stable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -67,7 +67,7 @@ Inst foobar (1.0 stable [i386]) Conf libc6 (2.0 testing [all]) Conf foobar (1.0 stable [i386])' aptget install foobar/stable libc6 -st testing -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... @@ -84,7 +84,7 @@ testsuccess aptget purge libc6 -y testsuccess aptget install libc6:i386 -y testdpkginstalled libc6:all -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -93,7 +93,7 @@ The following NEW packages will be installed: Inst foobar (1.0 stable [i386]) Conf foobar (1.0 stable [i386])' aptget install foobar/stable -st testing -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: @@ -110,7 +110,7 @@ Conf libc6:amd64 (1.0 stable [amd64]) Conf foobar:amd64 (1.0 stable [amd64])' aptget install foobar:amd64/stable -st testing -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Reading state information... Selected version '1.0' (stable [i386]) for 'libc6' @@ -133,7 +133,7 @@ setupaptarchive testsuccess aptget install libc6-same:i386 -t stable -y testdpkginstalled libc6-same:i386 -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -142,7 +142,7 @@ The following NEW packages will be installed: Inst foobar-same (1.0 stable [i386]) Conf foobar-same (1.0 stable [i386])' aptget install foobar-same -st stable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: @@ -155,7 +155,7 @@ Inst foobar-same:amd64 (1.0 stable [amd64]) Conf libc6-same:amd64 (1.0 stable [amd64]) Conf foobar-same:amd64 (1.0 stable [amd64])' aptget install foobar-same:amd64 -st stable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -166,7 +166,7 @@ Conf libc6-same:amd64 (1.0 stable [amd64])' aptget install libc6-same:amd64 -s - # FIXME: We should test installing libc6-same:amd64 here, but dpkg doesn't allow it currently -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... @@ -184,7 +184,7 @@ testsuccess aptget install libc6-same:i386 -y testdpkginstalled libc6-same:all -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Reading state information... Selected version '1.0' (stable [i386]) for 'libc6-same' @@ -194,7 +194,7 @@ The following packages will be DOWNGRADED: Inst libc6-same [2.0] (1.0 stable [i386]) Conf libc6-same (1.0 stable [i386])" aptget install libc6-same/stable -s -q=0 -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -203,7 +203,7 @@ The following NEW packages will be installed: Inst foobar-same (1.0 stable [i386]) Conf foobar-same (1.0 stable [i386])' aptget install foobar-same/stable -st testing -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: diff --git a/test/integration/test-bug-612557-garbage-upgrade b/test/integration/test-bug-612557-garbage-upgrade index 910b3b149..552330d81 100755 --- a/test/integration/test-bug-612557-garbage-upgrade +++ b/test/integration/test-bug-612557-garbage-upgrade @@ -17,7 +17,7 @@ testsuccess aptmark markauto python-uno openoffice.org-common #aptmark unmarkauto openoffice.org-emailmerge testmarkedauto python-uno openoffice.org-common -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: @@ -35,7 +35,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget --trivial testsuccess aptmark markauto openoffice.org-emailmerge testmarkedauto python-uno openoffice.org-common openoffice.org-emailmerge -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: @@ -50,7 +50,7 @@ The following packages will be upgraded: After this operation, 53.2 MB disk space will be freed. E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: diff --git a/test/integration/test-bug-613420-new-garbage-dependency b/test/integration/test-bug-613420-new-garbage-dependency index 9d9f1096a..5839f8798 100755 --- a/test/integration/test-bug-613420-new-garbage-dependency +++ b/test/integration/test-bug-613420-new-garbage-dependency @@ -18,7 +18,7 @@ touch rootdir/var/lib/apt/extended_states testsuccess aptmark markauto openoffice.org-officebean testmarkedauto openoffice.org-officebean -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Reading state information... The following packages were automatically installed and are no longer required: diff --git a/test/integration/test-bug-618848-always-respect-user-requests b/test/integration/test-bug-618848-always-respect-user-requests index 1ebadf280..a7ffee6c1 100755 --- a/test/integration/test-bug-618848-always-respect-user-requests +++ b/test/integration/test-bug-618848-always-respect-user-requests @@ -13,7 +13,7 @@ insertpackage 'unstable' 'exim4-daemon-heavy' 'all' '1.0' 'Depends: libdb4.8' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... MarkDelete libdb4.8 [ i386 ] < 1.0 > ( other ) FU=1 MarkDelete exim4-daemon-light [ i386 ] < 1.0 > ( other ) FU=0 diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index 652386892..3987abff1 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -65,29 +65,27 @@ configallowinsecurerepositories "true"; msgtest 'Download of en as forced language' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=en -cp rootdir/tmp/testsuccess.output testsuccess.output -testsuccess grep -q -e 'Translation-en ' testsuccess.output +testsuccess grep -q -e 'Translation-en ' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=en -testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output +testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of ast_DE as forced language' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=ast_DE -cp rootdir/tmp/testsuccess.output testsuccess.output -testsuccess grep -q -e 'Translation-ast_DE$' testsuccess.output +testsuccess grep -q -e 'Translation-ast_DE$' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=ast_DE -testfailure grep -q -e 'Translation-[^a][^s]' rootdir/tmp/testsuccess.output +testfailure grep -q -e 'Translation-[^a][^s]' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing if none is forced' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=none -testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output +testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists @@ -95,8 +93,7 @@ touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translat msgtest 'Download of builtin files' 'without Index' testwarning --nomsg aptget update -cp rootdir/tmp/testsuccess.output testsuccess.output -testsuccess grep -q -e 'Translation-ast_DE' testsuccess.output +testsuccess grep -q -e 'Translation-ast_DE' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists @@ -104,5 +101,5 @@ touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translat msgtest 'Download of nothing (even builtin) if none is forced' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=none -testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output +testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction index d90a103c9..563821173 100755 --- a/test/integration/test-bug-632221-cross-dependency-satisfaction +++ b/test/integration/test-bug-632221-cross-dependency-satisfaction @@ -35,17 +35,17 @@ insertsource 'unstable' 'source-specific-armel' 'armel' '1' 'Build-Depends: spec setupaptarchive -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... E: Build-Depends dependency for forbidden-none can't be satisfied because amdboot:any is not allowed on 'Multi-Arch: none' packages" aptget build-dep forbidden-none -s -a armel -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... E: Build-Depends dependency for forbidden-same can't be satisfied because libc6:any is not allowed on 'Multi-Arch: same' packages" aptget build-dep forbidden-same -s -a armel -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... E: Build-Depends dependency for forbidden-foreign can't be satisfied because doxygen:any is not allowed on 'Multi-Arch: foreign' packages" aptget build-dep forbidden-foreign -s -a armel -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libc6 specific @@ -54,7 +54,7 @@ Inst libc6 (1.0 unstable [amd64]) Inst specific (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [amd64]) Conf specific (1.0 unstable [amd64])' aptget build-dep source-specific-amd64 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libc6 specific @@ -64,7 +64,7 @@ Inst specific (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [amd64]) Conf specific (1.0 unstable [amd64])' aptget build-dep source-specific-amd64 -s -a armel -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libc6:armel specific:armel @@ -73,7 +73,7 @@ Inst libc6:armel (1.0 unstable [armel]) Inst specific:armel (1.0 unstable [armel]) Conf libc6:armel (1.0 unstable [armel]) Conf specific:armel (1.0 unstable [armel])' aptget build-dep source-specific-armel -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libc6:armel specific:armel @@ -83,7 +83,7 @@ Inst specific:armel (1.0 unstable [armel]) Conf libc6:armel (1.0 unstable [armel]) Conf specific:armel (1.0 unstable [armel])' aptget build-dep source-specific-armel -s -a armel -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot cool doxygen foreigner libc6 libc6-dev libfwibble-dev libfwibble1 @@ -108,7 +108,7 @@ Conf libfwibble1 (1.0 unstable [amd64]) Conf libfwibble-dev (1.0 unstable [amd64]) Conf linux-stuff (1.0 unstable [amd64])' aptget build-dep apt -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot arm-stuff:armel cool doxygen foreigner libc6 libc6:armel libc6-dev @@ -139,7 +139,7 @@ Conf libfwibble-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a arm configarchitecture 'armel' 'amd64' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot:amd64 arm-stuff cool doxygen foreigner libc6 libc6-dev @@ -164,7 +164,7 @@ Conf libc6-dev (1.0 unstable [armel]) Conf libfwibble1 (1.0 unstable [armel]) Conf libfwibble-dev (1.0 unstable [armel])' aptget build-dep apt -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot:amd64 cool doxygen foreigner libc6:amd64 libc6 libc6-dev:amd64 @@ -198,7 +198,7 @@ configarchitecture 'amd64' 'armel' insertinstalledpackage 'cool' 'amd64' '0.5' insertinstalledpackage 'foreigner' 'armel' '0.5' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot doxygen libc6 libc6-dev libfwibble-dev libfwibble1 linux-stuff @@ -218,7 +218,7 @@ Conf libfwibble1 (1.0 unstable [amd64]) Conf libfwibble-dev (1.0 unstable [amd64]) Conf linux-stuff (1.0 unstable [amd64])' aptget build-dep apt -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot arm-stuff:armel doxygen libc6 libc6:armel libc6-dev libc6-dev:armel @@ -246,7 +246,7 @@ Conf libfwibble-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a arm configarchitecture 'armel' 'amd64' # cool 0.5 is not M-A: allowed, so amd64 is not acceptable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: cool:amd64 @@ -272,7 +272,7 @@ Conf libc6-dev (1.0 unstable [armel]) Conf libfwibble1 (1.0 unstable [armel]) Conf libfwibble-dev (1.0 unstable [armel])' aptget build-dep apt -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot:amd64 doxygen libc6:amd64 libc6 libc6-dev:amd64 libc6-dev diff --git a/test/integration/test-bug-64141-install-dependencies-for-on-hold b/test/integration/test-bug-64141-install-dependencies-for-on-hold index 9e6c223a8..ff8fa4523 100755 --- a/test/integration/test-bug-64141-install-dependencies-for-on-hold +++ b/test/integration/test-bug-64141-install-dependencies-for-on-hold @@ -19,7 +19,7 @@ insertpackage 'unstable' 'libdb4.8' 'native' '4.8.30-3' setupaptarchive -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: @@ -34,7 +34,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgr testsuccess aptmark hold apt -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages have been kept back: diff --git a/test/integration/test-bug-657695-resolver-breaks-on-virtuals b/test/integration/test-bug-657695-resolver-breaks-on-virtuals index 1b92a04fe..14c90b3b9 100755 --- a/test/integration/test-bug-657695-resolver-breaks-on-virtuals +++ b/test/integration/test-bug-657695-resolver-breaks-on-virtuals @@ -16,7 +16,7 @@ insertpackage 'unstable' 'xserver-xorg-core' 'amd64' '2:1.11.3-0ubuntu9' 'Breaks setupaptarchive -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: diff --git a/test/integration/test-bug-661537-build-profiles-support b/test/integration/test-bug-661537-build-profiles-support index 6c850fdf9..7e7a74b03 100755 --- a/test/integration/test-bug-661537-build-profiles-support +++ b/test/integration/test-bug-661537-build-profiles-support @@ -24,7 +24,7 @@ insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo = 1)' insertinstalledpackage 'pkgz' 'none' '1' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: @@ -111,7 +111,7 @@ The following packages will be REMOVED: 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. Purg pkgy:none [1] Purg pkgx:none [1]' aptget purge pkgx -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: diff --git a/test/integration/test-bug-689582-100-char-long-path-names b/test/integration/test-bug-689582-100-char-long-path-names index 1b4b172b6..58ece1d5a 100755 --- a/test/integration/test-bug-689582-100-char-long-path-names +++ b/test/integration/test-bug-689582-100-char-long-path-names @@ -28,7 +28,7 @@ ar cr ../testpkg.deb debian-binary control.tar.gz data.tar.gz cd - > /dev/null -testequal '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000102 testpkg +testsuccessequal '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000102 testpkg 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101 testpkg 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100 testpkg 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000099 testpkg diff --git a/test/integration/test-bug-691453-apt-cache-search-multi-pattern b/test/integration/test-bug-691453-apt-cache-search-multi-pattern index 0367892fc..15586b726 100755 --- a/test/integration/test-bug-691453-apt-cache-search-multi-pattern +++ b/test/integration/test-bug-691453-apt-cache-search-multi-pattern @@ -21,13 +21,13 @@ foo - tool best used with bar bar - tool best used with foo baz - alternative tool best used with foo' -testequal "$FOOBAR" aptcache search foo -testequal "$FOOBAR" aptcache search bar -testequal "$FOOBAR" aptcache search foo bar +testsuccessequal "$FOOBAR" aptcache search foo +testsuccessequal "$FOOBAR" aptcache search bar +testsuccessequal "$FOOBAR" aptcache search foo bar -testequal 'foobar - funky tool +testsuccessequal 'foobar - funky tool foo - tool best used with bar' aptcache search -n foo -testequal 'foobar - funky tool +testsuccessequal 'foobar - funky tool bar - tool best used with foo baz - alternative tool best used with foo' aptcache search -n bar -testequal 'foobar - funky tool' aptcache search -n foo bar +testsuccessequal 'foobar - funky tool' aptcache search -n foo bar diff --git a/test/integration/test-bug-709560-set-candidate-release b/test/integration/test-bug-709560-set-candidate-release index 48dc5c382..ab41d8f2a 100755 --- a/test/integration/test-bug-709560-set-candidate-release +++ b/test/integration/test-bug-709560-set-candidate-release @@ -21,7 +21,7 @@ EOF setupaptarchive -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Selected version '2.0' (experimental [all]) for 'foo' Selected version '2.1' (experimental [all]) for 'foo-dep' because of 'foo' diff --git a/test/integration/test-bug-712435-missing-descriptions b/test/integration/test-bug-712435-missing-descriptions index 7a3518745..726134326 100755 --- a/test/integration/test-bug-712435-missing-descriptions +++ b/test/integration/test-bug-712435-missing-descriptions @@ -81,43 +81,43 @@ Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > aptarchive/Packages setupaptarchive -testequal "Package: apt-normal +testsuccessequal "Package: apt-normal $PACKAGESTANZA $DESCRIPTION Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " aptcache show apt-normal for variant in 'below' 'middle' 'top'; do - testequal "Package: apt-both-$variant + testsuccessequal "Package: apt-both-$variant $PACKAGESTANZA $TRANSDESCRIPTION Description-md5: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb " aptcache show apt-both-$variant done -testequal "Package: apt-trans +testsuccessequal "Package: apt-trans $PACKAGESTANZA $TRANSDESCRIPTION Description-md5: cccccccccccccccccccccccccccccccc " aptcache show apt-trans -testequal "Package: apt-md5 +testsuccessequal "Package: apt-md5 $PACKAGESTANZA Description-md5: dddddddddddddddddddddddddddddddd " aptcache show apt-md5 -testequal "Package: apt-none +testsuccessequal "Package: apt-none $PACKAGESTANZA " aptcache show apt-none -testequal "Package: apt-intermixed +testsuccessequal "Package: apt-intermixed $PACKAGESTANZA $DESCRIPTION Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa X-Some-Flag: yes " aptcache show apt-intermixed -testequal "Package: apt-intermixed2 +testsuccessequal "Package: apt-intermixed2 $PACKAGESTANZA $TRANSDESCRIPTION Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa @@ -126,7 +126,7 @@ X-Foo-Flag: Something with a Description X-Bar-Flag: no " aptcache show apt-intermixed2 -testequal "Package: apt-intermixed3 +testsuccessequal "Package: apt-intermixed3 $PACKAGESTANZA $TRANSDESCRIPTION Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa @@ -152,7 +152,7 @@ Reverse Provides: ' testempty aptcache search nonexistentstring # packages without a description can't be found -testequal 'apt-normal - commandline package manager +testsuccessequal 'apt-normal - commandline package manager apt-both-below - commandline package manager apt-both-middle - commandline package manager apt-both-top - commandline package manager diff --git a/test/integration/test-bug-717891-abolute-uris-for-proxies b/test/integration/test-bug-717891-abolute-uris-for-proxies index 54a616686..ef948c2d5 100755 --- a/test/integration/test-bug-717891-abolute-uris-for-proxies +++ b/test/integration/test-bug-717891-abolute-uris-for-proxies @@ -19,7 +19,7 @@ echo 'Acquire::http::Proxy "http://localhost:8080";' > rootdir/etc/apt/apt.conf. msgtest 'Check that requests to proxies are' 'absolute uris' testsuccess --nomsg aptget update -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: unrelated diff --git a/test/integration/test-bug-718329-support-data.tar-uncompressed b/test/integration/test-bug-718329-support-data.tar-uncompressed new file mode 100755 index 000000000..d2845f768 --- /dev/null +++ b/test/integration/test-bug-718329-support-data.tar-uncompressed @@ -0,0 +1,31 @@ +#!/bin/sh +set -e + +test_process_package_with_compression() { + COMPRESSOR="$1" + DATA_TAR="$2" + + msgmsg "Testing apt-ftparchive with compression type: $COMPRESSOR" + + buildsimplenativepackage 'pkg' 'all' '1.0' '' '' 'some descr' '' '' '' "$COMPRESSOR" + testsuccessequal "debian-binary +control.tar.gz +$DATA_TAR" ar t incoming/pkg_1.0_all.deb + + testequal "Package: pkg" echo "$(aptftparchive packages incoming/|grep ^Package)" + + testsuccessequal "usr/bin/pkg-all pkg +usr/share/doc/pkg/FEATURES pkg +usr/share/doc/pkg/changelog pkg +usr/share/doc/pkg/copyright pkg" aptftparchive contents incoming/ + + rm -rf incoming/* +} + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +test_process_package_with_compression "gzip" "data.tar.gz" +test_process_package_with_compression "none" "data.tar" +test_process_package_with_compression "xz" "data.tar.xz" diff --git a/test/integration/test-bug-719263-print-uris-removes-authentication b/test/integration/test-bug-719263-print-uris-removes-authentication index 5e674db0b..207bf4611 100755 --- a/test/integration/test-bug-719263-print-uris-removes-authentication +++ b/test/integration/test-bug-719263-print-uris-removes-authentication @@ -15,7 +15,7 @@ setupaptarchive testnoact() { cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup-noact touch rootdir/var/lib/apt/extended_states - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be upgraded: diff --git a/test/integration/test-bug-720597-build-dep-purge b/test/integration/test-bug-720597-build-dep-purge index 1e24ed5f1..6fa261fbd 100755 --- a/test/integration/test-bug-720597-build-dep-purge +++ b/test/integration/test-bug-720597-build-dep-purge @@ -13,7 +13,7 @@ buildsimplenativepackage 'pkgc' 'amd64' '1' 'stable' 'Build-Depends: pkgb' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: pkga @@ -24,7 +24,7 @@ Remv pkga [1] Inst pkgb (1 stable [amd64]) Conf pkgb (1 stable [amd64])' aptget build-dep pkgc -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: pkga* diff --git a/test/integration/test-bug-722207-print-uris-even-if-very-quiet b/test/integration/test-bug-722207-print-uris-even-if-very-quiet index 9a5685703..2cad929cc 100755 --- a/test/integration/test-bug-722207-print-uris-even-if-very-quiet +++ b/test/integration/test-bug-722207-print-uris-even-if-very-quiet @@ -16,15 +16,15 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) -testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget upgrade -qq --print-uris -testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget dist-upgrade -qq --print-uris -testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget install apt -qq --print-uris -testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget download apt -qq --print-uris -testequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget upgrade -qq --print-uris +testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget dist-upgrade -qq --print-uris +testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget install apt -qq --print-uris +testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget download apt -qq --print-uris +testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt -qq --print-uris -testequal "'http://packages.debian.org/changelogs/pool/main/apt/apt_2/changelog'" aptget changelog apt -qq --print-uris +testsuccessequal "'http://packages.debian.org/changelogs/pool/main/apt/apt_2/changelog'" aptget changelog apt -qq --print-uris -testequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/apt2_1.dsc' apt2_1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/apt2_1.tar.gz' apt2_1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt apt2 -qq --print-uris diff --git a/test/integration/test-bug-723586-any-stripped-in-single-arch b/test/integration/test-bug-723586-any-stripped-in-single-arch index 392b88e9f..0cf3362cf 100755 --- a/test/integration/test-bug-723586-any-stripped-in-single-arch +++ b/test/integration/test-bug-723586-any-stripped-in-single-arch @@ -41,14 +41,14 @@ The following packages have unmet dependencies: python-mips : Depends: python3:mips but it is not installable E: Unable to correct problems, you have held broken packages.' -testequal "$INSTALLLOG" aptget install python3-gnupg -s +testsuccessequal "$INSTALLLOG" aptget install python3-gnupg -s aptcache showpkg python3 > showpkg.log -testequal "$FAILLOG" aptget install python-mips -s +testfailureequal "$FAILLOG" aptget install python-mips -s # same test, but this time in a multi-arch environment configarchitecture 'amd64' 'armhf' rm rootdir/var/cache/apt/*.bin -testequal "$INSTALLLOG" aptget install python3-gnupg -s -testequal "$(sed 's#3.3.2-16 - python3#3.3.2-16 - python3:any:armhf python3#' showpkg.log)" aptcache showpkg python3 -testequal "$FAILLOG" aptget install python-mips -s +testsuccessequal "$INSTALLLOG" aptget install python3-gnupg -s +testsuccessequal "$(sed 's#3.3.2-16 - python3#3.3.2-16 - python3:any:armhf python3#' showpkg.log)" aptcache showpkg python3 +testfailureequal "$FAILLOG" aptget install python-mips -s diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir index 37e5a013e..3ae94c58f 100755 --- a/test/integration/test-bug-728500-tempdir +++ b/test/integration/test-bug-728500-tempdir @@ -26,5 +26,5 @@ else fi unset TMPDIR -testequal 'coolstuff' aptcache pkgnames +testsuccessequal 'coolstuff' aptcache pkgnames testsuccess ls rootdir/var/lib/apt/lists/*InRelease diff --git a/test/integration/test-bug-732746-preferences b/test/integration/test-bug-732746-preferences index b31f98aa0..ce73f1c17 100755 --- a/test/integration/test-bug-732746-preferences +++ b/test/integration/test-bug-732746-preferences @@ -25,7 +25,7 @@ Pin-Priority: 700 #Pin: 800 EOF -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree..." aptget check msgtest "Ensure policy is applied" diff --git a/test/integration/test-bug-735967-lib32-to-i386-unavailable b/test/integration/test-bug-735967-lib32-to-i386-unavailable index 826931fe4..eb6e1a331 100755 --- a/test/integration/test-bug-735967-lib32-to-i386-unavailable +++ b/test/integration/test-bug-735967-lib32-to-i386-unavailable @@ -31,7 +31,7 @@ setupaptarchive --no-update configarchitecture 'amd64' testsuccess aptget update -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: @@ -43,7 +43,7 @@ Remv lib32nss-mdns [0.9-1] Inst libnss-mdns [0.9-1] (0.10-6 unstable [amd64]) Conf libnss-mdns (0.10-6 unstable [amd64])' aptget dist-upgrade -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -59,7 +59,7 @@ E: Unable to correct problems, you have held broken packages.' aptget install fo configarchitecture 'amd64' 'i386' testsuccess aptget update -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following NEW packages will be installed: @@ -76,7 +76,7 @@ Conf libnss-mdns (0.10-6 unstable [amd64]) Conf libnss-mdns-i386:i386 (0.10-6 unstable [i386]) Conf lib32nss-mdns (0.10-6 unstable [amd64])' aptget dist-upgrade -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libfoo libfoo-bin:i386 diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index 0f458e099..f6336ffe3 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -23,7 +23,7 @@ msgtest 'Test that the webserver does not answer' 'http requests' downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog >/dev/null 2>&1 && msgfail || msgpass echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf -testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris +testsuccessequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris cd downloaded testsuccess aptget changelog apt -d @@ -52,7 +52,7 @@ cd - >/dev/null echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf cd downloaded -testequal "E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found. +testfailureequal "E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed?" aptget download apt -q=0 testfailure test -e apt_1.0_all.deb cd - >/dev/null diff --git a/test/integration/test-bug-745036-new-foreign-invalidates-cache b/test/integration/test-bug-745036-new-foreign-invalidates-cache index 2b7ee06ad..bfa0f817c 100755 --- a/test/integration/test-bug-745036-new-foreign-invalidates-cache +++ b/test/integration/test-bug-745036-new-foreign-invalidates-cache @@ -14,7 +14,7 @@ setupaptarchive testsuccess aptget check -s configarchitecture 'amd64' 'i386' -testequal 'E: The package cache was built for different architectures: amd64 vs amd64,i386' aptget check -s -o pkgCacheFile::Generate=false +testfailureequal 'E: The package cache was built for different architectures: amd64 vs amd64,i386' aptget check -s -o pkgCacheFile::Generate=false testsuccess aptget check -s diff --git a/test/integration/test-bug-745046-candidate-propagation-fails b/test/integration/test-bug-745046-candidate-propagation-fails index e4aa67a72..f54e1872e 100755 --- a/test/integration/test-bug-745046-candidate-propagation-fails +++ b/test/integration/test-bug-745046-candidate-propagation-fails @@ -14,7 +14,7 @@ insertpackage 'experimental' 'gedit' 'amd64' '2' 'Depends: common (>= 2)' setupaptarchive -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2' (experimental [amd64]) for 'gedit' Some packages could not be installed. This may mean that you have @@ -29,7 +29,7 @@ E: Unable to correct problems, you have held broken packages." aptget install ge insertinstalledpackage 'common' 'amd64' '2' -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Selected version '2' (experimental [amd64]) for 'gedit' The following packages will be upgraded: diff --git a/test/integration/test-bug-753297-upgradable b/test/integration/test-bug-753297-upgradable index 01395a095..53bf3361b 100755 --- a/test/integration/test-bug-753297-upgradable +++ b/test/integration/test-bug-753297-upgradable @@ -25,9 +25,9 @@ insertpackage 'testing' 'bar' 'all' '2' setupaptarchive -testequal "Listing... +testsuccessequal "Listing... bar/testing 2 all [upgradable from: 1]" apt list --upgradable -testequal "Listing... +testsuccessequal "Listing... bar/testing 2 all [upgradable from: 1] foo/testing,now 1 all [installed]" apt list diff --git a/test/integration/test-bug-758153-versioned-provides-support b/test/integration/test-bug-758153-versioned-provides-support index 21f9123c9..30bc921c3 100755 --- a/test/integration/test-bug-758153-versioned-provides-support +++ b/test/integration/test-bug-758153-versioned-provides-support @@ -24,9 +24,15 @@ insertpackage 'experimental' 'foreign-webserver' 'i386' '4' 'Multi-Arch: foreign Provides: httpd (= 4)' insertpackage 'experimental' 'cool-webapp' 'all' '4' 'Depends: httpd (>= 4)' +# arch-qualified provides, see #777071 +insertpackage 'unstable' 'foo' 'all' '1' 'Provides: bar:i386' +insertpackage 'unstable' 'baz' 'i386,amd64' '1' 'Depends: bar' +insertpackage 'experimental' 'baz' 'i386,amd64' '2' 'Depends: bar:i386' +insertpackage 'experimental' 'baz-broken' 'i386' '2' 'Depends: bar:amd64' + setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be upgraded: @@ -37,7 +43,7 @@ Inst webapp [1] (2 unstable [all]) Conf webserver (2 unstable [amd64]) Conf webapp (2 unstable [all])' aptget dist-upgrade -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be upgraded: webapp webserver @@ -47,7 +53,7 @@ Inst webapp [1] (2 unstable [all]) Conf webserver (2 unstable [amd64]) Conf webapp (2 unstable [all])' aptget install webapp webserver -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be upgraded: webapp webserver @@ -57,7 +63,7 @@ Inst webapp [1] (3 experimental [all]) Conf webserver (2 unstable [amd64]) Conf webapp (3 experimental [all])' aptget install webapp=3 webserver -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be upgraded: webapp webserver @@ -67,7 +73,7 @@ Inst webapp [1] (2 unstable [all]) Conf webserver (3 experimental [amd64]) Conf webapp (2 unstable [all])' aptget install webapp webserver=3 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foreign-webserver:i386 @@ -79,7 +85,7 @@ Inst webapp [1] (2 unstable [all]) Conf foreign-webserver:i386 (2 unstable [i386]) Conf webapp (2 unstable [all])' aptget install webapp foreign-webserver:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foreign-webserver:i386 @@ -91,7 +97,7 @@ Inst webapp [1] (3 experimental [all]) Conf foreign-webserver:i386 (2 unstable [i386]) Conf webapp (3 experimental [all])' aptget install webapp=3 foreign-webserver:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foreign-webserver:i386 @@ -103,7 +109,7 @@ Inst webapp [1] (2 unstable [all]) Conf foreign-webserver:i386 (4 experimental [i386]) Conf webapp (2 unstable [all])' aptget install webapp foreign-webserver:i386=4 -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -115,7 +121,7 @@ The following packages have unmet dependencies: cool-webapp : Depends: httpd (>= 4) E: Unable to correct problems, you have held broken packages.' aptget install cool-webapp -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -127,7 +133,7 @@ The following packages have unmet dependencies: cool-webapp : Depends: httpd (>= 4) E: Unable to correct problems, you have held broken packages.' aptget install cool-webapp foreign-webserver:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: cool-webapp foreign-webserver:i386 @@ -136,3 +142,65 @@ Inst foreign-webserver:i386 (4 experimental [i386]) Inst cool-webapp (4 experimental [all]) Conf foreign-webserver:i386 (4 experimental [i386]) Conf cool-webapp (4 experimental [all])' aptget install cool-webapp foreign-webserver:i386=4 -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + baz:i386 foo +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst foo (1 unstable [all]) +Inst baz:i386 (1 unstable [i386]) +Conf foo (1 unstable [all]) +Conf baz:i386 (1 unstable [i386])' aptget install baz:i386 -s + +testfailureequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + baz : Depends: bar but it is not installable +E: Unable to correct problems, you have held broken packages.' aptget install baz:amd64 -s + +testsuccessequal "Reading package lists... +Building dependency tree... +Selected version '2' (experimental [amd64]) for 'baz' +The following extra packages will be installed: + foo +The following NEW packages will be installed: + baz foo +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst foo (1 unstable [all]) +Inst baz (2 experimental [amd64]) +Conf foo (1 unstable [all]) +Conf baz (2 experimental [amd64])" aptget install baz/experimental -s -q=0 + +testsuccessequal "Reading package lists... +Building dependency tree... +Selected version '2' (experimental [i386]) for 'baz:i386' +The following extra packages will be installed: + foo +The following NEW packages will be installed: + baz:i386 foo +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst foo (1 unstable [all]) +Inst baz:i386 (2 experimental [i386]) +Conf foo (1 unstable [all]) +Conf baz:i386 (2 experimental [i386])" aptget install baz:i386/experimental -s -q=0 + +testfailureequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + baz-broken:i386 : Depends: bar but it is not installable +E: Unable to correct problems, you have held broken packages.' aptget install baz-broken -s diff --git a/test/integration/test-bug-770291-reinstall b/test/integration/test-bug-770291-reinstall index ea1f57ede..a5b2aff07 100755 --- a/test/integration/test-bug-770291-reinstall +++ b/test/integration/test-bug-770291-reinstall @@ -39,7 +39,7 @@ Essential: yes' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... 0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. Inst systemd [215-5+b1] (215-5+b1 unstable [i386]) @@ -47,7 +47,7 @@ Conf systemd (215-5+b1 unstable [i386]) Inst systemd-sysv [215-5+b1] (215-5+b1 unstable [i386]) Conf systemd-sysv (215-5+b1 unstable [i386])' aptget install --reinstall systemd systemd-sysv -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... 0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. Inst dependsA [1] (1 unstable [i386]) @@ -68,7 +68,7 @@ testequal "E: Could not configure 'predependsdependsB:i386'. " tail -n1 rootdir/ msgmsg 'While we are at it, lets try these loops without reinstall as well' cp dpkg.status rootdir/var/lib/dpkg/status -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: systemd systemd-sysv @@ -78,7 +78,7 @@ Conf systemd (215-5+b1 unstable [i386]) Inst systemd-sysv (215-5+b1 unstable [i386]) Conf systemd-sysv (215-5+b1 unstable [i386])' aptget install systemd systemd-sysv -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: dependsA dependsB diff --git a/test/integration/test-bug-multiarch-upgrade b/test/integration/test-bug-multiarch-upgrade index c29e1f903..56071f184 100755 --- a/test/integration/test-bug-multiarch-upgrade +++ b/test/integration/test-bug-multiarch-upgrade @@ -16,7 +16,7 @@ insertpackage 'unstable' 'libcups2' 'i386' '2' 'Multi-Arch: same' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libcups2 diff --git a/test/integration/test-cachecontainer-architecture-specification b/test/integration/test-cachecontainer-architecture-specification index 47abfb5b0..e5625e811 100755 --- a/test/integration/test-cachecontainer-architecture-specification +++ b/test/integration/test-cachecontainer-architecture-specification @@ -12,31 +12,31 @@ insertpackage 'unstable' 'foo' 'all' '1' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst libsame (1 unstable [amd64]) Conf libsame (1 unstable [amd64])' aptget -s install libsame -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame:armel 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst libsame:armel (1 unstable [armel]) Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... E: Unable to locate package libsame' aptget -s install libsame:armhf -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst libsame (1 unstable [amd64]) Conf libsame (1 unstable [amd64])' aptget -s install libsame:amd64 -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame libsame:armel @@ -45,7 +45,7 @@ Inst libsame (1 unstable [amd64]) Inst libsame:armel (1 unstable [armel]) Conf libsame (1 unstable [amd64]) Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel libsame:amd64 -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame libsame:armel @@ -54,14 +54,14 @@ Inst libsame (1 unstable [amd64]) Inst libsame:armel (1 unstable [armel]) Conf libsame (1 unstable [amd64]) Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:* -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst libsame (1 unstable [amd64]) Conf libsame (1 unstable [amd64])' aptget -s install libsame:any -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame libsame:armel @@ -70,14 +70,14 @@ Inst libsame (1 unstable [amd64]) Inst libsame:armel (1 unstable [armel]) Conf libsame (1 unstable [amd64]) Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:a* -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst libsame (1 unstable [amd64]) Conf libsame (1 unstable [amd64])' aptget -s install libsame:linux-any -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libsame libsame:armel @@ -86,35 +86,35 @@ Inst libsame (1 unstable [amd64]) Inst libsame:armel (1 unstable [armel]) Conf libsame (1 unstable [amd64]) Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:linux-* -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... E: Unable to locate package libsame' aptget -s install libsame:windows-any -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... E: Unable to locate package foo' aptget -s install foo:armel -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst foo (1 unstable [all]) Conf foo (1 unstable [all])' aptget -s install foo -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst foo (1 unstable [all]) Conf foo (1 unstable [all])' aptget -s install foo:all -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst foo (1 unstable [all]) Conf foo (1 unstable [all])' aptget -s install foo:amd64 -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 92e7c0e84..5b966754c 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -63,7 +63,7 @@ testrun() { msgtest '\tdeb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb rm testpkg_1.0_i386.deb cd - >/dev/null - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: testpkg @@ -71,14 +71,14 @@ The following NEW packages will be installed: Inst testpkg (1.0 unstable [i386]) Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin - testequal "$GOODSHOW" aptcache show testpkg - testequal "$GOODSHOW" aptcache show testpkg + testsuccessequal "$GOODSHOW" aptcache show testpkg + testsuccessequal "$GOODSHOW" aptcache show testpkg rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin - testequal "$GOODPOLICY" aptcache policy testpkg - testequal "$GOODPOLICY" aptcache policy testpkg + testsuccessequal "$GOODPOLICY" aptcache policy testpkg + testsuccessequal "$GOODPOLICY" aptcache policy testpkg rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin - testequal "$GOODSHOWSRC" aptcache showsrc testpkg - testequal "$GOODSHOWSRC" aptcache showsrc testpkg + testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg + testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg aptget clean msgtest 'Check if the source is aptgetable' cd downloaded @@ -87,7 +87,7 @@ Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s testsuccess test -d testpkg-1.0 rm -rf testpkg-1.0* cd - >/dev/null - testequal "$(aptcache show testpkg -o Acquire::Languages=none) + testsuccessequal "$(aptcache show testpkg -o Acquire::Languages=none) " aptcache dumpavail } @@ -134,14 +134,14 @@ testsuccess aptget update GOODSHOW="$(aptcache show testpkg) " test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken' -testequal "$GOODSHOW" aptcache show testpkg +testsuccessequal "$GOODSHOW" aptcache show testpkg GOODSHOWSRC="$(aptcache showsrc testpkg) " test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken' -testequal "$GOODSHOWSRC" aptcache showsrc testpkg +testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg GOODPOLICY="$(aptcache policy testpkg)" test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken' -testequal "$GOODPOLICY" aptcache policy testpkg +testsuccessequal "$GOODPOLICY" aptcache policy testpkg for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'file' $COMPRESSOR; done @@ -150,7 +150,7 @@ rm -rf rootdir/var/lib/apt/lists testsuccess aptget update GOODPOLICY="$(aptcache policy testpkg)" test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 'policy is broken' -testequal "$GOODPOLICY" aptcache policy testpkg +testsuccessequal "$GOODPOLICY" aptcache policy testpkg for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'http' $COMPRESSOR; done @@ -159,6 +159,6 @@ rm -rf rootdir/var/lib/apt/lists testsuccess aptcdrom add &1 | grep -E -q '(Writing more data than expected|Hash Sum mismatch)' > /dev/null && msgpass || msgfail # ensure there is no package -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... E: Unable to locate package bad-mitm' aptget install bad-mitm -s # and verify that its not picked up -testequal 'N: Unable to locate package bad-mitm' aptcache policy bad-mitm -q=0 +testsuccessequal 'N: Unable to locate package bad-mitm' aptcache policy bad-mitm -q=0 # and that the right one is used -testequal "good-pkg: +testsuccessequal "good-pkg: Installed: (none) Candidate: 1.0 Version table: diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak index 1493430d8..50c682d43 100755 --- a/test/integration/test-essential-force-loopbreak +++ b/test/integration/test-essential-force-loopbreak @@ -25,7 +25,7 @@ cp -a rootdir/var/lib/dpkg/status dpkg.status.backup testforcebreak() { cp -a dpkg.status.backup rootdir/var/lib/dpkg/status rm -f rootdir/var/lib/apt/extended_states - testequal "Reading package lists... + testfailureequal "Reading package lists... Building dependency tree... The following extra packages will be installed: sysvinit diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol index fd68578c5..3b9b38c39 100755 --- a/test/integration/test-external-dependency-solver-protocol +++ b/test/integration/test-external-dependency-solver-protocol @@ -25,7 +25,7 @@ insertpackage 'experimental' 'coolstuff' 'i386,amd64' '3' 'Depends: cool, stuff' setupaptarchive rm -f /tmp/dump.edsp -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Execute external solver... The solver encountered an error of type: ERR_JUST_DUMPING @@ -38,7 +38,7 @@ testsuccess test -s /tmp/dump.edsp rm -f /tmp/dump.edsp #FIXME: this should be unstable, but we don't support pinning yet -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Execute external solver... The following NEW packages will be installed: @@ -47,7 +47,7 @@ The following NEW packages will be installed: Inst coolstuff (3 experimental [amd64]) Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Execute external solver... The following packages will be REMOVED: @@ -86,7 +86,7 @@ rm -f /tmp/dump.edsp testfailure aptget install --solver apt awesomecoolstuff:i386 -s testsuccess aptinternalsolver scenario -testequal 'Package: stuff +testsuccessequal 'Package: stuff Source: stuff Architecture: all Version: 1 diff --git a/test/integration/test-handling-broken-orgroups b/test/integration/test-handling-broken-orgroups index 20b314074..149f05fa9 100755 --- a/test/integration/test-handling-broken-orgroups +++ b/test/integration/test-handling-broken-orgroups @@ -23,7 +23,7 @@ Provides: stuff-abi-2' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: cool @@ -35,7 +35,7 @@ Inst coolstuff (1.0-1 unstable [all]) Conf cool (1.0-1 unstable [all]) Conf coolstuff (1.0-1 unstable [all])' aptget install coolstuff -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: stuff @@ -47,7 +47,7 @@ Inst coolstuff2 (1.0-1 unstable [all]) Conf stuff (1.0-1 unstable [all]) Conf coolstuff2 (1.0-1 unstable [all])' aptget install coolstuff2 -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -60,7 +60,7 @@ The following packages have unmet dependencies: stuff2 but it is not installable E: Unable to correct problems, you have held broken packages.' aptget install coolstuff-broken -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Recommended packages: cool2 stuff2 @@ -70,7 +70,7 @@ The following NEW packages will be installed: Inst coolstuff-brokenrec (1.0-1 unstable [all]) Conf coolstuff-brokenrec (1.0-1 unstable [all])' aptget install coolstuff-brokenrec -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: stuff @@ -82,7 +82,7 @@ Inst coolstuff-conflict (1.0-1 unstable [all]) Conf stuff (1.0-1 unstable [all]) Conf coolstuff-conflict (1.0-1 unstable [all])' aptget install coolstuff-conflict -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: extrastuff @@ -94,7 +94,7 @@ Inst coolstuff-provided (1.0-1 unstable [all]) Conf extrastuff (1.0-1 unstable [all]) Conf coolstuff-provided (1.0-1 unstable [all])' aptget install coolstuff-provided -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable diff --git a/test/integration/test-ignore-provides-if-versioned-breaks b/test/integration/test-ignore-provides-if-versioned-breaks index 745f7d206..20424b942 100755 --- a/test/integration/test-ignore-provides-if-versioned-breaks +++ b/test/integration/test-ignore-provides-if-versioned-breaks @@ -33,7 +33,7 @@ insertpackage 'unstable' 'foo-same-breaker-none' 'i386' '1.0' 'Breaks: foo-same' setupaptarchive -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -45,7 +45,7 @@ The following packages have unmet dependencies: foo-breaker-none : Breaks: foo E: Unable to correct problems, you have held broken packages.' aptget install foo-provider foo-breaker-none -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-breaker-2 foo-provider @@ -55,7 +55,7 @@ Inst foo-provider (1.0 unstable [i386]) Conf foo-breaker-2 (1.0 unstable [i386]) Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -71,7 +71,7 @@ Conf foo (4.0 unstable [i386]) Conf foo-breaker-3 (1.0 unstable [i386]) Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-3 -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -83,7 +83,7 @@ The following packages have unmet dependencies: foo-foreign-breaker-none : Breaks: foo-foreign E: Unable to correct problems, you have held broken packages.' aptget install foo-foreign-provider foo-foreign-breaker-none -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-foreign-breaker-2 foo-foreign-provider @@ -93,7 +93,7 @@ Inst foo-foreign-provider (1.0 unstable [i386]) Conf foo-foreign-breaker-2 (1.0 unstable [i386]) Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo-foreign:amd64 @@ -109,7 +109,7 @@ Conf foo-foreign:amd64 (4.0 unstable [amd64]) Conf foo-foreign-breaker-3 (1.0 unstable [i386]) Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-3 -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -121,7 +121,7 @@ The following packages have unmet dependencies: foo-same-breaker-none : Breaks: foo-same E: Unable to correct problems, you have held broken packages.' aptget install foo-same-provider foo-same-breaker-none -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-same-breaker-2 foo-same-provider @@ -131,7 +131,7 @@ Inst foo-same-provider (1.0 unstable [i386]) Conf foo-same-breaker-2 (1.0 unstable [i386]) Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo-same:amd64 foo-same diff --git a/test/integration/test-ignore-provides-if-versioned-conflicts b/test/integration/test-ignore-provides-if-versioned-conflicts index a07252768..a781d8e44 100755 --- a/test/integration/test-ignore-provides-if-versioned-conflicts +++ b/test/integration/test-ignore-provides-if-versioned-conflicts @@ -33,7 +33,7 @@ insertpackage 'unstable' 'foo-same-breaker-none' 'i386' '1.0' 'Conflicts: foo-sa setupaptarchive -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -45,7 +45,7 @@ The following packages have unmet dependencies: foo-breaker-none : Conflicts: foo E: Unable to correct problems, you have held broken packages.' aptget install foo-provider foo-breaker-none -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-breaker-2 foo-provider @@ -55,7 +55,7 @@ Inst foo-provider (1.0 unstable [i386]) Conf foo-breaker-2 (1.0 unstable [i386]) Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -71,7 +71,7 @@ Conf foo (4.0 unstable [i386]) Conf foo-breaker-3 (1.0 unstable [i386]) Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-3 -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -83,7 +83,7 @@ The following packages have unmet dependencies: foo-foreign-breaker-none : Conflicts: foo-foreign E: Unable to correct problems, you have held broken packages.' aptget install foo-foreign-provider foo-foreign-breaker-none -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-foreign-breaker-2 foo-foreign-provider @@ -93,7 +93,7 @@ Inst foo-foreign-provider (1.0 unstable [i386]) Conf foo-foreign-breaker-2 (1.0 unstable [i386]) Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo-foreign:amd64 @@ -109,7 +109,7 @@ Conf foo-foreign:amd64 (4.0 unstable [amd64]) Conf foo-foreign-breaker-3 (1.0 unstable [i386]) Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-3 -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -121,7 +121,7 @@ The following packages have unmet dependencies: foo-same-breaker-none : Conflicts: foo-same E: Unable to correct problems, you have held broken packages.' aptget install foo-same-provider foo-same-breaker-none -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-same-breaker-2 foo-same-provider @@ -131,7 +131,7 @@ Inst foo-same-provider (1.0 unstable [i386]) Conf foo-same-breaker-2 (1.0 unstable [i386]) Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo-same:amd64 foo-same diff --git a/test/integration/test-implicit-conflicts-real-not-virtual b/test/integration/test-implicit-conflicts-real-not-virtual index c9fca4edf..7c1365bdd 100755 --- a/test/integration/test-implicit-conflicts-real-not-virtual +++ b/test/integration/test-implicit-conflicts-real-not-virtual @@ -17,7 +17,7 @@ insertinstalledpackage 'wireless-crda' 'amd64' '1.14' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: crda @@ -25,7 +25,7 @@ The following NEW packages will be installed: Inst crda (1.1.1-1ubuntu4m unstable-m [amd64]) Conf crda (1.1.1-1ubuntu4m unstable-m [amd64])' aptget install crda -s -t unstable-m -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: crda @@ -33,7 +33,7 @@ The following NEW packages will be installed: Inst crda (1.1.1-1ubuntu4p unstable-p [amd64]) Conf crda (1.1.1-1ubuntu4p unstable-p [amd64])' aptget install crda -s -t unstable-p -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: crda @@ -47,7 +47,7 @@ Conflicts: wireless-crda (<< 1.15) Replaces: wireless-crda ( << 1.15) Multi-arch: foreign' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: wireless-crda diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index 1524ed4c7..c2fc37ee7 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -55,7 +55,7 @@ testprotected() { grep -q "^\\^linux-image-$(uname -r | sed -e 's#\.#\\\\.#g')\\\$\$" protected.list && msgpass || catfail } -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: @@ -73,7 +73,7 @@ testprotected msgtest 'Check kernel autoremoval protection list does not include' 'old kernel' grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && catfail || msgpass -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: @@ -85,7 +85,7 @@ Remv linux-image-1.0.0-2-generic [1.0.0-2]' aptget autoremove -s testprotected 1.0.0-2-generic msgtest 'Check kernel autoremoval protection list includes' 'installed kernel' grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && msgpass || catfail -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: diff --git a/test/integration/test-multiarch-foreign b/test/integration/test-multiarch-foreign index 332466d96..490abb873 100755 --- a/test/integration/test-multiarch-foreign +++ b/test/integration/test-multiarch-foreign @@ -15,7 +15,7 @@ Multi-Arch: foreign' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -27,7 +27,7 @@ Inst cool-foo:i386 (1.0 unstable [i386]) Conf foo (1.0 unstable [amd64]) Conf cool-foo:i386 (1.0 unstable [i386])' aptget install cool-foo:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -39,7 +39,7 @@ Inst cool-foo (1.0 unstable [amd64]) Conf foo (1.0 unstable [amd64]) Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: cool-foo foo @@ -49,7 +49,7 @@ Inst cool-foo (1.0 unstable [amd64]) Conf foo (1.0 unstable [amd64]) Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:amd64 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: cool-foo foo:i386 @@ -59,7 +59,7 @@ Inst cool-foo (1.0 unstable [amd64]) Conf foo:i386 (1.0 unstable [i386]) Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: cool-foo foo:armel @@ -73,7 +73,7 @@ Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:armel -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: bar @@ -85,7 +85,7 @@ Inst cool-bar:i386 (1.0 unstable [i386]) Conf bar (1.0 unstable [amd64]) Conf cool-bar:i386 (1.0 unstable [i386])' aptget install cool-bar:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: bar @@ -97,7 +97,7 @@ Inst cool-bar (1.0 unstable [amd64]) Conf bar (1.0 unstable [amd64]) Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: bar cool-bar @@ -107,7 +107,7 @@ Inst cool-bar (1.0 unstable [amd64]) Conf bar (1.0 unstable [amd64]) Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:amd64 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: bar:i386 cool-bar @@ -117,7 +117,7 @@ Inst cool-bar (1.0 unstable [amd64]) Conf bar:i386 (1.0 unstable [i386]) Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: bar:armel cool-bar @@ -127,7 +127,7 @@ Inst cool-bar (1.0 unstable [amd64]) Conf bar:armel (1.0 unstable [armel]) Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:armel -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Note, selecting 'bar' instead of 'bar-provider' The following NEW packages will be installed: @@ -138,7 +138,7 @@ Inst cool-bar (1.0 unstable [amd64]) Conf bar (1.0 unstable [amd64]) Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider -s -q=0 -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Note, selecting 'bar:i386' instead of 'bar-provider:i386' The following NEW packages will be installed: diff --git a/test/integration/test-ordering-ignore-not-matching-breaks b/test/integration/test-ordering-ignore-not-matching-breaks index c9fca4edf..7c1365bdd 100755 --- a/test/integration/test-ordering-ignore-not-matching-breaks +++ b/test/integration/test-ordering-ignore-not-matching-breaks @@ -17,7 +17,7 @@ insertinstalledpackage 'wireless-crda' 'amd64' '1.14' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: crda @@ -25,7 +25,7 @@ The following NEW packages will be installed: Inst crda (1.1.1-1ubuntu4m unstable-m [amd64]) Conf crda (1.1.1-1ubuntu4m unstable-m [amd64])' aptget install crda -s -t unstable-m -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: crda @@ -33,7 +33,7 @@ The following NEW packages will be installed: Inst crda (1.1.1-1ubuntu4p unstable-p [amd64]) Conf crda (1.1.1-1ubuntu4p unstable-p [amd64])' aptget install crda -s -t unstable-p -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: crda @@ -47,7 +47,7 @@ Conflicts: wireless-crda (<< 1.15) Replaces: wireless-crda ( << 1.15) Multi-arch: foreign' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: wireless-crda diff --git a/test/integration/test-package-reinstallation b/test/integration/test-package-reinstallation index b4f2061ec..f0412f98d 100755 --- a/test/integration/test-package-reinstallation +++ b/test/integration/test-package-reinstallation @@ -14,7 +14,7 @@ insertinstalledpackage 'apt' 'i386' '0.8.15' 'Depends: libc6' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... 0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. Inst libc-bin [2.13-8] (2.13-8 unstable [i386]) diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index d773dcd66..4de07f1ad 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -60,7 +60,7 @@ testrun() { testsuccess aptget update "$@" cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak testnopackage newstuff - testequal "$(cat ${PKGFILE}) + testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt oldstuff msgmsg "Testcase: apply with one patch: $*" @@ -90,13 +90,13 @@ SHA256-Patches: find aptarchive -name 'Packages*' -type f -delete wasmergeused "$@" testnopackage oldstuff - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff msgmsg "Testcase: index is already up-to-date: $*" find rootdir/var/lib/apt/lists -name '*diff_Index' -type f -delete testsuccess aptget update "$@" - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff msgmsg "Testcase: apply with two patches: $*" @@ -146,7 +146,7 @@ SHA256-Patches: cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists wasmergeused "$@" testnopackage oldstuff - testequal "$(cat Packages-future) + testsuccessequal "$(cat Packages-future) " aptcache show apt newstuff futurestuff msgmsg "Testcase: patch applying fails, but successful fallback: $*" @@ -178,7 +178,7 @@ SHA256-Patches: signreleasefiles testsuccess aptget update "$@" testnopackage oldstuff - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff msgmsg "Testcase: pdiff patch bigger than index itself: $*" @@ -212,7 +212,7 @@ SHA256-Patches: cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptgetupdate.output testsuccess grep 'bytes (Limit is' rootdir/tmp/aptgetupdate.output testnopackage oldstuff - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff } echo 'Debug::pkgAcquire::Diffs "true"; diff --git a/test/integration/test-pin-non-existent-package b/test/integration/test-pin-non-existent-package index c567e5285..5c839283f 100755 --- a/test/integration/test-pin-non-existent-package +++ b/test/integration/test-pin-non-existent-package @@ -23,8 +23,8 @@ testcandidate() { } testcandidate rapt '0.8.15' -testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 -testequal 'Reading package lists... +testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only @@ -34,8 +34,8 @@ Pin: release a=unstable Pin-Priority: -1' > rootdir/etc/apt/preferences testcandidate rapt '(none)' -testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 -testequal 'Reading package lists... +testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only @@ -53,9 +53,9 @@ Pin: release a=unstable Pin-Priority: 1000' >> rootdir/etc/apt/preferences testcandidate rapt '(none)' -testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 +testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning index c08a2f103..15bf300ac 100755 --- a/test/integration/test-policy-pinning +++ b/test/integration/test-policy-pinning @@ -17,7 +17,7 @@ testequalpolicy() { local SP="$1" local AP="$2" shift 2 - testequal "Package files: + testsuccessequal "Package files: $(echo "$SP" | awk '{ printf("%3s\n",$0) }') ${STATUS} release a=now $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ Packages @@ -126,7 +126,7 @@ testequalpolicycoolstuff() { shift fi shift 6 - testequal "coolstuff: + testsuccessequal "coolstuff: Installed: $INSTALLED Candidate: $CANDIDATE ${PINVERSION}Version table:${BPO2ARCHIVE} diff --git a/test/integration/test-prefer-higher-priority-providers b/test/integration/test-prefer-higher-priority-providers index 64b901dd0..85a302fb1 100755 --- a/test/integration/test-prefer-higher-priority-providers +++ b/test/integration/test-prefer-higher-priority-providers @@ -13,7 +13,7 @@ insertpackage 'unstable' 'awesome' 'all' '1' 'Depends: stuff' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -25,7 +25,7 @@ Inst awesome (1 unstable [all]) Conf foo (1 unstable [all]) Conf awesome (1 unstable [all])' aptget install awesome -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: awesome foo @@ -35,7 +35,7 @@ Inst awesome (1 unstable [all]) Conf foo (1 unstable [all]) Conf awesome (1 unstable [all])' aptget install awesome foo -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'bar' is not installed, so not removed Package 'baz' is not installed, so not removed @@ -49,7 +49,7 @@ Inst awesome (1 unstable [all]) Conf foo (1 unstable [all]) Conf awesome (1 unstable [all])" aptget install awesome bar- baz- -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'foo' is not installed, so not removed The following extra packages will be installed: @@ -62,7 +62,7 @@ Inst awesome (1 unstable [all]) Conf bar (1 unstable [all]) Conf awesome (1 unstable [all])" aptget install awesome foo- -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'foo' is not installed, so not removed Package 'baz' is not installed, so not removed @@ -76,7 +76,7 @@ Inst awesome (1 unstable [all]) Conf bar (1 unstable [all]) Conf awesome (1 unstable [all])" aptget install awesome foo- baz- -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'foo' is not installed, so not removed Package 'bar' is not installed, so not removed @@ -90,7 +90,7 @@ Inst awesome (1 unstable [all]) Conf baz (1 unstable [all]) Conf awesome (1 unstable [all])" aptget install awesome foo- bar- -s -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Package 'foo' is not installed, so not removed Package 'bar' is not installed, so not removed diff --git a/test/integration/test-prefer-native-architecture-over-higher-priority b/test/integration/test-prefer-native-architecture-over-higher-priority index 2e5696376..7e4f8f34b 100755 --- a/test/integration/test-prefer-native-architecture-over-higher-priority +++ b/test/integration/test-prefer-native-architecture-over-higher-priority @@ -12,7 +12,7 @@ insertpackage 'unstable' 'autoconf' 'all' '1' 'Depends: m4' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: m4 diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index db97687ce..5f67c0191 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -38,7 +38,7 @@ insertpackage 'unstable' 'libsame3' 'i386,amd64' '3' 'Multi-Arch: same' insertpackage 'unstable' 'depender3' 'all' '3' 'Depends: libsame3 (= 3)' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: @@ -69,7 +69,7 @@ insertinstalledpackage 'libsame2' 'i386' '1' 'Multi-Arch: same' insertinstalledpackage 'libsame3' 'i386' '1' 'Multi-Arch: same' # the error message isn't great, but better than nothing, right? -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -81,7 +81,7 @@ The following packages have unmet dependencies: depender2 : Depends: libsame2 (= 2) but it is not going to be installed E: Unable to correct problems, you have held broken packages.' aptget install depender2 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libsame3:i386 libsame3 diff --git a/test/integration/test-provides-gone-with-upgrade b/test/integration/test-provides-gone-with-upgrade index 3b4bc2d04..61d34fa57 100755 --- a/test/integration/test-provides-gone-with-upgrade +++ b/test/integration/test-provides-gone-with-upgrade @@ -13,7 +13,7 @@ Replaces: apt (<< 0.8.15)' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following NEW packages will be installed: diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching index 0970cb935..a1a6a6142 100755 --- a/test/integration/test-release-candidate-switching +++ b/test/integration/test-release-candidate-switching @@ -54,7 +54,7 @@ insertpackage 'experimental' 'uninstallablepkg' 'all' '1.0' 'Depends: libmtp8 (> setupaptarchive -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... The following extra packages will be installed: amarok-common (2.3.1-1+sid) @@ -73,7 +73,7 @@ The following NEW packages will be installed: After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok --trivial-only -V -q=0 -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... The following extra packages will be installed: amarok-common (2.3.2-2+exp) @@ -92,7 +92,7 @@ The following NEW packages will be installed: After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok -t experimental --trivial-only -V -q=0 -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok' @@ -114,7 +114,7 @@ The following NEW packages will be installed: After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok/experimental --trivial-only -V -q=0 -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null' @@ -137,7 +137,7 @@ After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-null/experimental --trivial-only -V -q=0 # do not select the same version multiple times -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok' @@ -165,7 +165,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a # in theory, the second line is wrong, but printing the right version is too much of a hassle # (we have to check if later in the Changed list is another change and if so use this version # instead of the current candidate) - and it wouldn't be (really) useful anyway… -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental2 [i386]) for 'amarok-less' Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-less' @@ -192,7 +192,7 @@ After this operation, 301 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-less/experimental2 amarok-higher/experimental --trivial-only -V -q=0 # phonon-backend-null can't be used directly, but as it provides it is still fine… -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null2' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null2' @@ -215,7 +215,7 @@ After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-null2/experimental --trivial-only -V -q=0 # if an or-group satisfier is already found, do not set others -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine' @@ -239,7 +239,7 @@ After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-xine/experimental --trivial-only -V -q=0 # … but proceed testing if the first doesn't work out -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine2' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine2' @@ -263,7 +263,7 @@ After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-xine2/experimental --trivial-only -V -q=0 # sometimes, the second level need to be corrected, too -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine3' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine3' @@ -290,7 +290,7 @@ After this operation, 301 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-xine3/experimental --trivial-only -V -q=0 # … but proceed testing if the first doesn't work out even in second deep -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine4' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine4' @@ -314,7 +314,7 @@ After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-xine4/experimental --trivial-only -V -q=0 # providers can be broken, too -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-broken' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-broken' @@ -338,7 +338,7 @@ After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-broken/experimental --trivial-only -V -q=0 # switch the candidate for recommends too if they should be installed -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends' @@ -361,7 +361,7 @@ After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-recommends/experimental --trivial-only -V -q=0 -o APT::Install-Recommends=1 # … or not if not -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends' @@ -382,7 +382,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a # but broken recommends are not the end of the world # FIXME: the version output for recommend packages is a bit strange… but what would be better? -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends2' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends2' @@ -404,7 +404,7 @@ After this operation, 215 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok-recommends2/experimental --trivial-only -V -q=0 -o APT::Install-Recommends=1 # if one depends doesn't work, we don't need to look deeper… -testequal "Reading package lists... +testfailureequal "Reading package lists... Building dependency tree... Selected version '1.0' (experimental [all]) for 'uninstallablepkg' Some packages could not be installed. This may mean that you have diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index 3765a4b1f..363b7fe5b 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -33,7 +33,7 @@ prepare() { } installaptold() { - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... Suggested packages: aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt @@ -46,7 +46,7 @@ Download complete and in download only mode' aptget install apt -dy } installaptnew() { - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... Suggested packages: aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt @@ -59,7 +59,7 @@ Download complete and in download only mode' aptget install apt -dy } failaptold() { - testequal 'Reading package lists... + testfailureequal 'Reading package lists... Building dependency tree... Suggested packages: aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt @@ -73,7 +73,7 @@ E: There are problems and -y was used without --force-yes' aptget install apt -d } failaptnew() { - testequal 'Reading package lists... + testfailureequal 'Reading package lists... Building dependency tree... Suggested packages: aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt @@ -119,7 +119,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Cold archive signed by' 'Joe Sixpack' updatesuccess - testequal "$(cat ${PKGFILE}) + testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt installaptold @@ -128,7 +128,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Good warm archive signed by' 'Joe Sixpack' updatesuccess - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt installaptnew @@ -139,7 +139,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Cold archive signed by' 'Rex Expired' updatefailure '^W: .* KEYEXPIRED' - testequal "$(cat ${PKGFILE}) + testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt failaptold rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg @@ -150,7 +150,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Cold archive signed by' 'Marvin Paranoid' updatefailure '^W: .* NO_PUBKEY' - testequal "$(cat ${PKGFILE}) + testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt failaptold @@ -164,7 +164,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Bad warm archive signed by' 'Joe Sixpack' updatesuccess - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt installaptnew @@ -175,7 +175,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Cold archive signed by' 'Joe Sixpack' updatesuccess - testequal "$(cat ${PKGFILE}) + testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt installaptold @@ -184,7 +184,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Good warm archive signed by' 'Marvin Paranoid' updatefailure '^W: .* NO_PUBKEY' - testequal "$(cat ${PKGFILE}) + testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt installaptold @@ -194,7 +194,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Good warm archive signed by' 'Rex Expired' updatefailure '^W: .* KEYEXPIRED' - testequal "$(cat ${PKGFILE}) + testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt installaptold rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg @@ -204,7 +204,7 @@ runtest() { find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Good warm archive signed by' 'Joe Sixpack' updatesuccess - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt installaptnew } @@ -223,7 +223,7 @@ runtest2() { find aptarchive/ -name Release.gpg -delete msgtest 'Warm archive signed by' 'nobody' updatesuccess - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt failaptnew @@ -231,7 +231,7 @@ runtest2() { rm -rf rootdir/var/lib/apt/lists msgtest 'Cold archive signed by' 'nobody' updatesuccess - testequal "$(cat ${PKGFILE}-new) + testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt failaptnew } diff --git a/test/integration/test-resolve-by-keep-new-recommends b/test/integration/test-resolve-by-keep-new-recommends index 6b1772877..a8ab9057c 100755 --- a/test/integration/test-resolve-by-keep-new-recommends +++ b/test/integration/test-resolve-by-keep-new-recommends @@ -17,5 +17,5 @@ Calculating upgrade... The following packages have been kept back: foo 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." -testequal "$UPGRADE_KEEP" aptget upgrade -s +testsuccessequal "$UPGRADE_KEEP" aptget upgrade -s diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options index 55d4e0233..5fe4933ce 100755 --- a/test/integration/test-sourceslist-trusted-options +++ b/test/integration/test-sourceslist-trusted-options @@ -15,7 +15,7 @@ setupaptarchive --no-update APTARCHIVE=$(readlink -f ./aptarchive) everythingsucceeds() { - testequal 'Listing... + testsuccessequal 'Listing... foo/testing 2 amd64 foo/stable 1 amd64 ' apt list foo -a @@ -32,7 +32,7 @@ foo/stable 1 amd64 } everythingfails() { - testequal 'Listing... + testsuccessequal 'Listing... foo/testing 2 amd64 foo/stable 1 amd64 ' apt list foo -a diff --git a/test/integration/test-specific-architecture-dependencies b/test/integration/test-specific-architecture-dependencies index 078a84654..cb6bc3cc2 100755 --- a/test/integration/test-specific-architecture-dependencies +++ b/test/integration/test-specific-architecture-dependencies @@ -30,7 +30,7 @@ insertpackage 'unstable' 'foo-no-conflictor' 'i386' '1' 'Conflicts: foo:i386' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libc6:i386 @@ -42,7 +42,7 @@ Conf libc6:i386 (1 unstable [i386]) Inst pre-depender (1 unstable [all]) Conf pre-depender (1 unstable [all])' aptget install pre-depender -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libc6:i386 @@ -54,7 +54,7 @@ Inst depender (1 unstable [all]) Conf libc6:i386 (1 unstable [i386]) Conf depender (1 unstable [all])' aptget install depender -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: libold libold:i386 @@ -66,7 +66,7 @@ Remv libold:i386 [1] Inst breaker (1 unstable [all]) Conf breaker (1 unstable [all])' aptget install breaker -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: libold:i386 @@ -77,7 +77,7 @@ Remv libold:i386 [1] Inst breaker-x32 (1 unstable [amd64]) Conf breaker-x32 (1 unstable [amd64])' aptget install breaker-x32 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: libold @@ -88,7 +88,7 @@ Remv libold [1] Inst breaker-x64:i386 (1 unstable [i386]) Conf breaker-x64:i386 (1 unstable [i386])' aptget install breaker-x64 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: oldconflictor @@ -96,7 +96,7 @@ The following NEW packages will be installed: Inst oldconflictor (1 unstable [all]) Conf oldconflictor (1 unstable [all])' aptget install oldconflictor -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: oldconflictor-x32 @@ -104,7 +104,7 @@ The following NEW packages will be installed: Inst oldconflictor-x32 (1 unstable [amd64]) Conf oldconflictor-x32 (1 unstable [amd64])' aptget install oldconflictor-x32 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: oldconflictor-x64:i386 @@ -112,7 +112,7 @@ The following NEW packages will be installed: Inst oldconflictor-x64:i386 (1 unstable [i386]) Conf oldconflictor-x64:i386 (1 unstable [i386])' aptget install oldconflictor-x64 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-depender @@ -120,7 +120,7 @@ The following NEW packages will be installed: Inst foo-depender (1 unstable [amd64]) Conf foo-depender (1 unstable [amd64])' aptget install foo-depender -s -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable @@ -132,7 +132,7 @@ The following packages have unmet dependencies: foo-depender:i386 : Depends: foo:i386 but it is not installable E: Unable to correct problems, you have held broken packages.' aptget install foo-depender:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-foreign-depender:i386 @@ -140,7 +140,7 @@ The following NEW packages will be installed: Inst foo-foreign-depender:i386 (1 unstable [i386]) Conf foo-foreign-depender:i386 (1 unstable [i386])' aptget install foo-foreign-depender:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: provider @@ -151,7 +151,7 @@ Remv provider [1] Inst foo-conflictor (1 unstable [amd64]) Conf foo-conflictor (1 unstable [amd64])' aptget install foo-conflictor -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: provider @@ -162,7 +162,7 @@ Remv provider [1] Inst foo-conflictor:i386 (1 unstable [i386]) Conf foo-conflictor:i386 (1 unstable [i386])' aptget install foo-conflictor:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: provider @@ -173,7 +173,7 @@ Remv provider [1] Inst foo-foreign-conflictor:i386 (1 unstable [i386]) Conf foo-foreign-conflictor:i386 (1 unstable [i386])' aptget install foo-foreign-conflictor:i386 -s -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: foo-no-conflictor:i386 diff --git a/test/integration/test-suggest-installed-multiarch-silbing b/test/integration/test-suggest-installed-multiarch-silbing index 89640a30c..f2b1db5eb 100755 --- a/test/integration/test-suggest-installed-multiarch-silbing +++ b/test/integration/test-suggest-installed-multiarch-silbing @@ -26,26 +26,26 @@ insertpackage 'unstable' 'mozplugger' 'i386,amd64' '1' 'Depends: iceweasel | fir setupaptarchive -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'foo' is not installed, so not removed. Did you mean 'foo:i386'? 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove foo -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following packages will be REMOVED: foo2:i386 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Remv foo2:i386 [1]" aptget remove foo2 -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... The following packages will be REMOVED: foo3 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Remv foo3 [1]" aptget remove foo3 -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'foo3:i386' is not installed, so not removed. Did you mean 'foo3'? 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove foo3:i386 -s @@ -58,22 +58,22 @@ Building dependency tree... Package 'samefoo:armel' is not installed, so not removed. Did you mean 'samefoo:i386'? 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove samefoo:armel -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'samefoo2' is not installed, so not removed. Did you mean 'samefoo2:i386'? 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove samefoo2 -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'samefoo2:armel' is not installed, so not removed. Did you mean 'samefoo2:i386'? 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove samefoo2:armel -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'iceweasel' is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove iceweasel -s -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Package 'fireweasel' is not installed, so not removed. Did you mean 'fireweasel:i386'? 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove fireweasel:amd64 -s diff --git a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum index 574183b0a..ec74a750b 100755 --- a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum +++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum @@ -145,7 +145,7 @@ cd downloaded testok() { rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz - testequal "Reading package lists... + testsuccessequal "Reading package lists... Building dependency tree... Need to get 6 B of source archives. Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] @@ -159,7 +159,7 @@ Download complete and in download only mode" aptget source -d "$@" testkeep() { echo -n 'dsc' > ${1}_1.0.dsc echo -n 'tar' > ${1}_1.0.tar.gz - testequal "Reading package lists... + testsuccessequal "Reading package lists... Building dependency tree... Skipping already downloaded file '${1}_1.0.dsc' Skipping already downloaded file '${1}_1.0.tar.gz' @@ -172,7 +172,7 @@ Download complete and in download only mode" aptget source -d "$@" testmismatch() { rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz - testequal "Reading package lists... + testfailureequal "Reading package lists... Building dependency tree... Need to get 6 B of source archives. Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] @@ -186,7 +186,7 @@ E: Failed to fetch some archives." aptget source -d "$@" testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz - testequal "Reading package lists... + testsuccessequal "Reading package lists... Building dependency tree... Skipping download of file 'pkg-sha256-bad_1.0.dsc' as requested hashsum is not available for authentication Skipping download of file 'pkg-sha256-bad_1.0.tar.gz' as requested hashsum is not available for authentication @@ -196,7 +196,7 @@ Download complete and in download only mode" aptget source -d "$@" -o Acquire::F testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz - testequal "Reading package lists... + testsuccessequal "Reading package lists... Building dependency tree... Need to get 6 B of source archives. Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] @@ -221,7 +221,7 @@ testok pkg-sha256-bad -o Acquire::ForceHash=MD5Sum # not having MD5 sum doesn't mean the file doesn't exist at all … testok pkg-no-md5 testok pkg-no-md5 -o Acquire::ForceHash=SHA256 -testequal "Reading package lists... +testsuccessequal "Reading package lists... Building dependency tree... Skipping download of file 'pkg-no-md5_1.0.dsc' as requested hashsum is not available for authentication Skipping download of file 'pkg-no-md5_1.0.tar.gz' as requested hashsum is not available for authentication @@ -233,7 +233,7 @@ testfailure --nomsg test -e pkg-no-md5_1.0.dsc -a -e pkg-no-md5_1.0.tar.gz # deal with cases in which we haven't for all files the same checksum type # mostly pathologic as this shouldn't happen, but just to be sure testok pkg-mixed-ok -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Need to get 6 B of source archives. Get:1 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (tar) [3 B] @@ -243,7 +243,7 @@ E: Failed to fetch http://localhost:8080/pkg-mixed-sha1-bad_1.0.dsc Hash Sum mi E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha1-bad msgtest 'Only tar file is downloaded as the dsc has hashsum mismatch' 'pkg-mixed-sha1-bad' testsuccess --nomsg test ! -e pkg-mixed-sha1-bad_1.0.dsc -a -e pkg-mixed-sha1-bad_1.0.tar.gz -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Need to get 6 B of source archives. Get:1 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (tar) [3 B] @@ -256,9 +256,9 @@ testsuccess --nomsg test -e pkg-mixed-sha2-bad_1.0.dsc -a ! -e pkg-mixed-sha2-ba # it gets even more pathologic: multiple entries for one file, some even disagreeing! testok pkg-md5-agree -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... E: Error parsing checksum in Files of source package pkg-md5-disagree' aptget source -d pkg-md5-disagree -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... E: Error parsing checksum in Checksums-SHA256 of source package pkg-sha256-disagree' aptget source -d pkg-sha256-disagree diff --git a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings index af6b7b504..192ed5efc 100755 --- a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings +++ b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings @@ -20,7 +20,7 @@ insertpackage 'unstable' 'steam' 'i386' '2' 'Depends: libmesa' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libmesa:i386 @@ -31,7 +31,7 @@ Inst libmesa:i386 (1 stable [i386]) Inst steam:i386 (1 stable [i386]) Conf libmesa:i386 (1 stable [i386]) Conf steam:i386 (1 stable [i386])' aptget install steam -st stable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libmesa:i386 @@ -45,7 +45,7 @@ Conf steam:i386 (2 unstable [i386])' aptget install steam -st unstable cp rootdir/var/lib/dpkg/status default-status.dpkg insertinstalledpackage 'libmesa' 'amd64' '1' 'Multi-Arch: same' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libmesa:i386 @@ -56,7 +56,7 @@ Inst libmesa:i386 (1 stable [i386]) Inst steam:i386 (1 stable [i386]) Conf libmesa:i386 (1 stable [i386]) Conf steam:i386 (1 stable [i386])' aptget install steam -st stable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libmesa libmesa:i386 @@ -76,7 +76,7 @@ cp default-status.dpkg rootdir/var/lib/dpkg/status insertinstalledpackage 'libmesa-lts' 'amd64' '1' 'Provides: libmesa Conflicts: libmesa Multi-Arch: same' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libmesa-lts:i386 @@ -87,7 +87,7 @@ Inst libmesa-lts:i386 (1 stable [i386]) Inst steam:i386 (1 stable [i386]) Conf libmesa-lts:i386 (1 stable [i386]) Conf steam:i386 (1 stable [i386])' aptget install steam -st stable -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: libmesa-lts libmesa-lts:i386 diff --git a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard index 45f70a898..b4f705d8b 100755 --- a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard +++ b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard @@ -25,7 +25,7 @@ insertinstalledpackage 'not-downloadable' 'all' '1.0' '' 'standard' setupaptarchive # discourage keeping obsolete high-priority packages … -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be REMOVED: @@ -42,7 +42,7 @@ for i in $(seq 1 10); do insertinstalledpackage "depender$i" 'all' '1.0' 'Depends: not-downloadable' done -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages have been kept back: diff --git a/test/integration/test-ubuntu-bug-614993 b/test/integration/test-ubuntu-bug-614993 index 49955f231..7067713e8 100755 --- a/test/integration/test-ubuntu-bug-614993 +++ b/test/integration/test-ubuntu-bug-614993 @@ -55,5 +55,5 @@ The following packages will be upgraded: Need to get 0 B/5505 kB of archives. After this operation, 2294 kB disk space will be freed. E: Trivial Only specified but this is not a trivial operation." -testequal "$UPGRADE" aptget install xserver-xorg --trivial-only +testfailureequal "$UPGRADE" aptget install xserver-xorg --trivial-only diff --git a/test/integration/test-ubuntu-bug-761175-remove-purge b/test/integration/test-ubuntu-bug-761175-remove-purge index 0b5a91246..c2e2aadf1 100755 --- a/test/integration/test-ubuntu-bug-761175-remove-purge +++ b/test/integration/test-ubuntu-bug-761175-remove-purge @@ -31,7 +31,7 @@ runtests() { testdpkgnotinstalled compiz-core-$1 testdpkgstatus 'rc' '1' "compiz-core-$1" - testequal "Reading package lists... + testsuccessequal "Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: @@ -39,7 +39,7 @@ The following packages will be REMOVED: 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Purg compiz-core-$1" aptget purge compiz-core-$1 -s testsuccess aptget purge compiz-core-$1 -y - testequal "dpkg-query: no packages found matching compiz-core-$1" dpkg -l compiz-core-$1 + testfailureequal "dpkg-query: no packages found matching compiz-core-$1" dpkg -l compiz-core-$1 } msgmsg 'Test in multi arch environment' diff --git a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only index 09315868b..754487a90 100755 --- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only +++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only @@ -31,7 +31,7 @@ msgtest 'The unsigned garbage before signed block is' 'ignored' aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail ROOTDIR="$(readlink -f .)" -testequal "Package files: +testsuccessequal "Package files: 100 ${ROOTDIR}/rootdir/var/lib/dpkg/status release a=now Pinned packages:" aptcache policy diff --git a/test/integration/test-ubuntu-bug-802901-multiarch-early-remove b/test/integration/test-ubuntu-bug-802901-multiarch-early-remove index bdb4e5e4f..f56ff020c 100755 --- a/test/integration/test-ubuntu-bug-802901-multiarch-early-remove +++ b/test/integration/test-ubuntu-bug-802901-multiarch-early-remove @@ -15,7 +15,7 @@ Conflicts: libgl1' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: libgl1-mesa-glx:i386 diff --git a/test/integration/test-ubuntu-bug-806274-install-suggests b/test/integration/test-ubuntu-bug-806274-install-suggests index fb72f0999..3f02316f4 100755 --- a/test/integration/test-ubuntu-bug-806274-install-suggests +++ b/test/integration/test-ubuntu-bug-806274-install-suggests @@ -15,7 +15,7 @@ insertpackage 'unstable' 'baz' 'i386' '1.0' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: bar foo @@ -32,7 +32,7 @@ Inst bar (1.0 unstable [i386]) Conf bar (1.0 unstable [i386])' aptget install apt -s --install-recommends --no-install-suggests -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: bar baz foo @@ -48,7 +48,7 @@ Inst baz (1.0 unstable [i386]) Conf bar (1.0 unstable [i386]) Conf baz (1.0 unstable [i386])' aptget install apt -s --install-recommends --install-suggests -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: foo @@ -64,7 +64,7 @@ Conf foo (1.0 unstable [i386]) Inst apt (0.8.15 unstable [i386]) Conf apt (0.8.15 unstable [i386])' aptget install apt -s --no-install-recommends --no-install-suggests -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: baz foo diff --git a/test/integration/test-ubuntu-bug-859188-multiarch-reinstall b/test/integration/test-ubuntu-bug-859188-multiarch-reinstall index be86f2e91..9bb99305e 100755 --- a/test/integration/test-ubuntu-bug-859188-multiarch-reinstall +++ b/test/integration/test-ubuntu-bug-859188-multiarch-reinstall @@ -21,7 +21,7 @@ Inst libsame:i386 [1.0] (1.0 unstable [i386]) Conf libsame (1.0 unstable [amd64]) Conf libsame:i386 (1.0 unstable [i386])' -testequal "$REINSTALL" aptget install --reinstall libsame -s -testequal "$REINSTALL" aptget install --reinstall libsame:amd64 -s -testequal "$REINSTALL" aptget install --reinstall libsame:i386 -s -testequal "$REINSTALL" aptget install --reinstall libsame:amd64 libsame:i386 -s +testsuccessequal "$REINSTALL" aptget install --reinstall libsame -s +testsuccessequal "$REINSTALL" aptget install --reinstall libsame:amd64 -s +testsuccessequal "$REINSTALL" aptget install --reinstall libsame:i386 -s +testsuccessequal "$REINSTALL" aptget install --reinstall libsame:amd64 libsame:i386 -s diff --git a/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering index d2b6b9bad..e9cbf958e 100755 --- a/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering +++ b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering @@ -12,7 +12,7 @@ insertpackage 'unstable' 'custom' 'amd64' '2.0' 'Pre-Depends: grub-pc | grub' setupaptarchive -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be upgraded: diff --git a/test/integration/test-unpack-different-version-unpacked b/test/integration/test-unpack-different-version-unpacked index 952f6e6b2..ae121cf4e 100755 --- a/test/integration/test-unpack-different-version-unpacked +++ b/test/integration/test-unpack-different-version-unpacked @@ -19,7 +19,7 @@ cleanstatus() { #FIXME: the reported version is wrong, it should be 1, not 2 insertinstalledpackage 'libqtcore4' 'i386,amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. 2 not fully installed or removed. @@ -29,7 +29,7 @@ Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f cleanstatus insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same' '' 'install ok unpacked' insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' '' 'install ok unpacked' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done The following extra packages will be installed: @@ -45,7 +45,7 @@ Conf libqtcore4 (2 unstable [amd64])' aptget install -s -f cleanstatus insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same' '' 'install ok unpacked' insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done The following extra packages will be installed: @@ -61,7 +61,7 @@ Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f cleanstatus insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same' '' 'install ok unpacked' insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done The following extra packages will be installed: @@ -77,7 +77,7 @@ Conf libqtcore4 (2 unstable [amd64])' aptget install -s -f cleanstatus insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same' '' 'install ok unpacked' insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done The following extra packages will be installed: @@ -93,7 +93,7 @@ Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f cleanstatus insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same' insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' '' 'install ok unpacked' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done The following extra packages will be installed: @@ -108,7 +108,7 @@ Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f cleanstatus insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same' insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked' -testequal 'Reading package lists... +testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done The following extra packages will be installed: diff --git a/test/integration/test-xorg-break-providers b/test/integration/test-xorg-break-providers index 0be57d979..ff1f3b077 100755 --- a/test/integration/test-xorg-break-providers +++ b/test/integration/test-xorg-break-providers @@ -13,7 +13,7 @@ setupaptarchive # The test ensures that only -intel will be upgraded # (together with -core of course) and -vesa not touched. -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: xserver-xorg-video-intel @@ -24,7 +24,7 @@ Need to get 0 B/2992 kB of archives. After this operation, 24.6 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation.' aptget install xserver-xorg-core --trivial-only -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be upgraded: @@ -34,7 +34,7 @@ Need to get 0 B/2992 kB of archives. After this operation, 24.6 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation.' aptget upgrade --trivial-only -testequal 'Reading package lists... +testfailureequal 'Reading package lists... Building dependency tree... Calculating upgrade... The following packages will be upgraded: -- cgit v1.2.3 From 249aec3b7397662a678ea0014f94392085477b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= Date: Tue, 10 Mar 2015 10:09:44 +0100 Subject: stop displaying time of build in online help MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As part of the “reproducible builds” effort [1], we have noticed that apt could not be built reproducibly. One issue is that it uses the __DATE__ and __TIME__ macros of the C preprocessor to display the time of build in the online help. We believe this information not to be really useful to users as they can always look at the package data and metadata to figure it out. The attached patch simply removes this information. All non-documentation packages can then be built reproducibly with our current experimental framework. [David: changed the string slightly to be untranslateable as well] Closes: 774342 --- test/integration/test-00-commands-have-help | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help index bbd1475eb..f2317dbdf 100755 --- a/test/integration/test-00-commands-have-help +++ b/test/integration/test-00-commands-have-help @@ -13,7 +13,7 @@ configarchitecture 'amd64' export LD_BIND_NOW=1 checkversionmessage() { - testsuccess grep '^apt .* compiled on ' ${1}-help.output + testsuccess grep '^apt .* (' ${1}-help.output } checkhelpmessage() { -- cgit v1.2.3 From d01fa806061db7f5d227a0784405987c78998c84 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 20 Mar 2015 17:38:51 +0100 Subject: test/integration/test-apt-download-progress: fix test failure on fast hardware --- test/integration/test-apt-download-progress | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-download-progress b/test/integration/test-apt-download-progress index 0a9020bec..7092e163e 100755 --- a/test/integration/test-apt-download-progress +++ b/test/integration/test-apt-download-progress @@ -30,13 +30,13 @@ testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=800k count=1 msgtest 'download progress works via' 'http' printf '\n' exec 3> apt-progress.log -testsuccess apthelper download-file "http://localhost:8080/$TESTFILE" http-$TESTFILE -o APT::Status-Fd=3 -o Acquire::http::Dl-Limit=800 +testsuccess apthelper download-file "http://localhost:8080/$TESTFILE" http-$TESTFILE -o APT::Status-Fd=3 -o Acquire::http::Dl-Limit=600 assertprogress apt-progress.log msgtest 'download progress works via' 'https' printf '\n' exec 3> apt-progress.log -testsuccess apthelper download-file "https://localhost:4433/$TESTFILE" https-$TESTFILE -o APT::Status-Fd=3 -o Acquire::https::Dl-Limit=800 +testsuccess apthelper download-file "https://localhost:4433/$TESTFILE" https-$TESTFILE -o APT::Status-Fd=3 -o Acquire::https::Dl-Limit=600 assertprogress apt-progress.log # cleanup -- cgit v1.2.3 From d5cf8851753dde4f45bfd3b48fcdf34247a8752a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 7 Apr 2015 22:34:34 +0200 Subject: keyids in "apt-key del" should be case-insensitive gnupg is case-insensitive about keyids, so back then apt-key called it directly any keyid was accepted, but now that we work more with the keyid ourself we regressed to require uppercase keyids by accident. This is also inconsistent with other apt-key commands which still use gnupg directly. A single case-insensitive grep and we are fine again. Closes: 781696 --- test/integration/test-apt-key | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index 47230cb55..b4f823ef1 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -111,3 +111,9 @@ cleanplate cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE testempty aptkey list + +msgtest 'Test key removal with' 'lowercase key ID' #keylength somewher between 8byte and short +cleanplate +cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg +testsuccess --nomsg aptkey --fakeroot del d141dbac8dae +testempty aptkey list -- cgit v1.2.3 From b8eba208daebe3e3f235983e44da9c398d6f7a57 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Mar 2015 14:11:54 +0100 Subject: reimplement the last uses of sprintf Working with strings c-style is complicated and error-prune, so by converting to c++ style we gain some simplicity and avoid buffer overflows by later extensions. Git-Dch: Ignore --- test/libapt/strutil_test.cc | 22 ++++++++++++++++++++++ test/libapt/uri_test.cc | 12 ++++++++++++ 2 files changed, 34 insertions(+) (limited to 'test') diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index 9bc3c76fd..23dc08727 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -97,6 +97,28 @@ TEST(StrUtilTest,StartsWith) EXPECT_FALSE(Startswith("abcd", "x")); EXPECT_FALSE(Startswith("abcd", "abcndefg")); } +TEST(StrUtilTest,TimeToStr) +{ + EXPECT_EQ("0s", TimeToStr(0)); + EXPECT_EQ("42s", TimeToStr(42)); + EXPECT_EQ("9min 21s", TimeToStr((9*60) + 21)); + EXPECT_EQ("20min 42s", TimeToStr((20*60) + 42)); + EXPECT_EQ("10h 42min 21s", TimeToStr((10*3600) + (42*60) + 21)); + EXPECT_EQ("10h 42min 21s", TimeToStr((10*3600) + (42*60) + 21)); + EXPECT_EQ("1988d 3h 29min 7s", TimeToStr((1988*86400) + (3*3600) + (29*60) + 7)); + + EXPECT_EQ("59s", TimeToStr(59)); + EXPECT_EQ("60s", TimeToStr(60)); + EXPECT_EQ("1min 1s", TimeToStr(61)); + EXPECT_EQ("59min 59s", TimeToStr(3599)); + EXPECT_EQ("60min 0s", TimeToStr(3600)); + EXPECT_EQ("1h 0min 1s", TimeToStr(3601)); + EXPECT_EQ("1h 1min 0s", TimeToStr(3660)); + EXPECT_EQ("23h 59min 59s", TimeToStr(86399)); + EXPECT_EQ("24h 0min 0s", TimeToStr(86400)); + EXPECT_EQ("1d 0h 0min 1s", TimeToStr(86401)); + EXPECT_EQ("1d 0h 1min 0s", TimeToStr(86460)); +} TEST(StrUtilTest,SubstVar) { EXPECT_EQ("", SubstVar("", "fails", "passes")); diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc index 1662f51f0..5d5ae9679 100644 --- a/test/libapt/uri_test.cc +++ b/test/libapt/uri_test.cc @@ -12,6 +12,7 @@ TEST(URITest, BasicHTTP) EXPECT_EQ(90, U.Port); EXPECT_EQ("www.debian.org", U.Host); EXPECT_EQ("/temp/test", U.Path); + EXPECT_EQ("http://www.debian.org:90/temp/test", (std::string)U); // Login data U = URI("http://jgg:foo@ualberta.ca/blah"); EXPECT_EQ("http", U.Access); @@ -20,6 +21,7 @@ TEST(URITest, BasicHTTP) EXPECT_EQ(0, U.Port); EXPECT_EQ("ualberta.ca", U.Host); EXPECT_EQ("/blah", U.Path); + EXPECT_EQ("http://jgg:foo@ualberta.ca/blah", (std::string)U); } TEST(URITest, SingeSlashFile) { @@ -30,6 +32,7 @@ TEST(URITest, SingeSlashFile) EXPECT_EQ(0, U.Port); EXPECT_EQ("", U.Host); EXPECT_EQ("/usr/bin/foo", U.Path); + EXPECT_EQ("file:/usr/bin/foo", (std::string)U); } TEST(URITest, BasicCDROM) { @@ -40,6 +43,7 @@ TEST(URITest, BasicCDROM) EXPECT_EQ(0, U.Port); EXPECT_EQ("Moo Cow Rom", U.Host); EXPECT_EQ("/debian", U.Path); + EXPECT_EQ("cdrom://Moo Cow Rom/debian", (std::string)U); } TEST(URITest, RelativeGzip) { @@ -50,6 +54,7 @@ TEST(URITest, RelativeGzip) EXPECT_EQ(0, U.Port); EXPECT_EQ(".", U.Host); EXPECT_EQ("/bar/cow", U.Path); + EXPECT_EQ("gzip://./bar/cow", (std::string)U); } TEST(URITest, NoSlashFTP) { @@ -60,6 +65,7 @@ TEST(URITest, NoSlashFTP) EXPECT_EQ(0, U.Port); EXPECT_EQ("ftp.fr.debian.org", U.Host); EXPECT_EQ("/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", U.Path); + EXPECT_EQ("ftp://ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", (std::string)U); } TEST(URITest, RFC2732) { @@ -70,6 +76,7 @@ TEST(URITest, RFC2732) EXPECT_EQ(0, U.Port); EXPECT_EQ("1080::8:800:200C:417A", U.Host); EXPECT_EQ("/foo", U.Path); + EXPECT_EQ("http://[1080::8:800:200C:417A]/foo", (std::string)U); // with port U = URI("http://[::FFFF:129.144.52.38]:80/index.html"); EXPECT_EQ("http", U.Access); @@ -78,6 +85,7 @@ TEST(URITest, RFC2732) EXPECT_EQ(80, U.Port); EXPECT_EQ("::FFFF:129.144.52.38", U.Host); EXPECT_EQ("/index.html", U.Path); + EXPECT_EQ("http://[::FFFF:129.144.52.38]:80/index.html", (std::string)U); // extra colon U = URI("http://[::FFFF:129.144.52.38:]:80/index.html"); EXPECT_EQ("http", U.Access); @@ -86,6 +94,7 @@ TEST(URITest, RFC2732) EXPECT_EQ(80, U.Port); EXPECT_EQ("::FFFF:129.144.52.38:", U.Host); EXPECT_EQ("/index.html", U.Path); + EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80/index.html", (std::string)U); // extra colon port U = URI("http://[::FFFF:129.144.52.38:]/index.html"); EXPECT_EQ("http", U.Access); @@ -94,6 +103,7 @@ TEST(URITest, RFC2732) EXPECT_EQ(0, U.Port); EXPECT_EQ("::FFFF:129.144.52.38:", U.Host); EXPECT_EQ("/index.html", U.Path); + EXPECT_EQ("http://[::FFFF:129.144.52.38:]/index.html", (std::string)U); // My Evil Corruption of RFC 2732 to handle CDROM names! // Fun for the whole family! */ U = URI("cdrom:[The Debian 1.2 disk, 1/2 R1:6]/debian/"); @@ -103,6 +113,7 @@ TEST(URITest, RFC2732) EXPECT_EQ(0, U.Port); EXPECT_EQ("The Debian 1.2 disk, 1/2 R1:6", U.Host); EXPECT_EQ("/debian/", U.Path); + EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]/debian/", (std::string)U); // no brackets U = URI("cdrom:Foo Bar Cow/debian/"); EXPECT_EQ("cdrom", U.Access); @@ -111,6 +122,7 @@ TEST(URITest, RFC2732) EXPECT_EQ(0, U.Port); EXPECT_EQ("Foo Bar Cow", U.Host); EXPECT_EQ("/debian/", U.Path); + EXPECT_EQ("cdrom://Foo Bar Cow/debian/", (std::string)U); // percent encoded U = URI("ftp://foo:b%40r@example.org"); EXPECT_EQ("foo", U.User); -- cgit v1.2.3 From dfad5beea77d75983f6ff8a1b8296b74dd48203e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 15 Mar 2015 22:34:54 +0100 Subject: add a simple unit test for acquire progress This isn't testing much of the 'complex' parts, but its better than nothing for now. Git-Dch: Ignore --- test/libapt/acqprogress_test.cc | 170 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 test/libapt/acqprogress_test.cc (limited to 'test') diff --git a/test/libapt/acqprogress_test.cc b/test/libapt/acqprogress_test.cc new file mode 100644 index 000000000..288e05aca --- /dev/null +++ b/test/libapt/acqprogress_test.cc @@ -0,0 +1,170 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +class TestItem: public pkgAcquire::Item +{ +public: + TestItem(pkgAcquire * const Acq) : pkgAcquire::Item(Acq, "", NULL) {} + + virtual std::string DescURI() { return ""; } + +}; + +TEST(AcqProgress, IMSHit) +{ + std::ostringstream out; + unsigned int width = 80; + AcqTextStatus Stat(out, width, 0); + Stat.Start(); + + pkgAcquire::ItemDesc hit; + hit.URI = "http://example.org/file"; + hit.Description = "Example File from example.org"; + hit.ShortDesc = "Example File"; + hit.Owner = NULL; + + EXPECT_EQ("", out.str()); + Stat.IMSHit(hit); + EXPECT_EQ("Hit Example File from example.org\n", out.str()); + Stat.IMSHit(hit); + EXPECT_EQ("Hit Example File from example.org\n" + "Hit Example File from example.org\n", out.str()); + Stat.Stop(); + EXPECT_EQ("Hit Example File from example.org\n" + "Hit Example File from example.org\n", out.str()); +} +TEST(AcqProgress, FetchNoFileSize) +{ + std::ostringstream out; + unsigned int width = 80; + AcqTextStatus Stat(out, width, 0); + Stat.Start(); + + pkgAcquire Acq(&Stat); + pkgAcquire::ItemDesc fetch; + fetch.URI = "http://example.org/file"; + fetch.Description = "Example File from example.org"; + fetch.ShortDesc = "Example File"; + TestItem fetchO(&Acq); + fetch.Owner = &fetchO; + + EXPECT_EQ("", out.str()); + Stat.Fetch(fetch); + EXPECT_EQ("Get:1 Example File from example.org\n", out.str()); + Stat.Fetch(fetch); + EXPECT_EQ("Get:1 Example File from example.org\n" + "Get:2 Example File from example.org\n", out.str()); + Stat.Stop(); + EXPECT_EQ("Get:1 Example File from example.org\n" + "Get:2 Example File from example.org\n", out.str()); +} +TEST(AcqProgress, FetchFileSize) +{ + std::ostringstream out; + unsigned int width = 80; + AcqTextStatus Stat(out, width, 0); + Stat.Start(); + + pkgAcquire Acq(&Stat); + pkgAcquire::ItemDesc fetch; + fetch.URI = "http://example.org/file"; + fetch.Description = "Example File from example.org"; + fetch.ShortDesc = "Example File"; + TestItem fetchO(&Acq); + fetchO.FileSize = 100; + fetch.Owner = &fetchO; + + EXPECT_EQ("", out.str()); + Stat.Fetch(fetch); + EXPECT_EQ("Get:1 Example File from example.org [100 B]\n", out.str()); + fetchO.FileSize = 42; + Stat.Fetch(fetch); + EXPECT_EQ("Get:1 Example File from example.org [100 B]\n" + "Get:2 Example File from example.org [42 B]\n", out.str()); + Stat.Stop(); + EXPECT_EQ("Get:1 Example File from example.org [100 B]\n" + "Get:2 Example File from example.org [42 B]\n", out.str()); +} +TEST(AcqProgress, Fail) +{ + std::ostringstream out; + unsigned int width = 80; + AcqTextStatus Stat(out, width, 0); + Stat.Start(); + + pkgAcquire Acq(&Stat); + pkgAcquire::ItemDesc fetch; + fetch.URI = "http://example.org/file"; + fetch.Description = "Example File from example.org"; + fetch.ShortDesc = "Example File"; + TestItem fetchO(&Acq); + fetchO.FileSize = 100; + fetchO.Status = pkgAcquire::Item::StatIdle; + fetch.Owner = &fetchO; + + EXPECT_EQ("", out.str()); + Stat.Fail(fetch); + EXPECT_EQ("", out.str()); + fetchO.Status = pkgAcquire::Item::StatDone; + Stat.Fail(fetch); + EXPECT_EQ("Ign Example File from example.org\n", out.str()); + fetchO.Status = pkgAcquire::Item::StatError; + fetchO.ErrorText = "An error test!"; + Stat.Fail(fetch); + EXPECT_EQ("Ign Example File from example.org\n" + "Err Example File from example.org\n" + " An error test!\n", out.str()); + _config->Set("Acquire::Progress::Ignore::ShowErrorText", true); + fetchO.Status = pkgAcquire::Item::StatDone; + Stat.Fail(fetch); + EXPECT_EQ("Ign Example File from example.org\n" + "Err Example File from example.org\n" + " An error test!\n" + "Ign Example File from example.org\n" + " An error test!\n", out.str()); + _config->Set("Acquire::Progress::Ignore::ShowErrorText", true); + Stat.Stop(); + EXPECT_EQ("Ign Example File from example.org\n" + "Err Example File from example.org\n" + " An error test!\n" + "Ign Example File from example.org\n" + " An error test!\n", out.str()); +} +TEST(AcqProgress, Pulse) +{ + std::ostringstream out; + unsigned int width = 80; + AcqTextStatus Stat(out, width, 0); + _config->Set("APT::Sandbox::User", ""); // ensure we aren't sandboxing + + pkgAcquire Acq(&Stat); + pkgAcquire::ItemDesc fetch; + fetch.URI = "http://example.org/file"; + fetch.Description = "Example File from example.org"; + fetch.ShortDesc = "Example File"; + TestItem fetchO(&Acq); + fetchO.FileSize = 100; + fetchO.Status = pkgAcquire::Item::StatFetching; + fetch.Owner = &fetchO; + + // make screen smaller and bigger again while running + EXPECT_TRUE(Stat.Pulse(&Acq)); + EXPECT_EQ("\r0% [Working]", out.str()); + width = 8; + EXPECT_TRUE(Stat.Pulse(&Acq)); + EXPECT_EQ("\r0% [Working]" + "\r " + "\r0% [Work", out.str()); + width = 80; + EXPECT_TRUE(Stat.Pulse(&Acq)); + EXPECT_EQ("\r0% [Working]" + "\r " + "\r0% [Work" + "\r0% [Working]", out.str()); +} -- cgit v1.2.3 From f51401eb51939bfc932519601c43822a0aa5e343 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Mar 2015 21:05:02 +0100 Subject: test for or-group choice behaviour in upgrade In #780028 we were discussing how the or-group order should be more important than keep-back decisions of 'upgrade'. We have this behaviour, but to ensure it stays this way lets add a test for it. Git-Dch: Ignore --- test/integration/test-apt-get-upgrade | 90 ++++++++++++++++++++++++++++++----- 1 file changed, 79 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-get-upgrade b/test/integration/test-apt-get-upgrade index fcee95023..09cbcdb7e 100755 --- a/test/integration/test-apt-get-upgrade +++ b/test/integration/test-apt-get-upgrade @@ -21,37 +21,47 @@ insertpackage 'stable,installed' 'upgrade-with-conflict' 'all' '1.0' insertpackage 'unstable' 'upgrade-with-conflict' 'all' '2.0' 'Conflicts: conflicting-dep' 'standard' insertpackage 'stable,installed' 'conflicting-dep' 'all' '1.0' +# upgrade with conflict and a new pkg with higher priority than conflict +insertpackage 'stable,installed' 'init' 'all' '1' +insertpackage 'unstable' 'init' 'all' '2' 'Pre-Depends: systemd | sysvinit' +insertpackage 'unstable' 'systemd' 'all' '2' 'Conflicts: conflicting-dep' +insertpackage 'unstable' 'sysvinit' 'all' '2' + setupaptarchive # Test if normal upgrade works as expected -testsuccessequal 'Reading package lists... +UPGRADE='Reading package lists... Building dependency tree... Calculating upgrade... The following packages have been kept back: - upgrade-with-conflict upgrade-with-new-dep + init upgrade-with-conflict upgrade-with-new-dep The following packages will be upgraded: upgrade-simple -1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. +1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. Inst upgrade-simple [1.0] (2.0 unstable [all]) -Conf upgrade-simple (2.0 unstable [all])' aptget -s upgrade +Conf upgrade-simple (2.0 unstable [all])' +testsuccessequal "$UPGRADE" aptget upgrade -s +testsuccessequal "$UPGRADE" apt upgrade -s --without-new-pkgs # Test if apt-get upgrade --with-new-pkgs works -testsuccessequal 'Reading package lists... +UPGRADENEW='Reading package lists... Building dependency tree... Calculating upgrade... The following NEW packages will be installed: new-dep The following packages have been kept back: - upgrade-with-conflict + init upgrade-with-conflict The following packages will be upgraded: upgrade-simple upgrade-with-new-dep -2 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +2 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Inst new-dep (1.0 stable [all]) Inst upgrade-simple [1.0] (2.0 unstable [all]) Inst upgrade-with-new-dep [1.0] (2.0 unstable [all]) Conf new-dep (1.0 stable [all]) Conf upgrade-simple (2.0 unstable [all]) -Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s upgrade --with-new-pkgs +Conf upgrade-with-new-dep (2.0 unstable [all])' +testsuccessequal "$UPGRADENEW" aptget upgrade -s --with-new-pkgs +testsuccessequal "$UPGRADENEW" apt upgrade -s # Test if apt-get dist-upgrade works testsuccessequal 'Reading package lists... @@ -60,17 +70,75 @@ Calculating upgrade... The following packages will be REMOVED: conflicting-dep The following NEW packages will be installed: - new-dep + new-dep systemd The following packages will be upgraded: - upgrade-simple upgrade-with-conflict upgrade-with-new-dep -3 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. + init upgrade-simple upgrade-with-conflict upgrade-with-new-dep +4 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. Remv conflicting-dep [1.0] +Inst systemd (2 unstable [all]) +Conf systemd (2 unstable [all]) +Inst init [1] (2 unstable [all]) Inst upgrade-with-conflict [1.0] (2.0 unstable [all]) Inst new-dep (1.0 stable [all]) Inst upgrade-simple [1.0] (2.0 unstable [all]) Inst upgrade-with-new-dep [1.0] (2.0 unstable [all]) +Conf init (2 unstable [all]) Conf upgrade-with-conflict (2.0 unstable [all]) Conf new-dep (1.0 stable [all]) Conf upgrade-simple (2.0 unstable [all]) Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s dist-upgrade +msgmsg 'make systemd a non-choice in the or-group and try again' +echo 'Package: systemd +Pin: release unstable +Pin-Priority: -1' > rootdir/etc/apt/preferences.d/nosystemd.pref + +testsuccessequal "$UPGRADE" aptget upgrade -s +testsuccessequal "$UPGRADE" apt upgrade -s --without-new-pkgs + +UPGRADENEW='Reading package lists... +Building dependency tree... +Calculating upgrade... +The following NEW packages will be installed: + new-dep sysvinit +The following packages have been kept back: + upgrade-with-conflict +The following packages will be upgraded: + init upgrade-simple upgrade-with-new-dep +3 upgraded, 2 newly installed, 0 to remove and 1 not upgraded. +Inst sysvinit (2 unstable [all]) +Conf sysvinit (2 unstable [all]) +Inst init [1] (2 unstable [all]) +Inst new-dep (1.0 stable [all]) +Inst upgrade-simple [1.0] (2.0 unstable [all]) +Inst upgrade-with-new-dep [1.0] (2.0 unstable [all]) +Conf init (2 unstable [all]) +Conf new-dep (1.0 stable [all]) +Conf upgrade-simple (2.0 unstable [all]) +Conf upgrade-with-new-dep (2.0 unstable [all])' +testsuccessequal "$UPGRADENEW" aptget upgrade -s --with-new-pkgs +testsuccessequal "$UPGRADENEW" apt upgrade -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +Calculating upgrade... +The following packages will be REMOVED: + conflicting-dep +The following NEW packages will be installed: + new-dep sysvinit +The following packages will be upgraded: + init upgrade-simple upgrade-with-conflict upgrade-with-new-dep +4 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. +Remv conflicting-dep [1.0] +Inst sysvinit (2 unstable [all]) +Conf sysvinit (2 unstable [all]) +Inst init [1] (2 unstable [all]) +Inst upgrade-with-conflict [1.0] (2.0 unstable [all]) +Inst new-dep (1.0 stable [all]) +Inst upgrade-simple [1.0] (2.0 unstable [all]) +Inst upgrade-with-new-dep [1.0] (2.0 unstable [all]) +Conf init (2 unstable [all]) +Conf upgrade-with-conflict (2.0 unstable [all]) +Conf new-dep (1.0 stable [all]) +Conf upgrade-simple (2.0 unstable [all]) +Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s dist-upgrade -- cgit v1.2.3 From 596ec43ce34421080a58b28299c1ed9cb0dbaa25 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 12 Apr 2015 19:16:01 +0200 Subject: parse specific-arch dependencies correctly on single-arch systems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On single-arch the parsing was creating groupnames like 'apt:amd64' even through it should be 'apt' and a package in it belonging to architecture amd64. The result for foreign architectures was as expected: The dependency isn't satisfiable, but for native architecture it means the wrong package (ala apt:amd64:amd64) is linked so this is also not satisfiable, which is very much not expected. No longer excluding single-arch from this codepath allows the generation of the correct links, which still link to non-exisiting packages for foreign dependencies, but natives link to the expected native package just as if no architecture was given. For negative arch-specific dependencies ala Conflicts this matter was worse as apt will believe there isn't a Conflict to resolve, tricking it into calculating a solution dpkg will refuse. Architecture specific positive dependencies are rare in jessie – the only one in amd64 main is foreign –, negative dependencies do not even exist. Neither class has a native specimen, so no package in jessie is effected by this bug, but it might be interesting for stretch upgrades. This also means the regression potential is very low. Closes: 777760 --- test/integration/test-multiarch-foreign | 159 ++++++++++++++------- .../test-specific-architecture-dependencies | 148 ++++++++++++++++++- 2 files changed, 253 insertions(+), 54 deletions(-) (limited to 'test') diff --git a/test/integration/test-multiarch-foreign b/test/integration/test-multiarch-foreign index 332466d96..240f1a4d1 100755 --- a/test/integration/test-multiarch-foreign +++ b/test/integration/test-multiarch-foreign @@ -7,9 +7,13 @@ setupenvironment configarchitecture 'amd64' 'i386' 'armel' insertpackage 'unstable' 'cool-foo' 'amd64,i386' '1.0' 'Depends: foo' +insertpackage 'unstable' 'cool-foo-x64' 'amd64' '1.0' 'Depends: foo:amd64' +insertpackage 'unstable' 'cool-foo-x32' 'amd64' '1.0' 'Depends: foo:i386' insertpackage 'unstable' 'foo' 'amd64,i386,armel' '1.0' 'Multi-Arch: foreign' insertpackage 'unstable' 'cool-bar' 'amd64,i386' '1.0' 'Depends: bar-provider' +insertpackage 'unstable' 'cool-bar-x64' 'amd64' '1.0' 'Depends: bar-provider:amd64' +insertpackage 'unstable' 'cool-bar-x32' 'amd64' '1.0' 'Depends: bar-provider:i386' insertpackage 'unstable' 'bar' 'amd64,i386,armel' '1.0' 'Provides: bar-provider Multi-Arch: foreign' @@ -27,28 +31,6 @@ Inst cool-foo:i386 (1.0 unstable [i386]) Conf foo (1.0 unstable [amd64]) Conf cool-foo:i386 (1.0 unstable [i386])' aptget install cool-foo:i386 -s -testequal 'Reading package lists... -Building dependency tree... -The following extra packages will be installed: - foo -The following NEW packages will be installed: - cool-foo foo -0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. -Inst foo (1.0 unstable [amd64]) -Inst cool-foo (1.0 unstable [amd64]) -Conf foo (1.0 unstable [amd64]) -Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 -s - -testequal 'Reading package lists... -Building dependency tree... -The following NEW packages will be installed: - cool-foo foo -0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. -Inst foo (1.0 unstable [amd64]) -Inst cool-foo (1.0 unstable [amd64]) -Conf foo (1.0 unstable [amd64]) -Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:amd64 -s - testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -69,10 +51,6 @@ Inst cool-foo (1.0 unstable [amd64]) Conf foo:armel (1.0 unstable [armel]) Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:armel -s - - - - testequal 'Reading package lists... Building dependency tree... The following extra packages will be installed: @@ -87,6 +65,60 @@ Conf cool-bar:i386 (1.0 unstable [i386])' aptget install cool-bar:i386 -s testequal 'Reading package lists... Building dependency tree... +The following NEW packages will be installed: + bar:i386 cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:i386 (1.0 unstable [i386]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar:i386 (1.0 unstable [i386]) +Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar:armel cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:armel (1.0 unstable [armel]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar:armel (1.0 unstable [armel]) +Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:armel -s + +testequal "Reading package lists... +Building dependency tree... +Note, selecting 'bar:i386' instead of 'bar-provider:i386' +The following NEW packages will be installed: + bar:i386 cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:i386 (1.0 unstable [i386]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar:i386 (1.0 unstable [i386]) +Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider:i386 -s -q=0 + +satisfiable_in_singlearch() { + testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + cool-foo foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [amd64]) +Inst cool-foo (1.0 unstable [amd64]) +Conf foo (1.0 unstable [amd64]) +Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 -s + + testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + cool-foo foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [amd64]) +Inst cool-foo (1.0 unstable [amd64]) +Conf foo (1.0 unstable [amd64]) +Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:amd64 -s + + testequal 'Reading package lists... +Building dependency tree... The following extra packages will be installed: bar The following NEW packages will be installed: @@ -97,7 +129,7 @@ Inst cool-bar (1.0 unstable [amd64]) Conf bar (1.0 unstable [amd64]) Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 -s -testequal 'Reading package lists... + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: bar cool-bar @@ -107,44 +139,71 @@ Inst cool-bar (1.0 unstable [amd64]) Conf bar (1.0 unstable [amd64]) Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:amd64 -s -testequal 'Reading package lists... + testequal "Reading package lists... Building dependency tree... +Note, selecting 'bar' instead of 'bar-provider' The following NEW packages will be installed: - bar:i386 cool-bar + bar cool-bar 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. -Inst bar:i386 (1.0 unstable [i386]) +Inst bar (1.0 unstable [amd64]) Inst cool-bar (1.0 unstable [amd64]) -Conf bar:i386 (1.0 unstable [i386]) -Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:i386 -s +Conf bar (1.0 unstable [amd64]) +Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider -s -q=0 -testequal 'Reading package lists... + testequal 'Reading package lists... Building dependency tree... +The following extra packages will be installed: + foo The following NEW packages will be installed: - bar:armel cool-bar + cool-foo-x64 foo 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. -Inst bar:armel (1.0 unstable [armel]) -Inst cool-bar (1.0 unstable [amd64]) -Conf bar:armel (1.0 unstable [armel]) -Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:armel -s +Inst foo (1.0 unstable [amd64]) +Inst cool-foo-x64 (1.0 unstable [amd64]) +Conf foo (1.0 unstable [amd64]) +Conf cool-foo-x64 (1.0 unstable [amd64])' aptget install cool-foo-x64 -s +} -testequal "Reading package lists... +#FIXME: do not work in single-arch as i386 isn't known at cache generation time + testequal 'Reading package lists... Building dependency tree... -Note, selecting 'bar' instead of 'bar-provider' +The following extra packages will be installed: + foo The following NEW packages will be installed: - bar cool-bar + cool-foo-x32 foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [amd64]) +Inst cool-foo-x32 (1.0 unstable [amd64]) +Conf foo (1.0 unstable [amd64]) +Conf cool-foo-x32 (1.0 unstable [amd64])' aptget install cool-foo-x32 -s + + testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + bar +The following NEW packages will be installed: + bar cool-bar-x32 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Inst bar (1.0 unstable [amd64]) -Inst cool-bar (1.0 unstable [amd64]) +Inst cool-bar-x32 (1.0 unstable [amd64]) Conf bar (1.0 unstable [amd64]) -Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider -s -q=0 +Conf cool-bar-x32 (1.0 unstable [amd64])' aptget install cool-bar-x32 -s -q=0 -testequal "Reading package lists... + testequal 'Reading package lists... Building dependency tree... -Note, selecting 'bar:i386' instead of 'bar-provider:i386' +The following extra packages will be installed: + bar The following NEW packages will be installed: - bar:i386 cool-bar + bar cool-bar-x64 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. -Inst bar:i386 (1.0 unstable [i386]) -Inst cool-bar (1.0 unstable [amd64]) -Conf bar:i386 (1.0 unstable [i386]) -Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider:i386 -s -q=0 +Inst bar (1.0 unstable [amd64]) +Inst cool-bar-x64 (1.0 unstable [amd64]) +Conf bar (1.0 unstable [amd64]) +Conf cool-bar-x64 (1.0 unstable [amd64])' aptget install cool-bar-x64 -s -q=0 + + +satisfiable_in_singlearch + +msgmsg 'switch to single architecture' +configarchitecture 'amd64' + +satisfiable_in_singlearch diff --git a/test/integration/test-specific-architecture-dependencies b/test/integration/test-specific-architecture-dependencies index 078a84654..ccfced150 100755 --- a/test/integration/test-specific-architecture-dependencies +++ b/test/integration/test-specific-architecture-dependencies @@ -12,16 +12,19 @@ insertinstalledpackage 'provider' 'amd64' '1' 'Provides: foo' insertpackage 'unstable' 'pre-depender' 'all' '1' 'Pre-Depends: libc6:i386' insertpackage 'unstable' 'depender' 'all' '1' 'Depends: libc6:i386' +insertpackage 'unstable' 'depender-x32' 'i386,amd64' '1' 'Depends: libc6:i386' +insertpackage 'unstable' 'depender-x64' 'i386,amd64' '1' 'Depends: libc6:amd64' insertpackage 'unstable' 'breaker' 'all' '1' 'Breaks: libold (<< 2)' -insertpackage 'unstable' 'breaker-x32' 'amd64' '1' 'Breaks: libold:i386 (<< 2)' -insertpackage 'unstable' 'breaker-x64' 'i386' '1' 'Breaks: libold:amd64 (<< 2)' +insertpackage 'unstable' 'breaker-x32' 'i386,amd64' '1' 'Breaks: libold:i386 (<< 2)' +insertpackage 'unstable' 'breaker-x64' 'i386,amd64' '1' 'Breaks: libold:amd64 (<< 2)' # conflicts with no effect insertpackage 'unstable' 'oldconflictor' 'all' '1' 'Conflicts: libold (<< 0)' insertpackage 'unstable' 'oldconflictor-x32' 'amd64' '1' 'Conflicts: libold:i386 (<< 0)' insertpackage 'unstable' 'oldconflictor-x64' 'i386' '1' 'Conflicts: libold:amd64 (<< 0)' insertpackage 'unstable' 'foo-depender' 'i386,amd64' '1' 'Depends: foo' +insertpackage 'unstable' 'foo-native-depender' 'amd64' '1' 'Depends: foo:amd64' insertpackage 'unstable' 'foo-foreign-depender' 'i386' '1' 'Depends: foo:amd64' insertpackage 'unstable' 'foo-conflictor' 'i386,amd64' '1' 'Conflicts: foo' @@ -54,6 +57,54 @@ Inst depender (1 unstable [all]) Conf libc6:i386 (1 unstable [i386]) Conf depender (1 unstable [all])' aptget install depender -s +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + libc6:i386 +The following NEW packages will be installed: + depender-x32:i386 libc6:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6:i386 (1 unstable [i386]) +Inst depender-x32:i386 (1 unstable [i386]) +Conf libc6:i386 (1 unstable [i386]) +Conf depender-x32:i386 (1 unstable [i386])' aptget install depender-x32:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + libc6:i386 +The following NEW packages will be installed: + depender-x32 libc6:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6:i386 (1 unstable [i386]) +Inst depender-x32 (1 unstable [amd64]) +Conf libc6:i386 (1 unstable [i386]) +Conf depender-x32 (1 unstable [amd64])' aptget install depender-x32:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + libc6 +The following NEW packages will be installed: + depender-x64 libc6 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (1 unstable [amd64]) +Inst depender-x64 (1 unstable [amd64]) +Conf libc6 (1 unstable [amd64]) +Conf depender-x64 (1 unstable [amd64])' aptget install depender-x64:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + libc6 +The following NEW packages will be installed: + depender-x64:i386 libc6 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (1 unstable [amd64]) +Inst depender-x64:i386 (1 unstable [i386]) +Conf libc6 (1 unstable [amd64]) +Conf depender-x64:i386 (1 unstable [i386])' aptget install depender-x64:i386 -s + testequal 'Reading package lists... Building dependency tree... The following packages will be REMOVED: @@ -75,7 +126,29 @@ The following NEW packages will be installed: 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. Remv libold:i386 [1] Inst breaker-x32 (1 unstable [amd64]) -Conf breaker-x32 (1 unstable [amd64])' aptget install breaker-x32 -s +Conf breaker-x32 (1 unstable [amd64])' aptget install breaker-x32:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + libold:i386 +The following NEW packages will be installed: + breaker-x32:i386 +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libold:i386 [1] +Inst breaker-x32:i386 (1 unstable [i386]) +Conf breaker-x32:i386 (1 unstable [i386])' aptget install breaker-x32:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + libold +The following NEW packages will be installed: + breaker-x64 +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libold [1] +Inst breaker-x64 (1 unstable [amd64]) +Conf breaker-x64 (1 unstable [amd64])' aptget install breaker-x64:amd64 -s testequal 'Reading package lists... Building dependency tree... @@ -86,7 +159,7 @@ The following NEW packages will be installed: 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. Remv libold [1] Inst breaker-x64:i386 (1 unstable [i386]) -Conf breaker-x64:i386 (1 unstable [i386])' aptget install breaker-x64 -s +Conf breaker-x64:i386 (1 unstable [i386])' aptget install breaker-x64:i386 -s testequal 'Reading package lists... Building dependency tree... @@ -132,6 +205,14 @@ The following packages have unmet dependencies: foo-depender:i386 : Depends: foo:i386 but it is not installable E: Unable to correct problems, you have held broken packages.' aptget install foo-depender:i386 -s +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo-native-depender +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo-native-depender (1 unstable [amd64]) +Conf foo-native-depender (1 unstable [amd64])' aptget install foo-native-depender -s + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -180,3 +261,62 @@ The following NEW packages will be installed: 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst foo-no-conflictor:i386 (1 unstable [i386]) Conf foo-no-conflictor:i386 (1 unstable [i386])' aptget install foo-no-conflictor:i386 -s + +msgmsg 'switch to single architecture' +configarchitecture 'amd64' + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + libc6 +The following NEW packages will be installed: + depender-x64 libc6 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (1 unstable [amd64]) +Inst depender-x64 (1 unstable [amd64]) +Conf libc6 (1 unstable [amd64]) +Conf depender-x64 (1 unstable [amd64])' aptget install depender-x64 -s + +testequal 'Reading package lists... +Building dependency tree... +E: Unable to locate package depender-x64' aptget install depender-x64:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo-native-depender +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo-native-depender (1 unstable [amd64]) +Conf foo-native-depender (1 unstable [amd64])' aptget install foo-native-depender -s + +# libold:i386 is installed, but we don't see it as i386 isn't configured +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + breaker-x32 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst breaker-x32 (1 unstable [amd64]) +Conf breaker-x32 (1 unstable [amd64])' aptget install breaker-x32:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + libold +The following NEW packages will be installed: + breaker-x64 +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libold [1] +Inst breaker-x64 (1 unstable [amd64]) +Conf breaker-x64 (1 unstable [amd64])' aptget install breaker-x64:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + depender-x32 : Depends: libc6:i386 but it is not installable +E: Unable to correct problems, you have held broken packages.' aptget install depender-x32 -s -- cgit v1.2.3 From 42fab5fbc85e243b958beff95912c46fb81abcc0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 Mar 2015 16:51:29 +0100 Subject: demote missing gtest to a buildtime warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We just need it for unit tests and our debian/rules file actually skips calling them if nocheck is given… but this fails anyhow as we declared a hard-dependency on it. Demoting the error to a warning in configuration and adding a test in the 'make test' path with a friendly message allows nocheck to be useful again. (Running unit tests is fully encouraged of course, but bootstrappers and co do not need to be burdened with this stuff) --- test/libapt/makefile | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/libapt/makefile b/test/libapt/makefile index 7f23ace46..0f8df291f 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -8,6 +8,7 @@ APT_DOMAIN=none include ../../buildlib/defaults.mak .PHONY: test +ifeq (file-okay,$(shell $(CC) -M gtest_runner.cc >/dev/null 2>&1 && echo 'file-okay')) test: $(BIN)/gtest$(BASENAME) MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=$(LIB) $(BIN)/gtest$(BASENAME) @@ -71,3 +72,11 @@ $(LIB)/gtest.a: $(OBJ)/gtest-all.o echo Building static library $@ -rm -f $@ $(AR) $(ARFLAGS) $@ $^ + +else +test: + @echo "APT uses Googles C++ testing framework for its unit tests" + @echo "On Debian systems this is available in the 'libgtest-dev' package." + @echo "Please install it before attempting to run the unit tests." + exit 100 +endif -- cgit v1.2.3 From 27925d82dd0cbae74d48040363fe6f6c2bae5215 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 27 Mar 2015 15:53:43 +0100 Subject: improve https method queue progress reporting The worker expects that the methods tell him when they start or finish downloading a file. Various information pieces are passed along in this report including the (expected) filesize. https was using a "global" struct for reporting which made it 'reuse' incorrect values in some cases like a non-existent InRelease fallbacking to Release{,.gpg} resulting in a size-mismatch warning. Reducing the scope and redesigning the setting of the values we can fix this and related issues. Closes: 777565, 781509 Thanks: Robert Edmonds and Anders Kaseorg for initial patchs --- test/integration/framework | 20 +++++- test/integration/test-apt-https-no-redirect | 15 ++-- test/integration/test-apt-update-expected-size | 86 +++++++++++++++-------- test/integration/test-bug-602412-dequote-redirect | 3 +- 4 files changed, 80 insertions(+), 44 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index ec23e41e6..50c027a2c 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1125,8 +1125,10 @@ acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom downloadfile() { local PROTO="${1%%:*}" - apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ - download-file "$1" "$2" 2>&1 || true + if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ + download-file "$1" "$2" 2>&1 ; then + return 1 + fi # only if the file exists the download was successful if [ -r "$2" ]; then return 0 @@ -1407,6 +1409,20 @@ testfailureequal() { testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP" } +testfailuremsg() { + local CMP="$1" + shift + testfailure "$@" + msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' + grep '^\(W\|E\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailureequal.output" 2>&1 || true + if echo "$CMP" | checkdiff - "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailureequal.output"; then + msgpass + else + echo '### Complete output ###' + cat "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" + msgfail + fi +} testfilestats() { msgtest "Test that file $1 has $2 $3" "$4" diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect index bc744d6f2..c91c78916 100755 --- a/test/integration/test-apt-https-no-redirect +++ b/test/integration/test-apt-https-no-redirect @@ -14,22 +14,15 @@ echo 'alright' > aptarchive/working changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/' msgtest 'download of a file works via' 'http' -downloadfile 'http://localhost:8080/working' httpfile >/dev/null 2>&1 && msgpass || msgfail +testsuccess --nomsg downloadfile 'http://localhost:8080/working' httpfile testfileequal httpfile 'alright' msgtest 'download of a file works via' 'https' -downloadfile 'https://localhost:4433/working' httpsfile >/dev/null 2>&1 && msgpass || msgfail +testsuccess --nomsg downloadfile 'https://localhost:4433/working' httpsfile testfileequal httpsfile 'alright' msgtest 'download of a file does not work if' 'https redirected to http' -downloadfile 'https://localhost:4433/redirectme/working' redirectfile >curloutput 2>&1 && msgfail || msgpass +testfailure --nomsg downloadfile 'https://localhost:4433/redirectme/working' redirectfile msgtest 'libcurl has forbidden access in last request to' 'http resource' -if grep -q -E -- 'Protocol "?http"? not supported or disabled in libcurl' curloutput; then - msgpass -else - cat curloutput - msgfail -fi - - +testsuccess --nomsg grep -q -E -- 'Protocol "?http"? not supported or disabled in libcurl' rootdir/tmp/testfailure.output diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 9711c293a..22de13ea5 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -10,35 +10,61 @@ configarchitecture "i386" insertpackage 'unstable' 'apt' 'all' '1.0' setupaptarchive --no-update +cp -a aptarchive/dists aptarchive/dists.good + +test_inreleasetoobig() { + # make InRelease really big to trigger fallback + dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null + touch -d '+1hour' aptarchive/dists/unstable/InRelease + testsuccess aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 + msgtest 'Check that the max write warning is triggered' + cp rootdir/tmp/testsuccess.output update.output + testsuccess --nomsg grep -q 'Writing more data than expected' update.output + rm -f update.output + # ensure the failed InRelease file got renamed + testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED +} + +test_packagestoobig() { + # append junk at the end of the Packages.gz/Packages + SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" + find aptarchive/dists -name 'Packages*' | while read pkg; do + echo "1234567890" >> "$pkg" + touch -d '+1hour' "$pkg" + done + NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" + testfailuremsg "W: Failed to fetch ${1}/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=0 +} + +methodtest() { + msgmsg 'Test with' "$1" 'and clean start' + rm -rf rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good + # normal update works fine + testsuccess aptget update + mv rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good + + # starting fresh works + test_inreleasetoobig "$1" + rm -rf aptarchive/dists rootdir/var/lib/apt/lists + cp -a aptarchive/dists.good aptarchive/dists + test_packagestoobig "$1" + rm -rf aptarchive/dists rootdir/var/lib/apt/lists + cp -a aptarchive/dists.good aptarchive/dists + + msgmsg 'Test with' "$1" 'and existing old data' + cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists + test_inreleasetoobig "$1" + rm -rf aptarchive/dists rootdir/var/lib/apt/lists + cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists + cp -a aptarchive/dists.good aptarchive/dists + test_packagestoobig "$1" + rm -rf aptarchive/dists + cp -a aptarchive/dists.good aptarchive/dists +} + changetowebserver +methodtest 'http://localhost:8080' -# normal update works fine -testsuccess aptget update - -# make InRelease really big to trigger fallback -mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good -dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null -touch -d '+1hour' aptarchive/dists/unstable/InRelease -testsuccess aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 -msgtest 'Check that the max write warning is triggered' -if grep -q "Writing more data than expected" rootdir/tmp/testsuccess.output; then - msgpass -else - cat rootdir/tmp/testsuccess.output - msgfail -fi -# ensure the failed InRelease file got renamed -testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED -mv aptarchive/dists/unstable/InRelease.good aptarchive/dists/unstable/InRelease - - -# append junk at the end of the Packages.gz/Packages -SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" -find aptarchive -name 'Packages*' | while read pkg; do - echo "1234567890" >> "$pkg" -done -NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" -rm -f rootdir/var/lib/apt/lists/localhost* -testfailureequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) - -E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq +changetohttpswebserver +methodtest 'https://localhost:4433' diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index d3573a79a..384c8b113 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -8,7 +8,7 @@ configarchitecture 'amd64' buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' -setupaptarchive +setupaptarchive --no-update changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \ -o aptwebserver::redirect::replace::/dists/=/newdists/ @@ -16,6 +16,7 @@ mv aptarchive/pool aptarchive/newpool mv aptarchive/dists aptarchive/newdists testrun() { + msgmsg 'Test redirection works in method boundaries' "$1" msgtest 'Test redirection works in' 'apt-get update' testsuccess --nomsg aptget update -- cgit v1.2.3 From a09f6eb8fc67cd2d836019f448f18580396185e5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 27 Mar 2015 19:59:44 +0100 Subject: send Alt-* info for uncompressed based on any compressions file sends information about the uncompressed file if it can find it as well as for the compressed file. This was done only for gzip so far, but we support more compression types. That this information isn't used a lot is a different story. Git-Dch: Ignore --- test/integration/framework | 2 +- test/integration/test-compressed-indexes | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 50c027a2c..994956b74 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -3,7 +3,7 @@ EXIT_CODE=0 # we all like colorful messages -if [ "$MSGCOLOR" != 'NO' ]; then +if [ "$MSGCOLOR" != 'NO' ] && [ "$MSGCOLOR" != 'ALWAYS' ]; then if [ ! -t 1 ]; then # but check that we output to a terminal export MSGCOLOR='NO' fi diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 5b966754c..c6b292baa 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -61,7 +61,7 @@ testrun() { cd downloaded testsuccess --nomsg aptget download testpkg msgtest '\tdeb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb - rm testpkg_1.0_i386.deb + rm -f testpkg_1.0_i386.deb cd - >/dev/null testsuccessequal 'Reading package lists... Building dependency tree... -- cgit v1.2.3 From 117038bac90261351518870b3f48136f134d4bfc Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 30 Mar 2015 19:52:32 +0200 Subject: handle servers closing encoded connections correctly Servers who advertise that they close the connection get the 'Closes' encoding flag, but this conflicts with servers who response with a transfer-encoding (e.g. encoding) as it is saved in the same flag. We have a better flag for the keep-alive (or not) of the connection anyway, so we check this instead of the encoding. This is in practice not much of a problem as real servers we talk to are HTTP1.1 servers (with keep-alive) and there isn't much point in doing chunked encoding if you are going to close anyway, but our simple testserver stumbles over this if pressed and its a bit cleaner, too. Git-Dch: Ignore --- test/interactive-helper/aptwebserver.cc | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 644629a33..86d5c06f0 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -598,17 +598,24 @@ static void * handleClient(void * voidclient) /*{{{*/ { int client = *((int*)(voidclient)); std::clog << "ACCEPT client " << client << std::endl; - std::vector messages; bool closeConnection = false; - std::list headers; - while (closeConnection == false && ReadMessages(client, messages)) + while (closeConnection == false) { - // if we announced a closing, do the close - if (std::find(headers.begin(), headers.end(), std::string("Connection: close")) != headers.end()) + std::vector messages; + if (ReadMessages(client, messages) == false) break; - headers.clear(); + + std::list headers; for (std::vector::const_iterator m = messages.begin(); m != messages.end() && closeConnection == false; ++m) { + // if we announced a closing in previous response, do the close now + if (std::find(headers.begin(), headers.end(), std::string("Connection: close")) != headers.end()) + { + closeConnection = true; + break; + } + headers.clear(); + std::clog << ">>> REQUEST from " << client << " >>>" << std::endl << *m << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; std::string filename; @@ -760,9 +767,16 @@ static void * handleClient(void * voidclient) /*{{{*/ else sendError(client, 404, *m, sendContent, "", headers); } + + // if we announced a closing in the last response, do the close now + if (std::find(headers.begin(), headers.end(), std::string("Connection: close")) != headers.end()) + closeConnection = true; + + if (_error->PendingError() == true) + break; _error->DumpErrors(std::cerr); - messages.clear(); } + _error->DumpErrors(std::cerr); close(client); std::clog << "CLOSE client " << client << std::endl; return NULL; -- cgit v1.2.3 From 9224ce3d4d1ea0428a70e75134998e08aa45b1e6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 30 Mar 2015 20:47:13 +0200 Subject: calculate only expected hashes in methods Methods get told which hashes are expected by the acquire system, which means we can use this list to restrict what we calculate in the methods as any extra we are calculating is wasted effort as we can't compare it with anything anyway. Adding support for a new hash algorithm is therefore 'free' now and if a algorithm is no longer provided in a repository for a file, we automatically stop calculating it. In practice this results in a speed-up in Debian as we don't have SHA512 here (so far), so we practically stop calculating it. --- test/libapt/hashsums_test.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index a19a0befd..edcd8a11a 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -193,6 +193,30 @@ TEST(HashSumsTest, FileBased) EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue()); } fd.Seek(0); + { + Hashes hashes(Hashes::MD5SUM | Hashes::SHA512SUM); + hashes.AddFD(fd); + HashStringList list = hashes.GetHashStringList(); + EXPECT_FALSE(list.empty()); + EXPECT_EQ(3, list.size()); + EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue()); + EXPECT_EQ(NULL, list.find("SHA1")); + EXPECT_EQ(NULL, list.find("SHA256")); + EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue()); + EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue()); + fd.Seek(0); + Hashes hashes2(list); + hashes2.AddFD(fd); + list = hashes2.GetHashStringList(); + EXPECT_FALSE(list.empty()); + EXPECT_EQ(3, list.size()); + EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue()); + EXPECT_EQ(NULL, list.find("SHA1")); + EXPECT_EQ(NULL, list.find("SHA256")); + EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue()); + EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue()); + } + fd.Seek(0); { MD5Summation MD5; MD5.AddFD(fd.Fd()); -- cgit v1.2.3 From 34faa8f7ae2526f46cd1f84bb6962ad06d841e5e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 11 Apr 2015 10:23:52 +0200 Subject: calculate hashes while downloading in https MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We do this in HTTP already to give the CPU some exercise while the disk is heavily spinning (or flashing?) to store the data avoiding the need to reread the entire file again later on to calculate the hashes – which happens outside of the eyes of progress reporting, so you might ended up with a bunch of https workers 'stuck' at 100% while they were busy calculating hashes. This is a bummer for everyone using apt as a connection speedtest as the https method works slower now (not really, it just isn't reporting done too early anymore). --- test/integration/test-apt-download-progress | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-download-progress b/test/integration/test-apt-download-progress index b2c9effe6..07c5e09c5 100755 --- a/test/integration/test-apt-download-progress +++ b/test/integration/test-apt-download-progress @@ -26,14 +26,16 @@ assertprogress() { TESTFILE=testfile.big testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=800k count=1 +OPT='-o APT::Status-Fd=3 -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 -o Debug::Acquire::https=1' + msgtest 'download progress works via' 'http' exec 3> apt-progress.log -testsuccess --nomsg apthelper download-file "http://localhost:8080/$TESTFILE" http-$TESTFILE -o APT::Status-Fd=3 -o Acquire::http::Dl-Limit=800 +testsuccess --nomsg apthelper download-file "http://localhost:8080/$TESTFILE" http-$TESTFILE $OPT -o Acquire::http::Dl-Limit=800 assertprogress apt-progress.log msgtest 'download progress works via' 'https' exec 3> apt-progress.log -testsuccess --nomsg apthelper download-file "https://localhost:4433/$TESTFILE" https-$TESTFILE -o APT::Status-Fd=3 -o Acquire::https::Dl-Limit=800 +testsuccess --nomsg apthelper download-file "https://localhost:4433/$TESTFILE" https-$TESTFILE $OPT -o Acquire::https::Dl-Limit=800 assertprogress apt-progress.log # cleanup -- cgit v1.2.3 From d84da4995df24329e96d57a22136683a9e370f4e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 11 Apr 2015 20:13:19 +0200 Subject: ensure lists/ files have correct permissions after apt-cdrom add Its a bit unpredictable which permissons and owners we will encounter on a CD-ROM (or a USB stick, as apt-cdrom is responsible for those too), so we have to ensure in this codepath as well that everything is nicely setup without waiting for a 'apt-get update' to fix up the (potential) mess. --- test/integration/framework | 1 + test/integration/test-apt-cdrom | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 994956b74..642c5f0d0 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1525,6 +1525,7 @@ aptautotest_aptget_update() { done } aptautotest_apt_update() { aptautotest_aptget_update "$@"; } +aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } testaptautotestnodpkgwarning() { local TESTCALL="$1" diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 9906795ca..34b35f745 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -33,6 +33,7 @@ aptcdromlog() { test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" } +aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; } CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ Unmounting CD-ROM... @@ -133,13 +134,13 @@ aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && # ensure cdrom method isn't trying to mount the cdrom mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected -# ensure an update doesn't mess with cdrom sources +msgmsg "ensure an update doesn't mess with cdrom sources" testsuccess aptget update testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted testcdromusage -# and again to check that it withstands the temptation even if it could mount +msgmsg 'and again to check that it withstands the temptation even if it could mount' testsuccess aptget update testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' testcdromusage -- cgit v1.2.3 From ba6b79bd0090077724fa1272ea4d3a31706fcd5a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 12 Apr 2015 17:08:46 +0200 Subject: a hit on Release files means the indexes will be hits too If we get a IMSHit for the Transaction-Manager (= the InRelease file or as its still supported fallback Release + Release.gpg combo) we can assume that every file we would queue based on this manager, but already have locally is current and hence would get an IMSHit, too. We therefore save us and the server the trouble and skip the queuing in this case. Beside speeding up repetative executions of 'apt-get update' this way we also avoid hitting hashsum errors if the indexes are in fact already updated, but the Release file isn't yet as it is the case on well behaving mirrors as Release files is updated last. The implementation is a bit harder than the theory makes it sound as we still have to keep reverifying the Release files (e.g. to detect now expired once to avoid an attacker being able to silently stale us) and have to handle cases in which the Release file hits, but some indexes aren't present (e.g. user added a new foreign architecture). --- test/integration/framework | 19 +-- test/integration/test-apt-update-expected-size | 4 + test/integration/test-apt-update-ims | 150 +++++++++++++++------- test/integration/test-apt-update-not-modified | 45 +++++++ test/integration/test-apt-update-transactions | 7 + test/integration/test-bug-602412-dequote-redirect | 3 - test/integration/test-pdiff-usage | 15 +-- test/interactive-helper/aptwebserver.cc | 9 +- 8 files changed, 182 insertions(+), 70 deletions(-) create mode 100755 test/integration/test-apt-update-not-modified (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 642c5f0d0..4229ae162 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1005,6 +1005,7 @@ signreleasefiles() { } webserverconfig() { + local WEBSERVER="${3:-http://localhost:8080}" local NOCHECK=false if [ "$1" = '--no-check' ]; then NOCHECK=true @@ -1016,10 +1017,10 @@ webserverconfig() { local URI if [ -n "$2" ]; then msgtest "Set webserver config option '${1}' to" "$2" - URI="http://localhost:8080/_config/set/${1}/${2}" + URI="${WEBSERVER}/_config/set/${1}/${2}" else msgtest 'Clear webserver config option' "${1}" - URI="http://localhost:8080/_config/clear/${1}" + URI="${WEBSERVER}/_config/clear/${1}" fi if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then msgpass @@ -1467,12 +1468,14 @@ pause() { } listcurrentlistsdirectory() { - find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do - stat --format '%U:%G:%a:%n' "$line" - done - find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do - stat --format '%U:%G:%a:%s:%y:%n' "$line" - done + { + find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do + stat --format '%U:%G:%a:%n' "$line" + done + find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do + stat --format '%U:%G:%a:%s:%y:%n' "$line" + done + } | sort } ### convinience hacks ### diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 22de13ea5..9f58308aa 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -38,6 +38,10 @@ E: Some index files failed to download. They have been ignored, or old ones used } methodtest() { + # less complicated test setup this way + webserverconfig 'aptwebserver::support::modified-since' 'false' "$1" + webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also + msgmsg 'Test with' "$1" 'and clean start' rm -rf rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good # normal update works fine diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 0fa882d78..f091bffaa 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -6,85 +6,145 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' -buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' +insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1' +insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1' setupaptarchive --no-update changetowebserver runtest() { - configallowinsecurerepositories "${1:-false}" + if [ -n "$1" ]; then + configallowinsecurerepositories 'true' + else + configallowinsecurerepositories 'false' + fi - rm -f rootdir/var/lib/apt/lists/localhost* + rm -rf rootdir/var/lib/apt/lists/ - if [ "$1" = 'true' ]; then - testwarning aptget update - else - testsuccess aptget update + local TEST="test${1:-success}" + $TEST aptget update + if [ "$1" = 'failure' ]; then + # accept the outdated Release file so we can check Hit behaviour + "test${2:-success}" aptget update -o Acquire::Min-ValidTime=99999999999 fi + listcurrentlistsdirectory > listsdir.lst + testsuccess grep '_Packages\(\.gz\)\?$' listsdir.lst + testsuccess grep '_Sources\(\.gz\)\?$' listsdir.lst + testsuccess grep '_Translation-en\(\.gz\)\?$' listsdir.lst # ensure no leftovers in partial - testfailure ls "rootdir/var/lib/apt/lists/partial/*" + testfailure ls 'rootdir/var/lib/apt/lists/partial/*' # check that I-M-S header is kept in redirections - testequal "$EXPECT" aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 - - # ensure that we still do a hash check on ims hit - msgtest 'Test I-M-S' 'reverify' - aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A2 'ReceivedHash:' | grep -q -- '- SHA' && msgpass || msgfail + echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output + $TEST aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 + sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir/tmp/${TEST}.output + testequal "$(cat expected.output)" cat rootdir/tmp/${TEST}.output + testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + + # ensure that we still do a hash check for other files on ims hit of Release + if grep -q '^Hit .* \(InRelease\|Release.gpg\)$' expected.output ; then + $TEST aptget update -o Debug::Acquire::gpgv=1 + cp rootdir/tmp/${TEST}.output goodsign.output + testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + testsuccess grep '^Got GOODSIG, key ID:GOODSIG' goodsign.output + fi # ensure no leftovers in partial - testfailure ls "rootdir/var/lib/apt/lists/partial/*" + testfailure ls 'rootdir/var/lib/apt/lists/partial/*' } -msgmsg "InRelease" -EXPECT="Hit http://localhost:8080 unstable InRelease -Hit http://localhost:8080 unstable/main Sources -Hit http://localhost:8080 unstable/main amd64 Packages -Hit http://localhost:8080 unstable/main Translation-en -Reading package lists..." -# with InRelease +msgmsg 'InRelease' +EXPECT='Hit http://localhost:8080 unstable InRelease +Reading package lists...' +echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest - -# with gzip -echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex +echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest -msgmsg "Release/Release.gpg" -# with Release/Release.gpg -EXPECT="Ign http://localhost:8080 unstable InRelease +msgmsg 'Release/Release.gpg' +EXPECT='Ign http://localhost:8080 unstable InRelease 404 Not Found Hit http://localhost:8080 unstable Release Hit http://localhost:8080 unstable Release.gpg -Hit http://localhost:8080 unstable/main Sources -Hit http://localhost:8080 unstable/main amd64 Packages -Hit http://localhost:8080 unstable/main Translation-en -Reading package lists..." - +Reading package lists...' find aptarchive -name 'InRelease' -delete - -echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex +echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest - -echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex +echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest -# no Release.gpg or InRelease -msgmsg "Release only" +msgmsg 'Release only' EXPECT="Ign http://localhost:8080 unstable InRelease 404 Not Found Hit http://localhost:8080 unstable Release Ign http://localhost:8080 unstable Release.gpg 404 Not Found -Hit http://localhost:8080 unstable/main Sources -Hit http://localhost:8080 unstable/main amd64 Packages -Hit http://localhost:8080 unstable/main Translation-en Reading package lists... W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated." +find aptarchive -name 'Release.gpg' -delete +echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'warning' +echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'warning' + + +# make the release file old +find aptarchive -name '*Release' -exec sed -i \ + -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \ + -e '/^Valid-Until: / d' -e "/^Date: / a\ +Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \; +signreleasefiles + +msgmsg 'expired InRelease' +EXPECT='Hit http://localhost:8080 unstable InRelease +E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied.' +echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'failure' +echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'failure' + +msgmsg 'expired Release/Release.gpg' +EXPECT='Ign http://localhost:8080 unstable InRelease + 404 Not Found +Hit http://localhost:8080 unstable Release +Hit http://localhost:8080 unstable Release.gpg +E: Release file for http://localhost:8080/dists/unstable/Release.gpg is expired (invalid since). Updates for this repository will not be applied.' +find aptarchive -name 'InRelease' -delete +echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'failure' +echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'failure' +msgmsg 'expired Release only' +EXPECT="Ign http://localhost:8080 unstable InRelease + 404 Not Found +Hit http://localhost:8080 unstable Release +Ign http://localhost:8080 unstable Release.gpg + 404 Not Found +W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated. +E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied." find aptarchive -name 'Release.gpg' -delete +echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'failure' 'warning' +echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'failure' 'warning' -echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex -runtest "true" -echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex -runtest "true" +msgmsg 'no Release at all' +EXPECT="Ign http://localhost:8080 unstable InRelease + 404 Not Found +Ign http://localhost:8080 unstable Release + 404 Not Found +Hit http://localhost:8080 unstable/main Sources +Hit http://localhost:8080 unstable/main amd64 Packages +Hit http://localhost:8080 unstable/main Translation-en +Reading package lists... +W: The repository 'http://localhost:8080 unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." +find aptarchive -name '*Release*' -delete +echo 'Acquire::GzipIndexes "0"; +Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'warning' +echo 'Acquire::GzipIndexes "1"; +Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex +runtest 'warning' diff --git a/test/integration/test-apt-update-not-modified b/test/integration/test-apt-update-not-modified new file mode 100755 index 000000000..2dc56e76c --- /dev/null +++ b/test/integration/test-apt-update-not-modified @@ -0,0 +1,45 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' 'i386' + +insertpackage 'unstable' 'apt' 'all' '1.0' + +setupaptarchive --no-update + +methodtest() { + msgmsg 'Test with' "$1" + rm -rf rootdir/var/lib/apt/lists + # get our cache populated + testsuccess aptget update + listcurrentlistsdirectory > listsdir.lst + + # hit again with a good cache + testsuccessequal "Hit $1 unstable InRelease +Reading package lists..." aptget update + testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + + # drop an architecture, which means the file should be gone now + configarchitecture 'i386' + sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst + testsuccessequal "Hit $1 unstable InRelease +Reading package lists..." aptget update + testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" + + # readd arch so its downloaded again + configarchitecture 'amd64' 'i386' + testsuccessequal "Hit $1 unstable InRelease +Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] +Reading package lists..." aptget update + testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" +} + +changetowebserver +methodtest 'http://localhost:8080' + +changetohttpswebserver +methodtest 'https://localhost:4433' diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index b325733ac..f028ac0c7 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -59,6 +59,13 @@ testsetup() { } testsetup 'file' + changetowebserver +webserverconfig 'aptwebserver::support::modified-since' 'false' "$1" +webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also + testsetup 'http' +changetohttpswebserver + +testsetup 'https' diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index 384c8b113..ca2378c19 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -22,9 +22,6 @@ testrun() { # check that I-M-S header is kept in redirections testsuccessequal "Hit $1 unstable InRelease -Hit $1 unstable/main Sources -Hit $1 unstable/main amd64 Packages -Hit $1 unstable/main Translation-en Reading package lists..." aptget update msgtest 'Test redirection works in' 'package download' diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 4de07f1ad..5e759e50e 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -14,16 +14,7 @@ changetowebserver PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')" wasmergeused() { - msgtest 'Test for successful execution of' "$*" - local OUTPUT=$(mktemp) - addtrap "rm $OUTPUT;" - if aptget update "$@" >${OUTPUT} 2>&1; then - msgpass - else - echo - cat $OUTPUT - msgfail - fi + testsuccess aptget update "$@" msgtest 'No intermediate patch files' 'still exist' local EDS="$(find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*')" @@ -36,7 +27,7 @@ wasmergeused() { fi msgtest 'Check if the right pdiff merger was used' - if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' $OUTPUT; then + if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' rootdir/tmp/testsuccess.output; then if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then msgpass else @@ -96,6 +87,8 @@ SHA256-Patches: msgmsg "Testcase: index is already up-to-date: $*" find rootdir/var/lib/apt/lists -name '*diff_Index' -type f -delete testsuccess aptget update "$@" + testequal 'Hit http://localhost:8080 InRelease +Reading package lists...' aptget update "$@" -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Diffs=0 testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 86d5c06f0..6a411e24e 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -96,9 +96,12 @@ static void addFileHeaders(std::list &headers, FileFd &data)/*{{{*/ contentlength << "Content-Length: " << data.FileSize(); headers.push_back(contentlength.str()); } - std::string lastmodified("Last-Modified: "); - lastmodified.append(TimeRFC1123(data.ModificationTime())); - headers.push_back(lastmodified); + if (_config->FindB("aptwebserver::support::last-modified", true) == true) + { + std::string lastmodified("Last-Modified: "); + lastmodified.append(TimeRFC1123(data.ModificationTime())); + headers.push_back(lastmodified); + } } /*}}}*/ static void addDataHeaders(std::list &headers, std::string &data)/*{{{*/ -- cgit v1.2.3 From 6c9937da76b9155d166092b9dda22d06200510c1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 22 Apr 2015 12:06:40 +0200 Subject: remove "first package seen is native package" assumption The fix for #777760 causes packages of foreign (and the native) architectures, to be created correctly, but invalidates (like the previously existing, but policy-forbidden architecture-less packages we had to support for some upgrade scenarios) the assumption that the first (and only) package in the cache for a single architecture system must be the package for the native architecture (as, where should the other architectures come from, right? Wrong.). Depending on the order of parsing sources more or less packages can be effected by this. The effects are strange (for apt it mostly effects simulation/debug output, but also apt-mark on these specific packages), which complicates debugging, but relatively harmless if understood as most actions do not need direct named access to packages. The problem is fixed by removing the single-arch special casing in the paths who had them (Cache.FindPkg), so they use the same code as multi-arch systems, which use them as a wrapper for Grp.FindPkg. Note that single-arch system code was using Grp.FindPkg before as well if a Grp structure was handily available, so we don't introduce new untested code here: We remove more brittle special cases which are less tested instead (this was planed to be done for Stretch anyhow). Note further that the method with the assumption itself isn't fixed. As it is a private method I opted for declaring it deprecated instead and remove all its call positions. As it is private no-one can call this method legally (thanks to how c++ works by default its still an exported symbol through) and fixing it basically means reimplementing code we already have in Grp.FindPkg. Removing rather than fixing seems hence like a good solution. Closes: 782777 Thanks: Axel Beckert for testing --- .../test-bug-782777-single-arch-weirdness | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 test/integration/test-bug-782777-single-arch-weirdness (limited to 'test') diff --git a/test/integration/test-bug-782777-single-arch-weirdness b/test/integration/test-bug-782777-single-arch-weirdness new file mode 100755 index 000000000..004903385 --- /dev/null +++ b/test/integration/test-bug-782777-single-arch-weirdness @@ -0,0 +1,72 @@ +#!/bin/sh +# Ensure that the order in which packages are in the binary cache +# does not effect if they can be found or not +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +insertpackage 'unstable' 'abar' 'i386' '1' +insertpackage 'unstable' 'foobar' 'i386' '1' 'Depends: abar:amd64, zfoo:amd64' +insertpackage 'unstable' 'zfoo' 'i386' '1' + +setupaptarchive + +testrun() { + rm -f rootdir/var/lib/apt/extended_states + + testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + abar zfoo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst abar (1 unstable [i386]) +Inst zfoo (1 unstable [i386]) +Conf abar (1 unstable [i386]) +Conf zfoo (1 unstable [i386])' aptget install abar zfoo -s + + testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + abar zfoo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst abar (1 unstable [i386]) +Inst zfoo (1 unstable [i386]) +Conf abar (1 unstable [i386]) +Conf zfoo (1 unstable [i386])' aptget install abar:i386 zfoo:i386 -s + + testequal "Reading package lists... +Building dependency tree... +Package abar:amd64 is not available, but is referred to by another package. +This may mean that the package is missing, has been obsoleted, or +is only available from another source + +Package zfoo:amd64 is not available, but is referred to by another package. +This may mean that the package is missing, has been obsoleted, or +is only available from another source + +E: Package 'abar:amd64' has no installation candidate +E: Package 'zfoo:amd64' has no installation candidate" aptget install abar:amd64 zfoo:amd64 -s + + cp -f rootdir/var/lib/dpkg/status status.backup + insertinstalledpackage 'abar' 'i386' '1' + insertinstalledpackage 'zfoo' 'i386' '1' + + testequal 'abar +zfoo' aptmark showmanual abar zfoo + testequal 'abar set to automatically installed. +zfoo set to automatically installed.' aptmark auto abar zfoo + testempty aptmark showmanual abar zfoo + testequal 'abar +zfoo' aptmark showauto abar zfoo + + mv -f status.backup rootdir/var/lib/dpkg/status +} + +msgmsg 'Single-Arch testrun' +testrun +msgmsg 'Multi-Arch testrun' +configarchitecture 'i386' 'amd64' +testrun -- cgit v1.2.3 From 146f7715a9f36d246b461255b3c683b479296915 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 27 Apr 2015 10:59:27 +0200 Subject: improve partial/ cleanup in abort and failure cases Especially pdiff-enhanced downloads have the tendency to fail for various reasons from which we can recover and even a successful download used to leave the old unpatched index in partial/. By adding a new method responsible for making the transaction of an individual file happen we can at specialisations especially for abort cases to deal with the cleanup. This also helps in keeping the compressed indexes around if another index failed instead of keeping the decompressed files, which we wouldn't pick up in the next call. --- test/integration/framework | 6 +++++- test/integration/test-apt-update-expected-size | 2 +- test/integration/test-partial-file-support | 23 +++++++++++------------ test/integration/test-pdiff-usage | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 4229ae162..7564a0faf 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1523,9 +1523,13 @@ aptautotest_aptget_update() { testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" # all copied files are properly chmodded - for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f ! -name 'lock'); do + for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock'); do testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" done + if [ "$1" = 'testsuccess' ]; then + # failure cases can retain partial files and such + testempty find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) + fi } aptautotest_apt_update() { aptautotest_aptget_update "$@"; } aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 9f58308aa..7efccaa57 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -34,7 +34,7 @@ test_packagestoobig() { done NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" testfailuremsg "W: Failed to fetch ${1}/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) -E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=0 +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::Transaction=0 } methodtest() { diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support index b6b305d25..85046b3eb 100755 --- a/test/integration/test-partial-file-support +++ b/test/integration/test-partial-file-support @@ -126,18 +126,17 @@ testrun() { testwebserverlaststatuscode '200' "$DOWNLOADLOG" } -msgmsg 'http: Test with Content-Length' -webserverconfig 'aptwebserver::chunked-transfer-encoding' 'false' -testrun 'http://localhost:8080' -msgmsg 'http: Test with Transfer-Encoding: chunked' -webserverconfig 'aptwebserver::chunked-transfer-encoding' 'true' -testrun 'http://localhost:8080' +serverconfigs() { + msgmsg "${1%%:*}: Test with Content-Length" + webserverconfig 'aptwebserver::chunked-transfer-encoding' 'false' + testrun "$1" + msgmsg "${1%%:*}: Test with Transfer-Encoding: chunked" + webserverconfig 'aptwebserver::chunked-transfer-encoding' 'true' + testrun "$1" +} + +serverconfigs 'http://localhost:8080' changetohttpswebserver -msgmsg 'https: Test with Content-Length' -webserverconfig 'aptwebserver::chunked-transfer-encoding' 'false' -testrun 'https://localhost:4433' -msgmsg 'https: Test with Transfer-Encoding: chunked' -webserverconfig 'aptwebserver::chunked-transfer-encoding' 'true' -testrun 'https://localhost:4433' +serverconfigs 'https://localhost:4433' diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 5e759e50e..7d72a6944 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -47,7 +47,7 @@ testrun() { compressfile 'aptarchive/Packages' generatereleasefiles signreleasefiles - rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists + rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak testsuccess aptget update "$@" cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak testnopackage newstuff -- cgit v1.2.3 From f492283b4369ed0711f5f538b6d5fe61a8a75a0f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 28 Apr 2015 15:06:12 +0200 Subject: do not require installed libapt-pkg-dev for gtest Git-Dch: Ignore --- test/libapt/makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/libapt/makefile b/test/libapt/makefile index 0f8df291f..61a8aaf31 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -8,7 +8,7 @@ APT_DOMAIN=none include ../../buildlib/defaults.mak .PHONY: test -ifeq (file-okay,$(shell $(CC) -M gtest_runner.cc >/dev/null 2>&1 && echo 'file-okay')) +ifeq (file-okay,$(shell $(CC) -I $(BASE)/build/include -M gtest_runner.cc >/dev/null 2>&1 && echo 'file-okay')) test: $(BIN)/gtest$(BASENAME) MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=$(LIB) $(BIN)/gtest$(BASENAME) @@ -78,5 +78,6 @@ test: @echo "APT uses Googles C++ testing framework for its unit tests" @echo "On Debian systems this is available in the 'libgtest-dev' package." @echo "Please install it before attempting to run the unit tests." + $(CC) -I $(BASE)/build/include -M gtest_runner.cc exit 100 endif -- cgit v1.2.3 From 3f732aa6ad0a81b6a6942a61fd5ed26a26590e8e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 28 Apr 2015 23:42:03 +0200 Subject: a pin of 1000 always means downgrade allowed The documentation says this, but the code only agreed while evaluating specific packages, but not generics. These needed a pin above 1000 to have the same effect. The code causing this makes references to a 'second pesduo status file', but nowhere is explained what this might stand for and/or what it was, so we do the only reasonable thing: Remove all references and do as documented. --- .../test-bug-543966-downgrade-below-1000-pin | 84 +++++++++++--------- test/integration/test-policy-pinning | 92 ++++++++++------------ 2 files changed, 86 insertions(+), 90 deletions(-) (limited to 'test') diff --git a/test/integration/test-bug-543966-downgrade-below-1000-pin b/test/integration/test-bug-543966-downgrade-below-1000-pin index d37539b9f..485df999c 100755 --- a/test/integration/test-bug-543966-downgrade-below-1000-pin +++ b/test/integration/test-bug-543966-downgrade-below-1000-pin @@ -24,58 +24,66 @@ testsuccessequal "base-files: 5.0.0 0 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=0 -echo 'Package: base-files +writepin() { + echo "Package: $1 Pin: release a=unstable -Pin-Priority: 99' > rootdir/etc/apt/preferences +Pin-Priority: $2" > rootdir/etc/apt/preferences +} -testsuccessequal "base-files: + + +testpinning() { + local PKGPIN='' + local PKGPINPRIO='0' + local REPPINPRIO='' + if [ "$1" != '*' ]; then + PKGPINPRIO='' + REPPINPRIO=' 500' + PKGPIN='Package pin: 5.0.0 + ' + fi + writepin "$1" '99' + testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 - Package pin: 5.0.0 - Version table: - *** 5.0.0-1 99 + ${PKGPIN}Version table: + *** 5.0.0-1 ${PKGPINPRIO:-99} 100 $STATUS - 5.0.0 99 - 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99 + 5.0.0 ${PKGPINPRIO:-99} + ${REPPINPRIO:- 99} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99 -echo 'Package: base-files -Pin: release a=unstable -Pin-Priority: 100' > rootdir/etc/apt/preferences - -testsuccessequal "base-files: + writepin "$1" '100' + testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 - Package pin: 5.0.0 - Version table: - *** 5.0.0-1 100 + ${PKGPIN}Version table: + *** 5.0.0-1 ${PKGPINPRIO:-100} 100 $STATUS - 5.0.0 100 - 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100 + 5.0.0 ${PKGPINPRIO:-100} + ${REPPINPRIO:- 100} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100 -echo 'Package: base-files -Pin: release a=unstable -Pin-Priority: 999' > rootdir/etc/apt/preferences - -testsuccessequal "base-files: + writepin "$1" '999' + testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 - Package pin: 5.0.0 - Version table: - *** 5.0.0-1 999 + ${PKGPIN}Version table: + *** 5.0.0-1 ${PKGPINPRIO:-999} 100 $STATUS - 5.0.0 999 - 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999 - -echo 'Package: base-files -Pin: release a=unstable -Pin-Priority: 1000' > rootdir/etc/apt/preferences + 5.0.0 ${PKGPINPRIO:-999} + ${REPPINPRIO:- 999} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999 -testsuccessequal "base-files: + writepin "$1" '1000' + testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0 - Package pin: 5.0.0 - Version table: - *** 5.0.0-1 1000 + ${PKGPIN}Version table: + *** 5.0.0-1 ${PKGPINPRIO:-1000} 100 $STATUS - 5.0.0 1000 - 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=1000 + 5.0.0 ${PKGPINPRIO:-1000} + ${REPPINPRIO:-1000} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=1000 +} + +msgmsg 'Tests with generic-form pin' +testpinning '*' +msgmsg 'Tests with specific-form pin' +testpinning 'base-files' diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning index 15bf300ac..2675b51bc 100755 --- a/test/integration/test-policy-pinning +++ b/test/integration/test-policy-pinning @@ -25,70 +25,58 @@ testequalpolicy() { Pinned packages:" aptcache policy $* } -aptgetupdate() { - # just to be sure that no old files are used - rm -rf rootdir/var/lib/apt - if aptget update --allow-insecure-repositories -qq 2>&1 | grep '^E: '; then - msgwarn 'apt-get update failed with an error' - fi -} +testglobalpolicy() { + aptgetupdate -### not signed archive + testequalpolicy 100 500 + testequalpolicy 990 500 -t now -aptgetupdate + sed -i aptarchive/Release -e 1i"NotAutomatic: yes" + aptgetupdate -testequalpolicy 100 500 -testequalpolicy 990 500 -t now + testequalpolicy 100 1 -o Test=NotAutomatic + testequalpolicy 990 1 -o Test=NotAutomatic -t now -sed -i aptarchive/Release -e 1i"NotAutomatic: yes" -aptgetupdate + sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes" + aptgetupdate -testequalpolicy 100 1 -o Test=NotAutomatic -testequalpolicy 990 1 -o Test=NotAutomatic -t now + testequalpolicy 100 100 -o Test=ButAutomaticUpgrades + testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now -sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes" -aptgetupdate + sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d' + aptgetupdate -testequalpolicy 100 100 -o Test=ButAutomaticUpgrades -testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now + testequalpolicy 100 500 -o Test=Automatic + testequalpolicy 990 500 -o Test=Automatic -t now -sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d' -aptgetupdate - -testequalpolicy 100 500 -o Test=Automatic -testequalpolicy 990 500 -o Test=Automatic -t now - -sed -i aptarchive/Release -e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d' - -### signed but no key in trusted - -signreleasefiles 'Marvin Paranoid' -aptgetupdate -testequalpolicy 100 500 -testequalpolicy 990 500 -t now - -sed -i aptarchive/Release -e 1i"NotAutomatic: yes" -signreleasefiles 'Marvin Paranoid' -aptgetupdate - -testequalpolicy 100 1 -o Test=NotAutomatic -testequalpolicy 990 1 -o Test=NotAutomatic -t now - -sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes" -signreleasefiles 'Marvin Paranoid' -aptgetupdate + sed -i aptarchive/Release -e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d' +} -testequalpolicy 100 100 -o Test=ButAutomaticUpgrades -testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now +msgmsg 'Test with not signed archive' +aptgetupdate() { + rm -rf rootdir/var/lib/apt + testwarning aptget update --allow-insecure-repositories +} +testglobalpolicy -sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d' -signreleasefiles 'Marvin Paranoid' -aptgetupdate +msgmsg 'Test with signed but no key in trusted' +aptgetupdate() { + rm -rf rootdir/var/lib/apt + signreleasefiles 'Marvin Paranoid' + testwarning aptget update --allow-insecure-repositories +} +testglobalpolicy -testequalpolicy 100 500 -o Test=Automatic -testequalpolicy 990 500 -o Test=Automatic -t now +# much the same tests will be executed below in more detail again for this one +msgmsg 'Test with signed and valid key' +aptgetupdate() { + rm -rf rootdir/var/lib/apt + signreleasefiles 'Joe Sixpack' + testsuccess aptget update +} +testglobalpolicy -### signed and valid key +msgmsg 'Test with specific packages' buildsimplenativepackage "coolstuff" "all" "1.0" "stable" buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports" -- cgit v1.2.3 From ab640001ee772fa27ee789f6717805f9d46d5bce Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 28 Apr 2015 23:59:00 +0200 Subject: remove unused and strange default-value for pins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the pin for a generic pin is 0, it get a value by strange looking rules, if the pin is specific the rules are at least not strange, but the value 989 is a magic number without any direct meaning… but both never happens in practice as the parsing skips such entries with a warning, so there always is a priority != 0 and the code therefore never used. --- test/integration/test-bug-543966-downgrade-below-1000-pin | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/integration/test-bug-543966-downgrade-below-1000-pin b/test/integration/test-bug-543966-downgrade-below-1000-pin index 485df999c..e59231608 100755 --- a/test/integration/test-bug-543966-downgrade-below-1000-pin +++ b/test/integration/test-bug-543966-downgrade-below-1000-pin @@ -87,3 +87,7 @@ msgmsg 'Tests with generic-form pin' testpinning '*' msgmsg 'Tests with specific-form pin' testpinning 'base-files' +msgmsg 'Tests with specific-form pin with glob' +testpinning 'base-fil*' +msgmsg 'Tests with specific-form pin with regex' +testpinning '/^base-f[iI]les$/' -- cgit v1.2.3 From 41fadd29f136627fb5c9e733130b2a57c49fafaf Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 29 Apr 2015 10:55:08 +0200 Subject: remove available file to have same dpkg -l behavior dpkg -l < 1.16.2 loads the available file and hence sees a package which later versions do not see, leading to failures on travis-ci. The different versions also have slightly different messages. Git-Dch: Ignore --- test/integration/test-ubuntu-bug-761175-remove-purge | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-ubuntu-bug-761175-remove-purge b/test/integration/test-ubuntu-bug-761175-remove-purge index c2e2aadf1..d5dfa2acf 100755 --- a/test/integration/test-ubuntu-bug-761175-remove-purge +++ b/test/integration/test-ubuntu-bug-761175-remove-purge @@ -39,7 +39,8 @@ The following packages will be REMOVED: 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Purg compiz-core-$1" aptget purge compiz-core-$1 -s testsuccess aptget purge compiz-core-$1 -y - testfailureequal "dpkg-query: no packages found matching compiz-core-$1" dpkg -l compiz-core-$1 + echo -n '' > rootdir/var/lib/dpkg/available # dpkg -l < 1.16.2 reads the available file by default, where the package can be found + testequalor2 "dpkg-query: no packages found matching compiz-core-$1" "No packages found matching compiz-core-$1." dpkg -l compiz-core-$1 } msgmsg 'Test in multi arch environment' -- cgit v1.2.3 From e8fb1cdfdd13e45f2b3abbd57a28b57ae6137f14 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 9 May 2015 18:55:41 +0200 Subject: sync TFRewrite*Order arrays with dpkg and dak dpkg and dak know various field names and order them in their output, while we have yet another order and have to play catch up with them as we are sitting between chairs here and neither order is ideal for us, too. A little testcase is from now on supposed to help ensureing that we do not derivate to far away from which fields dpkg knows and orders. --- test/integration/framework | 1 + test/integration/test-apt-ftparchive-cachedb | 6 +- .../test-apt-ftparchive-cachedb-lp1274466 | 6 +- test/integration/test-apt-ftparchive-src-cachedb | 18 ++--- test/integration/test-apt-tagfile-fields-order | 82 ++++++++++++++++++++++ 5 files changed, 98 insertions(+), 15 deletions(-) create mode 100755 test/integration/test-apt-tagfile-fields-order (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 7564a0faf..03c188189 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -189,6 +189,7 @@ setupenvironment() { TESTDIRECTORY=$(readlink -f $(dirname $0)) # allow overriding the default BUILDDIR location + SOURCEDIRECTORY=${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"} BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"} LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"} METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"} diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index 3454ee36a..962095320 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -3,12 +3,12 @@ set -e ensure_correct_packages_file() { testequal "Package: foo +Architecture: i386 +Version: 1 Priority: optional Section: others -$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##') Maintainer: Joe Sixpack -Architecture: i386 -Version: 1 +$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##') Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages } diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466 index 1f86e367f..8b768441a 100755 --- a/test/integration/test-apt-ftparchive-cachedb-lp1274466 +++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466 @@ -27,12 +27,12 @@ testfailure grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc # regression test for corruption with previous generation of cachedb testsuccessequal "Package: foo +Architecture: i386 +Version: 1 Priority: optional Section: others -Installed-Size: 29 Maintainer: Joe Sixpack -Architecture: i386 -Version: 1 +Installed-Size: 29 Filename: ./foo_1_i386.deb Size: 1270 MD5sum: 85d0e908c1a897700e2c5dea72d7e3c0 diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 2a361ecc0..66a3b7845 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -3,16 +3,16 @@ set -e assert_correct_sources_file() { testsuccessequal "Package: bar +Format: 3.0 (native) +Binary: bar Architecture: all Version: 1.0 -Binary: bar -Format: 3.0 (native) Directory: pool/main +Package-List: + bar deb admin extra Files: 7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz -Package-List: - bar deb admin extra Checksums-Sha1: 17a40b76715f393ab7fd6485c9392a02f1adf903 406 bar_1.0.dsc da39a3ee5e6b4b0d3255bfef95601890afd80709 0 bar_1.0.tar.gz @@ -24,16 +24,16 @@ Checksums-Sha512: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz Package: foo +Format: 3.0 (native) +Binary: foo Architecture: all Version: 1.0 -Binary: foo -Format: 3.0 (native) Directory: pool/main +Package-List: + foo deb admin extra Files: d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz -Package-List: - foo deb admin extra Checksums-Sha1: 979306aa3ccff3d61bba062bb6977e2493c6f907 171 foo_1.0.dsc da39a3ee5e6b4b0d3255bfef95601890afd80709 0 foo_1.0.tar.gz @@ -43,7 +43,7 @@ Checksums-Sha256: Checksums-Sha512: 3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz -" aptsortpkgs ./aptarchive/dists/test/main/source/Sources +" aptsortpkgs ./aptarchive/dists/test/main/source/Sources -o APT::SortPkgs::Source=true } create_source_files() { diff --git a/test/integration/test-apt-tagfile-fields-order b/test/integration/test-apt-tagfile-fields-order new file mode 100755 index 000000000..27d5c14ff --- /dev/null +++ b/test/integration/test-apt-tagfile-fields-order @@ -0,0 +1,82 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment + +dpkg_field_ordered_list() { + local FIELDS="$(perl -e " +use Dpkg::Control; +use Dpkg::Control::Fields; +foreach \$f (field_ordered_list(${1})) { + print \"\$f\\n\"; +}" | sort -u)" + if [ -z "$FIELDS" ]; then + msgfail 'Could not get fields via libdpkg-perl' + fi + echo "$FIELDS" +} + +comparelsts() { + local DIFFOUTPUT="$(diff -u apt.lst dpkg.lst || true)" + if echo "$DIFFOUTPUT" | grep -q '^+[^+]'; then + echo + echo "$DIFFOUTPUT" | grep '^[+-][^+-]' + msgfail + else + msgpass + fi +} + +msgtest 'Check that apt knows all fields dpkg orders in' 'Packages' +dpkg_field_ordered_list 'CTRL_INDEX_PKG' > dpkg.lst +sed -ne 's#^ "\(.*\)",.*$#\1#p' ${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c | sed -n '/^Package$/,/^Package$/ p' | head -n -1 | sort -u > apt.lst +comparelsts + +msgtest 'Check that apt knows all fields dpkg orders in' 'status' +dpkg_field_ordered_list 'CTRL_FILE_STATUS' > dpkg.lst +comparelsts + +msgtest 'Check that apt knows all fields dpkg orders in' 'DEBIAN/control' +dpkg_field_ordered_list 'CTRL_PKG_DEB' > dpkg.lst +comparelsts + +msgtest 'Check that apt knows all fields dpkg orders in' 'Sources' +dpkg_field_ordered_list 'CTRL_INDEX_SRC' > dpkg.lst +echo 'Package' > apt.tmp +sed -ne 's#^ "\(.*\)",.*$#\1#p' ${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c | sed '/^Package$/,/^Package$/ d' >> apt.tmp +sort -u apt.tmp > apt.lst +comparelsts + +msgtest 'Check that apt knows all fields dpkg orders in' 'dsc' +dpkg_field_ordered_list 'CTRL_PKG_SRC' > dpkg.lst +comparelsts + +# HACK, but there is no good way to acquire sources in tests and/or to remember to run this regular manually +if [ "$USER" = 'david' ]; then + msgtest 'Check if we have somewhere the sources of' 'dpkg' + DPKGSOURCE="$(locate dpkg/lib/dpkg/parse.c | head -n 1 || true)" + if [ -z "$DPKGSOURCE" ]; then + msgskip 'Not found' + else + msgpass + msgtest 'Check that apt knows about all fields' 'dpkg parses' + sed -n 's#^.*FIELD("\(.*\)").*$#\1#p' "${DPKGSOURCE}" | sort -u > dpkg.lst + sed -ne 's#^ "\(.*\)",.*$#\1#p' ${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c | sed -n '/^Package$/,/^Package$/ p' | head -n -1 | sort -u > apt.lst + comparelsts + fi + + msgtest 'Check if we have somewhere the sources of' 'dak' + DAKSOURCE="$(locate dak/setup/core-init.d/080_metadatakeys | head -n 1 || true)" + if [ -z "$DAKSOURCE" ]; then + msgskip 'Not found' + else + msgpass + msgtest 'Check that apt knows about all fields' 'dak knows' + # dak mixes both, so we can only check with the mixed one as well + sed -ne "s#^.* VALUES ('\(.*\)', \(.*\)).*\$#\1 \2#p" "${DAKSOURCE}" | cut -d ' ' -f 1 | sort -u > dpkg.lst + sed -ne 's#^ "\(.*\)",.*$#\1#p' ${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c | sort -u > apt.lst + comparelsts + fi +fi -- cgit v1.2.3 From 8d058ea53b18348f81229049a27d14282bd8d8c1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 10 May 2015 22:53:15 +0200 Subject: implement a more c++-style TFRewrite alternative TFRewrite is okay, but it has obscure limitations (256 Tags), even more obscure bugs (order for renames is defined by the old name) and the interface is very c-style encouraging bad usage like we do it in apt-ftparchive passing massive amounts of c_str() from std::string in. The old-style is marked as deprecated accordingly. The next commit will fix all places in the apt code to not use the old-style anymore. --- test/libapt/tagfile_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc index df618ea16..d7030f41a 100644 --- a/test/libapt/tagfile_test.cc +++ b/test/libapt/tagfile_test.cc @@ -34,6 +34,12 @@ TEST(TagFileTest,SingleField) EXPECT_FALSE(section.Exists("FieldB-12345678")); // There is only one section in this tag file EXPECT_FALSE(tfile.Step(section)); + + // Now we scan an empty section to test reset + ASSERT_TRUE(section.Scan("\n\n", 2, true)); + EXPECT_EQ(0, section.Count()); + EXPECT_FALSE(section.Exists("FieldA-12345678")); + EXPECT_FALSE(section.Exists("FieldB-12345678")); } TEST(TagFileTest,MultipleSections) -- cgit v1.2.3 From 88593886a42025d51d76051da5929b044e42efee Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 11 May 2015 15:08:08 +0200 Subject: rewrite all TFRewrite instances to use the new pkgTagSection::Write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While it is mostly busywork to rewrite all instances it actually fixes bugs as the data storage used by the new method is std::string rather than a char*, the later mostly created by c_str() from a std::string which the caller has to ensure keeps in scope – something apt-ftparchive actually didn't ensure and relied on copy-on-write behavior instead which c++11 forbids and hence the new default gcc abi doesn't use it. --- test/integration/test-apt-cli-show | 4 +- test/libapt/indexcopytosourcelist_test.cc | 2 +- test/libapt/tagsection_test.cc | 270 ++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+), 3 deletions(-) create mode 100644 test/libapt/tagsection_test.cc (limited to 'test') diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index 5604620fd..43072cf03 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -25,11 +25,11 @@ APTARCHIVE=$(readlink -f ./aptarchive) # note that we do not display Description-md5 with the "apt" cmd # and also show some additional fields that are calculated testsuccessequal "Package: foo +Version: 1.0 Priority: optional Section: other -Installed-Size: 43.0 kB Maintainer: Joe Sixpack -Version: 1.0 +Installed-Size: 43.0 kB Download-Size: unknown APT-Manual-Installed: yes APT-Sources: file:$APTARCHIVE/ unstable/main i386 Packages diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc index bec87601f..1b0427564 100644 --- a/test/libapt/indexcopytosourcelist_test.cc +++ b/test/libapt/indexcopytosourcelist_test.cc @@ -16,7 +16,7 @@ class NoCopy : public IndexCopy { return Path; } bool GetFile(std::string &/*Filename*/, unsigned long long &/*Size*/) { return false; } - bool RewriteEntry(FILE * /*Target*/, std::string /*File*/) { return false; } + bool RewriteEntry(FileFd & /*Target*/, std::string const &/*File*/) { return false; } const char *GetFileName() { return NULL; } const char *Type() { return NULL; } diff --git a/test/libapt/tagsection_test.cc b/test/libapt/tagsection_test.cc new file mode 100644 index 000000000..f250177af --- /dev/null +++ b/test/libapt/tagsection_test.cc @@ -0,0 +1,270 @@ +#include + +#include +#include + +#include +#include + +#include + +#include "file-helpers.h" + +std::string packageValue = "aaaa"; +std::string typoValue = "aa\n" + " .\n" + " cc"; +std::string typoRawValue = "\n " + typoValue; +std::string overrideValue = "1"; +/* + std::cerr << "FILECONTENT: »"; + char buffer[3000]; + while (fd.ReadLine(buffer, sizeof(buffer))) + std::cerr << buffer; + std::cerr << "«" << std::endl;; +*/ + +void setupTestcaseStart(FileFd &fd, pkgTagSection §ion, std::string &content) +{ + createTemporaryFile("writesection", fd, NULL, NULL); + content = "Package: " + packageValue + "\n" + "TypoA:\n " + typoValue + "\n" + "Override: " + overrideValue + "\n" + "Override-Backup: " + overrideValue + "\n" + "\n"; + EXPECT_TRUE(section.Scan(content.c_str(), content.length(), true)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("TypoA")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(typoValue, section.FindS("TypoA")); + EXPECT_EQ(typoRawValue, section.FindRawS("TypoA")); + EXPECT_EQ(1, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} +TEST(TagSectionTest,WriteUnmodified) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + EXPECT_TRUE(section.Write(fd)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("TypoA")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(typoValue, section.FindS("TypoA")); + EXPECT_EQ(1, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} +TEST(TagSectionTest,WriteUnmodifiedOrder) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + char const * const order[] = { "Package", "TypoA", "Override", NULL }; + EXPECT_TRUE(section.Write(fd, order)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("TypoA")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(typoValue, section.FindS("TypoA")); + EXPECT_EQ(1, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} +TEST(TagSectionTest,WriteUnmodifiedOrderReversed) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + char const * const order[] = { "Override", "TypoA", "Package", NULL }; + EXPECT_TRUE(section.Write(fd, order)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("TypoA")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(typoValue, section.FindS("TypoA")); + EXPECT_EQ(1, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} +TEST(TagSectionTest,WriteUnmodifiedOrderNotAll) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + char const * const order[] = { "Override", NULL }; + EXPECT_TRUE(section.Write(fd, order)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("TypoA")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(typoValue, section.FindS("TypoA")); + EXPECT_EQ(1, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} +TEST(TagSectionTest,WriteNoOrderRename) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + std::vector rewrite; + rewrite.push_back(pkgTagSection::Tag::Rename("TypoA", "TypoB")); + EXPECT_TRUE(section.Write(fd, NULL, rewrite)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_FALSE(section.Exists("TypoA")); + EXPECT_TRUE(section.Exists("TypoB")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(typoValue, section.FindS("TypoB")); + EXPECT_EQ(1, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} +TEST(TagSectionTest,WriteNoOrderRemove) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + std::vector rewrite; + rewrite.push_back(pkgTagSection::Tag::Remove("TypoA")); + rewrite.push_back(pkgTagSection::Tag::Rewrite("Override", "")); + EXPECT_TRUE(section.Write(fd, NULL, rewrite)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_FALSE(section.Exists("TypoA")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_FALSE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(2, section.Count()); +} +TEST(TagSectionTest,WriteNoOrderRewrite) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + std::vector rewrite; + rewrite.push_back(pkgTagSection::Tag::Rewrite("Override", "42")); + EXPECT_TRUE(section.Write(fd, NULL, rewrite)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("TypoA")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(42, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} +TEST(TagSectionTest,WriteOrderRename) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + std::vector rewrite; + rewrite.push_back(pkgTagSection::Tag::Rename("TypoA", "TypoB")); + char const * const order[] = { "Package", "TypoA", "Override", NULL }; + EXPECT_TRUE(section.Write(fd, order, rewrite)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_FALSE(section.Exists("TypoA")); + EXPECT_TRUE(section.Exists("TypoB")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(typoValue, section.FindS("TypoB")); + EXPECT_EQ(1, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} +TEST(TagSectionTest,WriteOrderRemove) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + std::vector rewrite; + rewrite.push_back(pkgTagSection::Tag::Remove("TypoA")); + rewrite.push_back(pkgTagSection::Tag::Rewrite("Override", "")); + char const * const order[] = { "Package", "TypoA", "Override", NULL }; + EXPECT_TRUE(section.Write(fd, order, rewrite)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_FALSE(section.Exists("TypoA")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_FALSE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(2, section.Count()); +} +TEST(TagSectionTest,WriteOrderRewrite) +{ + FileFd fd; + pkgTagSection section; + std::string content; + setupTestcaseStart(fd, section, content); + std::vector rewrite; + rewrite.push_back(pkgTagSection::Tag::Rewrite("Override", "42")); + char const * const order[] = { "Package", "TypoA", "Override", NULL }; + EXPECT_TRUE(section.Write(fd, order, rewrite)); + EXPECT_TRUE(fd.Seek(0)); + pkgTagFile tfile(&fd); + ASSERT_TRUE(tfile.Step(section)); + EXPECT_TRUE(section.Exists("Package")); + EXPECT_TRUE(section.Exists("TypoA")); + EXPECT_FALSE(section.Exists("TypoB")); + EXPECT_TRUE(section.Exists("Override")); + EXPECT_TRUE(section.Exists("Override-Backup")); + EXPECT_EQ(packageValue, section.FindS("Package")); + EXPECT_EQ(42, section.FindI("Override")); + EXPECT_EQ(1, section.FindI("Override-Backup")); + EXPECT_EQ(4, section.Count()); +} -- cgit v1.2.3 From dcbb364fc69e1108b3fea3adb12a7ba83d9af467 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 12 May 2015 00:30:16 +0200 Subject: detect 416 complete file in partial by expected hash If we have the expected hashes we can check with them if the file we have in partial we got a 416 for is the expected file. We detected this with same-size before, but not every server sends a good Content-Range header with a 416 response. --- test/integration/framework | 2 +- test/integration/test-apt-update-transactions | 1 + test/integration/test-partial-file-support | 10 ++++++++-- test/interactive-helper/aptwebserver.cc | 9 ++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 03c188189..2a53e8365 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1128,7 +1128,7 @@ acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom downloadfile() { local PROTO="${1%%:*}" if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ - download-file "$1" "$2" 2>&1 ; then + download-file "$1" "$2" "$3" 2>&1 ; then return 1 fi # only if the file exists the download was successful diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index f028ac0c7..67dd633f9 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -63,6 +63,7 @@ testsetup 'file' changetowebserver webserverconfig 'aptwebserver::support::modified-since' 'false' "$1" webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also +webserverconfig 'aptwebserver::support::range' 'false' "$1" testsetup 'http' diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support index 85046b3eb..c07af7bd0 100755 --- a/test/integration/test-partial-file-support +++ b/test/integration/test-partial-file-support @@ -17,8 +17,8 @@ DOWNLOADLOG='rootdir/tmp/testdownloadfile.log' testdownloadfile() { rm -f "$DOWNLOADLOG" - msgtest "Testing download of file $2 with" "$1" - if ! downloadfile "$2" "$3" > "$DOWNLOADLOG"; then + msgtest "Testing download of file $2 with" "$1 $5" + if ! downloadfile "$2" "$3" "$5" > "$DOWNLOADLOG"; then cat >&2 "$DOWNLOADLOG" msgfail else @@ -78,6 +78,12 @@ followuprequest() { testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' testwebserverlaststatuscode '416' "$DOWNLOADLOG" + webserverconfig 'aptwebserver::support::content-range' 'false' + copysource $TESTFILE 1M $DOWN + testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' "SHA1:$(sha1sum "$TESTFILE" | cut -d' ' -f 1)" + testwebserverlaststatuscode '416' "$DOWNLOADLOG" + webserverconfig 'aptwebserver::support::content-range' 'true' + copysource $TESTFILE 1M $DOWN copysource "${TESTFILE}2" 20 "${DOWN}2" msgtest 'Testing download of files with' 'completely downloaded file + partial file' diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 6a411e24e..c933060e7 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -745,9 +745,12 @@ static void * handleClient(void * voidclient) /*{{{*/ } else { - std::ostringstream contentrange; - contentrange << "Content-Range: bytes */" << filesize; - headers.push_back(contentrange.str()); + if (_config->FindB("aptwebserver::support::content-range", true) == true) + { + std::ostringstream contentrange; + contentrange << "Content-Range: bytes */" << filesize; + headers.push_back(contentrange.str()); + } sendError(client, 416, *m, sendContent, "", headers); break; } -- cgit v1.2.3 From 8eafc759544298211cd0bfaa3919afc0fadd47d1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 13 May 2015 16:09:12 +0200 Subject: detect Releasefile IMS hits even if the server doesn't Not all servers we are talking to support If-Modified-Since and some are not even sending Last-Modified for us, so in an effort to detect such hits we run a hashsum check on the 'old' compared to the 'new' file, we got the hashes for the 'new' already for "free" from the methods anyway and hence just need to calculated the old ones. This allows us to detect hits even with unsupported servers, which in turn means we benefit from all the new hit behavior also here. --- test/integration/framework | 9 ++++ test/integration/test-apt-update-expected-size | 1 + test/integration/test-apt-update-not-modified | 58 +++++++++++++++++++++++++- test/integration/test-apt-update-rollback | 1 + test/integration/test-apt-update-transactions | 2 + 5 files changed, 70 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 2a53e8365..8c8936ead 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1005,6 +1005,15 @@ signreleasefiles() { msgdone "info" } +redatereleasefiles() { + local DATE="$(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')" + for release in $(find aptarchive/ -name 'Release'); do + sed -i "s/^Date: .*$/Date: ${DATE}/" $release + touch -d "$DATE" $release + done + signreleasefiles "${2:-Joe Sixpack}" +} + webserverconfig() { local WEBSERVER="${3:-http://localhost:8080}" local NOCHECK=false diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 7efccaa57..55a5da848 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -26,6 +26,7 @@ test_inreleasetoobig() { } test_packagestoobig() { + redatereleasefiles '+1hour' # append junk at the end of the Packages.gz/Packages SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" find aptarchive/dists -name 'Packages*' | while read pkg; do diff --git a/test/integration/test-apt-update-not-modified b/test/integration/test-apt-update-not-modified index 2dc56e76c..a67ecb760 100755 --- a/test/integration/test-apt-update-not-modified +++ b/test/integration/test-apt-update-not-modified @@ -12,7 +12,7 @@ insertpackage 'unstable' 'apt' 'all' '1.0' setupaptarchive --no-update methodtest() { - msgmsg 'Test with' "$1" + msgmsg 'Test InRelease with' "$1" rm -rf rootdir/var/lib/apt/lists # get our cache populated testsuccess aptget update @@ -36,6 +36,62 @@ Reading package lists..." aptget update Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] Reading package lists..." aptget update testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + + webserverconfig 'aptwebserver::support::modified-since' 'false' + webserverconfig 'aptwebserver::support::last-modified' 'false' + testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B] +Reading package lists..." aptget update + webserverconfig 'aptwebserver::support::modified-since' 'true' + webserverconfig 'aptwebserver::support::last-modified' 'true' + + msgmsg 'Test Release.gpg with' "$1" + rm -rf rootdir/var/lib/apt/lists + cp -a aptarchive/dists aptarchive/dists.good + find aptarchive/dists -name 'InRelease' -delete + # get our cache populated + testsuccess aptget update + listcurrentlistsdirectory > listsdir.lst + + # hit again with a good cache + testsuccessequal "Ign $1 unstable InRelease + 404 Not Found +Hit $1 unstable Release +Hit $1 unstable Release.gpg +Reading package lists..." aptget update + testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + + # drop an architecture, which means the file should be gone now + configarchitecture 'i386' + sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst + testsuccessequal "Ign $1 unstable InRelease + 404 Not Found +Hit $1 unstable Release +Hit $1 unstable Release.gpg +Reading package lists..." aptget update + testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" + + # readd arch so its downloaded again + configarchitecture 'amd64' 'i386' + testsuccessequal "Ign $1 unstable InRelease + 404 Not Found +Hit $1 unstable Release +Hit $1 unstable Release.gpg +Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] +Reading package lists..." aptget update + testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + + webserverconfig 'aptwebserver::support::modified-since' 'false' + webserverconfig 'aptwebserver::support::last-modified' 'false' + testsuccessequal "Ign $1 unstable InRelease + 404 Not Found +Get:1 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B] +Get:2 $1 unstable Release.gpg [$(stat -c '%s' 'aptarchive/dists/unstable/Release.gpg') B] +Reading package lists..." aptget update + webserverconfig 'aptwebserver::support::modified-since' 'true' + webserverconfig 'aptwebserver::support::last-modified' 'true' + + rm -rf aptarchive/dists + cp -a aptarchive/dists.good aptarchive/dists } changetowebserver diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index f4500b69d..29fe1ab56 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -158,6 +158,7 @@ test_inrelease_to_broken_gzip() { msgmsg "Test InRelease to broken gzip" start_with_good_inrelease + redatereleasefiles '+2hours' # append junk at the end of the compressed file echo "lala" >> $APTARCHIVE/dists/unstable/main/source/Sources.gz touch -d '+2min' $APTARCHIVE/dists/unstable/main/source/Sources.gz diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index 67dd633f9..63b318056 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -47,6 +47,7 @@ testrun() { testsetup() { msgmsg 'Test with no initial data over' "$1" + redatereleasefiles 'now' rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists/partial listcurrentlistsdirectory > listsdir.lst @@ -55,6 +56,7 @@ testsetup() { msgmsg 'Test with initial data over' "$1" testsuccess aptget update listcurrentlistsdirectory > listsdir.lst + redatereleasefiles '+1hour' testrun 'listsdir.lst' } -- cgit v1.2.3 From 6bf93605fdb8e858d3f0a79a124c1d39f760094d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 18 May 2015 22:15:06 +0200 Subject: treat older Release files than we already have as an IMSHit Valid-Until protects us from long-living downgrade attacks, but not all repositories have it and an attacker could still use older but still valid files to downgrade us. While this makes it sounds like a security improvement now, its a bit theoretical at best as an attacker with capabilities to pull this off could just as well always keep us days (but in the valid period) behind and always knows which state we have, as we tell him with the If-Modified-Since header. This is also why this is 'silently' ignored and treated as an IMSHit rather than screamed at the user as this can at best be an annoyance for attackers. An error here would 'regularily' be encountered by users by out-of-sync mirrors serving a single run (e.g. load balancer) or in two consecutive runs on the other hand, so it would just help teaching people ignore it. That said, most of the code churn is caused by enforcing this additional requirement. Crisscross from InRelease to Release.gpg is e.g. very unlikely in practice, but if we would ignore it an attacker could sidestep it this way. --- test/integration/framework | 7 +-- test/integration/test-apt-update-ims | 12 ++--- test/integration/test-apt-update-nofallback | 5 +- test/integration/test-apt-update-not-modified | 4 -- test/integration/test-apt-update-rollback | 4 +- test/integration/test-releasefile-date-older | 62 +++++++++++++++++++++++ test/integration/test-releasefile-valid-until | 37 +++++++------- test/integration/test-releasefile-verification | 70 ++++++++++---------------- 8 files changed, 121 insertions(+), 80 deletions(-) create mode 100755 test/integration/test-releasefile-date-older (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 8c8936ead..b253deb91 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1164,9 +1164,9 @@ testfileequal() { shift msgtest "Test for correctness of file" "$FILE" if [ -z "$*" ]; then - echo -n "" | checkdiff $FILE - && msgpass || msgfail + echo -n "" | checkdiff - $FILE && msgpass || msgfail else - echo "$*" | checkdiff $FILE - && msgpass || msgfail + echo "$*" | checkdiff - $FILE && msgpass || msgfail fi } @@ -1547,7 +1547,8 @@ aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } testaptautotestnodpkgwarning() { local TESTCALL="$1" while [ -n "$2" ]; do - if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi + if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode + if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode shift done testfailure grep '^dpkg: warning:.*ignor.*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index f091bffaa..7385e701a 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -43,7 +43,7 @@ runtest() { testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" # ensure that we still do a hash check for other files on ims hit of Release - if grep -q '^Hit .* \(InRelease\|Release.gpg\)$' expected.output ; then + if grep -q '^Hit .* InRelease$' expected.output || ! grep -q '^Ign .* Release\(\.gpg\)\?$' expected.output; then $TEST aptget update -o Debug::Acquire::gpgv=1 cp rootdir/tmp/${TEST}.output goodsign.output testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" @@ -66,7 +66,6 @@ msgmsg 'Release/Release.gpg' EXPECT='Ign http://localhost:8080 unstable InRelease 404 Not Found Hit http://localhost:8080 unstable Release -Hit http://localhost:8080 unstable Release.gpg Reading package lists...' find aptarchive -name 'InRelease' -delete echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex @@ -81,7 +80,7 @@ Hit http://localhost:8080 unstable Release Ign http://localhost:8080 unstable Release.gpg 404 Not Found Reading package lists... -W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated." +W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated." find aptarchive -name 'Release.gpg' -delete echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest 'warning' @@ -108,8 +107,7 @@ msgmsg 'expired Release/Release.gpg' EXPECT='Ign http://localhost:8080 unstable InRelease 404 Not Found Hit http://localhost:8080 unstable Release -Hit http://localhost:8080 unstable Release.gpg -E: Release file for http://localhost:8080/dists/unstable/Release.gpg is expired (invalid since). Updates for this repository will not be applied.' +E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied.' find aptarchive -name 'InRelease' -delete echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest 'failure' @@ -122,8 +120,8 @@ EXPECT="Ign http://localhost:8080 unstable InRelease Hit http://localhost:8080 unstable Release Ign http://localhost:8080 unstable Release.gpg 404 Not Found -W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated. -E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied." +W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated. +E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied." find aptarchive -name 'Release.gpg' -delete echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest 'failure' 'warning' diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index 71576de81..db4430ea3 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -8,6 +8,7 @@ set -e simulate_mitm_and_inject_evil_package() { + redatereleasefiles '+1 hour' rm -f $APTARCHIVE/dists/unstable/InRelease rm -f $APTARCHIVE/dists/unstable/Release.gpg inject_evil_package @@ -31,7 +32,7 @@ EOF assert_update_is_refused_and_last_good_state_used() { - testfailureequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq + testfailuremsg "E: The repository 'file: unstable Release' is no longer signed." aptget update assert_repo_is_intact } @@ -193,7 +194,7 @@ test_release_gpg_to_invalid_release_release_gpg() echo "Some evil data" >> $APTARCHIVE/dists/unstable/Release inject_evil_package - testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release.gpg: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) + testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) diff --git a/test/integration/test-apt-update-not-modified b/test/integration/test-apt-update-not-modified index a67ecb760..b1d55c156 100755 --- a/test/integration/test-apt-update-not-modified +++ b/test/integration/test-apt-update-not-modified @@ -56,7 +56,6 @@ Reading package lists..." aptget update testsuccessequal "Ign $1 unstable InRelease 404 Not Found Hit $1 unstable Release -Hit $1 unstable Release.gpg Reading package lists..." aptget update testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" @@ -66,7 +65,6 @@ Reading package lists..." aptget update testsuccessequal "Ign $1 unstable InRelease 404 Not Found Hit $1 unstable Release -Hit $1 unstable Release.gpg Reading package lists..." aptget update testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" @@ -75,7 +73,6 @@ Reading package lists..." aptget update testsuccessequal "Ign $1 unstable InRelease 404 Not Found Hit $1 unstable Release -Hit $1 unstable Release.gpg Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] Reading package lists..." aptget update testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" @@ -85,7 +82,6 @@ Reading package lists..." aptget update testsuccessequal "Ign $1 unstable InRelease 404 Not Found Get:1 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B] -Get:2 $1 unstable Release.gpg [$(stat -c '%s' 'aptarchive/dists/unstable/Release.gpg') B] Reading package lists..." aptget update webserverconfig 'aptwebserver::support::modified-since' 'true' webserverconfig 'aptwebserver::support::last-modified' 'true' diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index 29fe1ab56..b464a04a1 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -78,7 +78,7 @@ test_inrelease_to_valid_release() { rm $APTARCHIVE/dists/unstable/Release.gpg # update fails - testfailureequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq + testfailureequal "E: The repository 'file: unstable Release' is no longer signed." aptget update -qq # test that security downgrade was not successful testfileequal lists.before "$(listcurrentlistsdirectory)" @@ -101,7 +101,7 @@ test_inrelease_to_release_reverts_all() { break_repository_sources_index '+1hour' # ensure error - testfailureequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 + testfailureequal "E: The repository 'file: unstable Release' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 # ensure that the Packages file is also rolled back testfileequal lists.before "$(listcurrentlistsdirectory)" diff --git a/test/integration/test-releasefile-date-older b/test/integration/test-releasefile-date-older new file mode 100755 index 000000000..5cdc34fac --- /dev/null +++ b/test/integration/test-releasefile-date-older @@ -0,0 +1,62 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +insertpackage 'wheezy' 'apt' 'all' '0.8.15' + +setupaptarchive --no-update + +# we don't complain as the server could have just sent a 'Hit' here and this +# 'downgrade attack' is usually performed by out-of-sync mirrors. Valid-Until +# catches the 'real' downgrade attacks (expect that it finds stale mirrors). +# Scaring users with an error here serves hence no point. + +msgmsg 'InRelease file is silently rejected if' 'new Date is before old Date' +rm -rf rootdir/var/lib/apt/lists +generatereleasefiles 'now' 'now + 7 days' +signreleasefiles +testsuccess aptget update +listcurrentlistsdirectory > listsdir.lst +redatereleasefiles 'now - 2 days' +testsuccess aptget update +testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + +msgmsg 'Release.gpg file is silently rejected if' 'new Date is before old Date' +rm -rf rootdir/var/lib/apt/lists +generatereleasefiles 'now' 'now + 7 days' +signreleasefiles +find aptarchive -name 'InRelease' -delete +testsuccess aptget update +listcurrentlistsdirectory > listsdir.lst +redatereleasefiles 'now - 2 days' +find aptarchive -name 'InRelease' -delete +testsuccess aptget update +testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + +msgmsg 'Crisscross InRelease/Release.gpg file is silently rejected if' 'new Date is before old Date' +rm -rf rootdir/var/lib/apt/lists +generatereleasefiles 'now' 'now + 7 days' +signreleasefiles +find aptarchive -name 'Release.gpg' -delete +testsuccess aptget update +listcurrentlistsdirectory > listsdir.lst +redatereleasefiles 'now - 2 days' +find aptarchive -name 'InRelease' -delete +testsuccess aptget update +testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" + +msgmsg 'Crisscross Release.gpg/InRelease file is silently rejected if' 'new Date is before old Date' +rm -rf rootdir/var/lib/apt/lists +generatereleasefiles 'now' 'now + 7 days' +signreleasefiles +find aptarchive -name 'InRelease' -delete +testsuccess aptget update +listcurrentlistsdirectory > listsdir.lst +redatereleasefiles 'now - 2 days' +find aptarchive -name 'Release.gpg' -delete +testsuccess aptget update +testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until index 0d9a91254..e000abf5d 100755 --- a/test/integration/test-releasefile-valid-until +++ b/test/integration/test-releasefile-valid-until @@ -16,13 +16,12 @@ setupaptarchive --no-update runtest() { local MSG="$1" - msgtest "$1" "$2" + msgtest "Release file is $MSG as it has" "$2" rm -rf rootdir/var/lib/apt/lists - aptget clean generatereleasefiles "$3" "$4" signreleasefiles shift 4 - if expr match "$MSG" '.*accepted.*' >/dev/null; then + if [ "$MSG" = 'accepted' ]; then testsuccess --nomsg aptget update "$@" testfailure grep -q 'is expired' rootdir/tmp/testsuccess.output else @@ -31,19 +30,19 @@ runtest() { fi } -runtest 'Release file is accepted as it has' 'no Until' '' '' -runtest 'Release file is accepted as it has' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600 -runtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600 -runtest 'Release file is accepted as it has' 'good Until' 'now - 3 days' 'now + 1 day' -runtest 'Release file is rejected as it has' 'bad Until' 'now - 7 days' 'now - 4 days' -runtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600 -runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400 -runtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -runtest 'Release file is accepted as it has' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 -runtest 'Release file is rejected as it has' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 -runtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600 -runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600 -runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 -runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 -runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 -runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 +runtest 'accepted' 'no Until' '' '' +runtest 'accepted' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600 +runtest 'rejected' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600 +runtest 'accepted' 'good Until' 'now - 3 days' 'now + 1 day' +runtest 'rejected' 'bad Until' 'now - 7 days' 'now - 4 days' +runtest 'rejected' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600 +runtest 'rejected' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400 +runtest 'rejected' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 +runtest 'accepted' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 +runtest 'rejected' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 +runtest 'accepted' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600 +runtest 'accepted' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600 +runtest 'accepted' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 +runtest 'rejected' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 +runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 +runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index 363b7fe5b..469ed34d2 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -91,25 +91,9 @@ touch aptarchive/apt.deb PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')" -updatesuccess() { - local LOG='update.log' - if aptget update >$LOG 2>&1 || grep -q -E '^(W|E): ' $LOG; then - msgpass - else - cat $LOG - msgfail - fi -} - -updatefailure() { - local LOG='update.log' - aptget update >$LOG 2>&1 || true - if grep -q -E "$1" $LOG; then - msgpass - else - cat $LOG - msgfail - fi +updatewithwarnings() { + testwarning aptget update + testsuccess grep -E "$1" rootdir/tmp/testwarning.output } runtest() { @@ -117,8 +101,8 @@ runtest() { rm -rf rootdir/var/lib/apt/lists signreleasefiles 'Joe Sixpack' find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Cold archive signed by' 'Joe Sixpack' - updatesuccess + msgmsg 'Cold archive signed by' 'Joe Sixpack' + testsuccess aptget update testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt installaptold @@ -126,8 +110,8 @@ runtest() { prepare ${PKGFILE}-new signreleasefiles 'Joe Sixpack' find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Good warm archive signed by' 'Joe Sixpack' - updatesuccess + msgmsg 'Good warm archive signed by' 'Joe Sixpack' + testsuccess aptget update testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt installaptnew @@ -137,8 +121,8 @@ runtest() { cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg signreleasefiles 'Rex Expired' find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Cold archive signed by' 'Rex Expired' - updatefailure '^W: .* KEYEXPIRED' + msgmsg 'Cold archive signed by' 'Rex Expired' + updatewithwarnings '^W: .* KEYEXPIRED' testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt failaptold @@ -148,8 +132,8 @@ runtest() { rm -rf rootdir/var/lib/apt/lists signreleasefiles 'Marvin Paranoid' find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Cold archive signed by' 'Marvin Paranoid' - updatefailure '^W: .* NO_PUBKEY' + msgmsg 'Cold archive signed by' 'Marvin Paranoid' + updatewithwarnings '^W: .* NO_PUBKEY' testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt failaptold @@ -162,8 +146,8 @@ runtest() { done signreleasefiles 'Joe Sixpack' find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Bad warm archive signed by' 'Joe Sixpack' - updatesuccess + msgmsg 'Bad warm archive signed by' 'Joe Sixpack' + testsuccess aptget update testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt installaptnew @@ -173,8 +157,8 @@ runtest() { rm -rf rootdir/var/lib/apt/lists signreleasefiles 'Joe Sixpack' find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Cold archive signed by' 'Joe Sixpack' - updatesuccess + msgmsg 'Cold archive signed by' 'Joe Sixpack' + testsuccess aptget update testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt installaptold @@ -182,8 +166,8 @@ runtest() { prepare ${PKGFILE}-new signreleasefiles 'Marvin Paranoid' find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Good warm archive signed by' 'Marvin Paranoid' - updatefailure '^W: .* NO_PUBKEY' + msgmsg 'Good warm archive signed by' 'Marvin Paranoid' + updatewithwarnings '^W: .* NO_PUBKEY' testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt installaptold @@ -192,8 +176,8 @@ runtest() { cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg signreleasefiles 'Rex Expired' find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Good warm archive signed by' 'Rex Expired' - updatefailure '^W: .* KEYEXPIRED' + msgmsg 'Good warm archive signed by' 'Rex Expired' + updatewithwarnings '^W: .* KEYEXPIRED' testsuccessequal "$(cat ${PKGFILE}) " aptcache show apt installaptold @@ -202,8 +186,8 @@ runtest() { prepare ${PKGFILE}-new signreleasefiles find aptarchive/ -name "$DELETEFILE" -delete - msgtest 'Good warm archive signed by' 'Joe Sixpack' - updatesuccess + msgmsg 'Good warm archive signed by' 'Joe Sixpack' + testsuccess aptget update testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt installaptnew @@ -213,24 +197,24 @@ runtest2() { prepare ${PKGFILE} rm -rf rootdir/var/lib/apt/lists signreleasefiles 'Joe Sixpack' - msgtest 'Cold archive signed by' 'Joe Sixpack' - updatesuccess + msgmsg 'Cold archive signed by' 'Joe Sixpack' + testsuccess aptget update # New .deb but now an unsigned archive. For example MITM to circumvent # package verification. prepare ${PKGFILE}-new find aptarchive/ -name InRelease -delete find aptarchive/ -name Release.gpg -delete - msgtest 'Warm archive signed by' 'nobody' - updatesuccess + msgmsg 'Warm archive signed by' 'nobody' + updatewithwarnings 'W: .* no longer signed.' testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt failaptnew # Unsigned archive from the beginning must also be detected. rm -rf rootdir/var/lib/apt/lists - msgtest 'Cold archive signed by' 'nobody' - updatesuccess + msgmsg 'Cold archive signed by' 'nobody' + updatewithwarnings 'W: .* is not signed.' testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt failaptnew -- cgit v1.2.3 From ceafe8a6edc815df2923ba892894617829e9d3c2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 May 2015 15:28:53 +0200 Subject: Fix endless loop in apt-get update that can cause disk fillup The apt http code parses Content-Length and Content-Range. For both requests the variable "Size" is used and the semantic for this Size is the total file size. However Content-Length is not the entire file size for partital file requests. For servers that send the Content-Range header first and then the Content-Length header this can lead to globbing of Size so that its less than the real file size. This may lead to a subsequent passing of a negative number into the CircleBuf which leads to a endless loop that writes data. Thanks to Anton Blanchard for the analysis and initial patch. LP: #1445239 --- test/interactive-helper/aptwebserver.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index cd52da692..9c67b67e4 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -654,13 +654,13 @@ static void * handleClient(void * voidclient) /*{{{*/ if (filesize > filestart) { data.Skip(filestart); - std::ostringstream contentlength; - contentlength << "Content-Length: " << (filesize - filestart); - headers.push_back(contentlength.str()); std::ostringstream contentrange; contentrange << "Content-Range: bytes " << filestart << "-" << filesize - 1 << "/" << filesize; headers.push_back(contentrange.str()); + std::ostringstream contentlength; + contentlength << "Content-Length: " << (filesize - filestart); + headers.push_back(contentlength.str()); sendHead(client, 206, headers); if (sendContent == true) sendFile(client, headers, data); -- cgit v1.2.3 From f4a91278c65b156c1addf27b0b05b029692959e8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 May 2015 16:05:05 +0200 Subject: Add regression test for LP: #1445239 Add a regression test that reproduced the hang of apt when a partial file is present. Git-Dch: ignore --- test/integration/test-bug-lp1445239-download-loop | 29 +++++++++++++++++++++++ test/interactive-helper/aptwebserver.cc | 2 ++ 2 files changed, 31 insertions(+) create mode 100755 test/integration/test-bug-lp1445239-download-loop (limited to 'test') diff --git a/test/integration/test-bug-lp1445239-download-loop b/test/integration/test-bug-lp1445239-download-loop new file mode 100755 index 000000000..342e3c61e --- /dev/null +++ b/test/integration/test-bug-lp1445239-download-loop @@ -0,0 +1,29 @@ +#!/bin/sh +# +# this is a regression test for LP: #1445239 where a partial download can +# trigger an endless hang of the download method +# + +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +changetowebserver +webserverconfig 'aptwebserver::support::range' 'true' + +TESTFILE='aptarchive/testfile' +dd if=/dev/zero of=$TESTFILE bs=100k count=1 2>/dev/null + +DOWNLOADLOG='rootdir/tmp/testdownloadfile.log' + +TARGET=testfile-downloaded +dd if=/dev/zero of=$TARGET bs=99k count=1 2>/dev/null +if ! downloadfile http://localhost:8080/testfile "$TARGET" > "$DOWNLOADLOG"; then + cat >&2 "$DOWNLOADLOG" + msgfail +else + msgpass +fi diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 9c67b67e4..e02caa2b3 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -654,6 +654,8 @@ static void * handleClient(void * voidclient) /*{{{*/ if (filesize > filestart) { data.Skip(filestart); + // make sure to send content-range before conent-length + // as regression test for LP: #1445239 std::ostringstream contentrange; contentrange << "Content-Range: bytes " << filestart << "-" << filesize - 1 << "/" << filesize; -- cgit v1.2.3