Commit 86855715 authored by Lorenzo "Palinuro" Faletra's avatar Lorenzo "Palinuro" Faletra Committed by Lorenzo "Palinuro" Faletra
Browse files

Import Debian version 2.2.3+parrot1

apt (2.2.3+parrot1) rolling; urgency=medium
.
  * Import new Debian release.
  * Patch methods/basehttp.c to allow https-to-http redirects.
.
apt (2.2.3) unstable; urgency=medium
.
  * tests: Check for and discard expected warning from MaybeAddAuth. For some
    reason, this was only noticed with LTO enabled, but should be a general
    issue.
  * Fix downloads of unsized files that are largest in pipeline (LP: #1921626)
  * Warn on packages without a Size field. Such repositories are broken and
    need to be fixed, as we do not test apt against them, see the bug above
    for more details. Set Acquire::AllowUnsizedPackages to disable the
    warning.
.
apt (2.2.2+parrot1) rolling; urgency=medium
.
  * Import new Debian release.
  * Patch methods/basehttp.c to allow https-to-http redirects.
.
apt (2.2.2) unstable; urgency=medium
.
  [ David Kalnischkies ]
  * Deal with rred shortcomings around empty patch files (LP: #1918112)
    - Allow merging with empty pdiff patches
    - Rename pdiff merge patches only after they are all downloaded
    - Start pdiff patching from the last possible starting point
    - Ensure all index files sent custom tags to the methods
  * Harden test for no new acquires after transaction abort (Closes: #984966)
.
  [ Julian Andres Klode ]
  * Make ADDARG{,C}() macros expand to single statements
parent 54085fd5
Pipeline #3019 failed with stages
in 0 seconds
...@@ -200,7 +200,7 @@ endif() ...@@ -200,7 +200,7 @@ endif()
# Configure some variables like package, version and architecture. # Configure some variables like package, version and architecture.
set(PACKAGE ${PROJECT_NAME}) set(PACKAGE ${PROJECT_NAME})
set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>") set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>")
set(PACKAGE_VERSION "2.2.1") set(PACKAGE_VERSION "2.2.3")
string(REGEX MATCH "^[0-9.]+" PROJECT_VERSION ${PACKAGE_VERSION}) string(REGEX MATCH "^[0-9.]+" PROJECT_VERSION ${PACKAGE_VERSION})
if (NOT DEFINED DPKG_DATADIR) if (NOT DEFINED DPKG_DATADIR)
......
...@@ -2564,26 +2564,16 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile) /*{{{*/ ...@@ -2564,26 +2564,16 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile) /*{{{*/
} }
} }
bool foundStart = false;
for (std::vector<DiffInfo>::iterator cur = available_patches.begin();
cur != available_patches.end(); ++cur)
{ {
if (LocalHashes != cur->result_hashes) auto const foundStart = std::find_if(available_patches.rbegin(), available_patches.rend(),
continue; [&](auto const &cur) { return LocalHashes == cur.result_hashes; });
if (foundStart == available_patches.rend() || unlikely(available_patches.empty()))
available_patches.erase(available_patches.begin(), cur); {
foundStart = true; ErrorText = "Couldn't find the start of the patch series";
break; return false;
} }
available_patches.erase(available_patches.begin(), std::prev(foundStart.base()));
if (foundStart == false || unlikely(available_patches.empty() == true))
{
ErrorText = "Couldn't find the start of the patch series";
return false;
}
{
auto const patch = std::find_if(available_patches.cbegin(), available_patches.cend(), [](auto const &patch) { auto const patch = std::find_if(available_patches.cbegin(), available_patches.cend(), [](auto const &patch) {
return not patch.result_hashes.usable() || return not patch.result_hashes.usable() ||
not patch.patch_hashes.usable() || not patch.patch_hashes.usable() ||
...@@ -3050,14 +3040,11 @@ void pkgAcqIndexMergeDiffs::Done(string const &Message, HashStringList const &Ha ...@@ -3050,14 +3040,11 @@ void pkgAcqIndexMergeDiffs::Done(string const &Message, HashStringList const &Ha
State = StateErrorDiff; State = StateErrorDiff;
return; return;
} }
std::string const PatchFile = GetMergeDiffsPatchFileName(UnpatchedFile, patch.file);
std::string const PatchedFile = GetKeepCompressedFileName(UncompressedUnpatchedFile, Target); std::string const PatchedFile = GetKeepCompressedFileName(UncompressedUnpatchedFile, Target);
switch (State) switch (State)
{ {
case StateFetchDiff: case StateFetchDiff:
Rename(DestFile, PatchFile);
// check if this is the last completed diff // check if this is the last completed diff
State = StateDoneDiff; State = StateDoneDiff;
for (std::vector<pkgAcqIndexMergeDiffs *>::const_iterator I = allPatches->begin(); for (std::vector<pkgAcqIndexMergeDiffs *>::const_iterator I = allPatches->begin();
...@@ -3068,6 +3055,8 @@ void pkgAcqIndexMergeDiffs::Done(string const &Message, HashStringList const &Ha ...@@ -3068,6 +3055,8 @@ void pkgAcqIndexMergeDiffs::Done(string const &Message, HashStringList const &Ha
std::clog << "Not the last done diff in the batch: " << Desc.URI << std::endl; std::clog << "Not the last done diff in the batch: " << Desc.URI << std::endl;
return; return;
} }
for (auto * diff : *allPatches)
Rename(diff->DestFile, GetMergeDiffsPatchFileName(UnpatchedFile, diff->patch.file));
// this is the last completed diff, so we are ready to apply now // this is the last completed diff, so we are ready to apply now
DestFile = GetKeepCompressedFileName(UncompressedUnpatchedFile + "-patched", Target); DestFile = GetKeepCompressedFileName(UncompressedUnpatchedFile + "-patched", Target);
if(Debug) if(Debug)
...@@ -3098,8 +3087,8 @@ void pkgAcqIndexMergeDiffs::Done(string const &Message, HashStringList const &Ha ...@@ -3098,8 +3087,8 @@ void pkgAcqIndexMergeDiffs::Done(string const &Message, HashStringList const &Ha
if(Debug) if(Debug)
std::clog << "allDone: " << DestFile << "\n" << std::endl; std::clog << "allDone: " << DestFile << "\n" << std::endl;
return; return;
case StateDoneDiff: _error->Fatal("Done called for %s which is in an invalid Done state", PatchFile.c_str()); break; case StateDoneDiff: _error->Fatal("Done called for %s which is in an invalid Done state", patch.file.c_str()); break;
case StateErrorDiff: _error->Fatal("Done called for %s which is in an invalid Error state", PatchFile.c_str()); break; case StateErrorDiff: _error->Fatal("Done called for %s which is in an invalid Error state", patch.file.c_str()); break;
} }
} }
/*}}}*/ /*}}}*/
...@@ -3188,8 +3177,8 @@ void pkgAcqIndex::Init(string const &URI, string const &URIDesc, ...@@ -3188,8 +3177,8 @@ void pkgAcqIndex::Init(string const &URI, string const &URIDesc,
/* The only header we use is the last-modified header. */ /* The only header we use is the last-modified header. */
string pkgAcqIndex::Custom600Headers() const string pkgAcqIndex::Custom600Headers() const
{ {
std::string msg = pkgAcqBaseIndex::Custom600Headers();
string msg = "\nIndex-File: true"; msg.append("\nIndex-File: true");
if (TransactionManager->LastMetaIndexParser == NULL) if (TransactionManager->LastMetaIndexParser == NULL)
{ {
...@@ -3480,6 +3469,12 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sourc ...@@ -3480,6 +3469,12 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sourc
Version.VerStr(), Version.ParentPkg().FullName(false).c_str()); Version.VerStr(), Version.ParentPkg().FullName(false).c_str());
return; return;
} }
if (FileSize == 0 && not _config->FindB("Acquire::AllowUnsizedPackages", false))
{
_error->Warning("Repository is broken: %s (= %s) has no Size information",
Version.ParentPkg().FullName(false).c_str(),
Version.VerStr());
}
// Check if we already downloaded the file // Check if we already downloaded the file
struct stat Buf; struct stat Buf;
...@@ -3941,9 +3936,10 @@ void pkgAcqFile::Done(string const &Message,HashStringList const &CalcHashes, ...@@ -3941,9 +3936,10 @@ void pkgAcqFile::Done(string const &Message,HashStringList const &CalcHashes,
/*}}}*/ /*}}}*/
string pkgAcqFile::Custom600Headers() const /*{{{*/ string pkgAcqFile::Custom600Headers() const /*{{{*/
{ {
if (IsIndexFile) string Header = pkgAcquire::Item::Custom600Headers();
return "\nIndex-File: true"; if (not IsIndexFile)
return ""; return Header;
return Header + "\nIndex-File: true";
} }
/*}}}*/ /*}}}*/
pkgAcqFile::~pkgAcqFile() {} pkgAcqFile::~pkgAcqFile() {}
......
...@@ -1765,8 +1765,8 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) ...@@ -1765,8 +1765,8 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
if (pipe(fd) != 0) if (pipe(fd) != 0)
return _error->Errno("pipe","Failed to create IPC pipe to dpkg"); return _error->Errno("pipe","Failed to create IPC pipe to dpkg");
#define ADDARG(X) Args.push_back(X); Size += strlen(X) #define ADDARG(X) do { const char *arg = (X); Args.push_back(arg); Size += strlen(arg); } while (0)
#define ADDARGC(X) Args.push_back(X); Size += sizeof(X) - 1 #define ADDARGC(X) ADDARG(X)
ADDARGC("--status-fd"); ADDARGC("--status-fd");
char status_fd_buf[20]; char status_fd_buf[20];
......
apt (2.2.3+parrot1) rolling; urgency=medium
* Import new Debian release.
* Patch methods/basehttp.c to allow https-to-http redirects.
-- Lorenzo "Palinuro" Faletra <palinuro@parrotsec.org> Wed, 28 Apr 2021 22:24:52 +0200
apt (2.2.3) unstable; urgency=medium
* tests: Check for and discard expected warning from MaybeAddAuth. For some
reason, this was only noticed with LTO enabled, but should be a general
issue.
* Fix downloads of unsized files that are largest in pipeline (LP: #1921626)
* Warn on packages without a Size field. Such repositories are broken and
need to be fixed, as we do not test apt against them, see the bug above
for more details. Set Acquire::AllowUnsizedPackages to disable the
warning.
-- Julian Andres Klode <jak@debian.org> Tue, 13 Apr 2021 17:53:32 +0200
apt (2.2.2+parrot1) rolling; urgency=medium
* Import new Debian release.
* Patch methods/basehttp.c to allow https-to-http redirects.
-- Lorenzo "Palinuro" Faletra <palinuro@localhost.localdomain> Sat, 20 Mar 2021 20:50:10 +0100
apt (2.2.2) unstable; urgency=medium
[ David Kalnischkies ]
* Deal with rred shortcomings around empty patch files (LP: #1918112)
- Allow merging with empty pdiff patches
- Rename pdiff merge patches only after they are all downloaded
- Start pdiff patching from the last possible starting point
- Ensure all index files sent custom tags to the methods
* Harden test for no new acquires after transaction abort (Closes: #984966)
[ Julian Andres Klode ]
* Make ADDARG{,C}() macros expand to single statements
-- Julian Andres Klode <jak@debian.org> Fri, 12 Mar 2021 09:15:59 +0100
apt (2.2.1+parrot1) rolling; urgency=medium apt (2.2.1+parrot1) rolling; urgency=medium
* Import new Debian release. * Import new Debian release.
......
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
"> ">
<!-- this will be updated by 'prepare-release' --> <!-- this will be updated by 'prepare-release' -->
<!ENTITY apt-product-version "2.2.1"> <!ENTITY apt-product-version "2.2.3">
<!-- (Code)names for various things used all over the place --> <!-- (Code)names for various things used all over the place -->
<!ENTITY debian-oldstable-codename "buster"> <!ENTITY debian-oldstable-codename "buster">
......
...@@ -257,6 +257,7 @@ Acquire ...@@ -257,6 +257,7 @@ Acquire
AllowInsecureRepositories "<BOOL>"; AllowInsecureRepositories "<BOOL>";
AllowWeakRepositories "<BOOL>"; AllowWeakRepositories "<BOOL>";
AllowDowngradeToInsecureRepositories "<BOOL>"; AllowDowngradeToInsecureRepositories "<BOOL>";
AllowUnsizedPackages "<BOOL>";
// allow repositories to change information potentially breaking user config like pinning // allow repositories to change information potentially breaking user config like pinning
AllowReleaseInfoChange "<BOOL>" AllowReleaseInfoChange "<BOOL>"
{ {
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: apt-doc 2.2.1\n" "Project-Id-Version: apt-doc 2.2.3\n"
"Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n"
"POT-Creation-Date: 2021-03-01 22:28+0100\n" "POT-Creation-Date: 2021-04-13 15:38+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
......
...@@ -391,9 +391,9 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req) ...@@ -391,9 +391,9 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
// as well as http to https // as well as http to https
else if ((Uri.Access == "http" || Uri.Access == "https+http") && tmpURI.Access == "https") else if ((Uri.Access == "http" || Uri.Access == "https+http") && tmpURI.Access == "https")
return TRY_AGAIN_OR_REDIRECT; return TRY_AGAIN_OR_REDIRECT;
// allow https to http redirects (for https mirrordirectors with http mirrors) // allow https to http redirects (for https mirrordirectors with http mirrors)
else if ((Uri.Access == "https" || Uri.Access == "https+http") && tmpURI.Access == "http") else if ((Uri.Access == "https" || Uri.Access == "https+http") && tmpURI.Access == "http")
return TRY_AGAIN_OR_REDIRECT; return TRY_AGAIN_OR_REDIRECT;
else else
{ {
auto const tmpplus = tmpURI.Access.find('+'); auto const tmpplus = tmpURI.Access.find('+');
...@@ -885,7 +885,11 @@ unsigned long long BaseHttpMethod::FindMaximumObjectSizeInQueue() const /*{{{*/ ...@@ -885,7 +885,11 @@ unsigned long long BaseHttpMethod::FindMaximumObjectSizeInQueue() const /*{{{*/
{ {
unsigned long long MaxSizeInQueue = 0; unsigned long long MaxSizeInQueue = 0;
for (FetchItem *I = Queue; I != 0 && I != QueueBack; I = I->Next) for (FetchItem *I = Queue; I != 0 && I != QueueBack; I = I->Next)
{
if (I->MaximumSize == 0)
return 0;
MaxSizeInQueue = std::max(MaxSizeInQueue, I->MaximumSize); MaxSizeInQueue = std::max(MaxSizeInQueue, I->MaximumSize);
}
return MaxSizeInQueue; return MaxSizeInQueue;
} }
/*}}}*/ /*}}}*/
......
This diff is collapsed.
...@@ -441,8 +441,12 @@ class Patch { ...@@ -441,8 +441,12 @@ class Patch {
bool cmdwanted = true; bool cmdwanted = true;
Change ch(std::numeric_limits<size_t>::max()); Change ch(std::numeric_limits<size_t>::max());
if (f.ReadLine(buffer, sizeof(buffer)) == NULL) if (f.ReadLine(buffer, sizeof(buffer)) == nullptr)
{
if (f.Eof())
return true;
return _error->Error("Reading first line of patchfile %s failed", f.Name().c_str()); return _error->Error("Reading first line of patchfile %s failed", f.Name().c_str());
}
do { do {
if (h != NULL) if (h != NULL)
h->Add(buffer); h->Add(buffer);
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: apt 2.2.1\n" "Project-Id-Version: apt 2.2.3\n"
"Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n"
"POT-Creation-Date: 2021-03-01 22:28+0100\n" "POT-Creation-Date: 2021-04-13 15:38+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
......
...@@ -486,6 +486,10 @@ EOF ...@@ -486,6 +486,10 @@ EOF
echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id
# XXX: We really ought to make the packages in the test suite all have Size fields.
# But this needs a lot more changes, so let's keep it simple for stable updates.
echo 'Acquire::AllowUnsizedPackages "true";' >> rootdir/etc/apt/apt.conf.d/temporary-allow-unsized-packages
configcompression '.' 'gz' #'bz2' 'lzma' 'xz' configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
confighashes 'SHA256' # these are tests, not security best-practices confighashes 'SHA256' # these are tests, not security best-practices
...@@ -2126,6 +2130,9 @@ aptautotest() { ...@@ -2126,6 +2130,9 @@ aptautotest() {
fi fi
} }
cdfind() {
( cd /; find "$@" )
}
aptautotest_aptget_update() { aptautotest_aptget_update() {
local TESTCALL="$1" local TESTCALL="$1"
while [ -n "$2" ]; do while [ -n "$2" ]; do
...@@ -2135,24 +2142,21 @@ aptautotest_aptget_update() { ...@@ -2135,24 +2142,21 @@ aptautotest_aptget_update() {
if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi
testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}: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" testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
(
cd /
# all copied files are properly chmodded # all copied files are properly chmodded
local backupIFS="$IFS" local backupIFS="$IFS"
IFS="$(printf "\n\b")" IFS="$(printf "\n\b")"
find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | while read file; do cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | while read file; do
testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
done done
IFS="$backupIFS" IFS="$backupIFS"
if [ "$TESTCALL" = 'testsuccess' ]; then if [ "$TESTCALL" = 'testsuccess' ]; then
# failure cases can retain partial files and such # failure cases can retain partial files and such
testempty find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \)
fi fi
if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \
"$(find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)"
fi fi
)
} }
aptautotest_apt_update() { aptautotest_aptget_update "$@"; } aptautotest_apt_update() { aptautotest_aptget_update "$@"; }
aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; }
......
...@@ -192,6 +192,16 @@ http://localhost:${APTHTTPPORT}/redirectme type:deb ...@@ -192,6 +192,16 @@ http://localhost:${APTHTTPPORT}/redirectme type:deb
testfailure apt update testfailure apt update
testrundownload 'foo=2' testrundownload 'foo=2'
msgmsg 'Mirrors can be filtered by' 'by-hash type'
echo "http://localhost:${APTHTTPPORT}/failure type:foobar priority:1
http://localhost:${APTHTTPPORT}/redirectme type:index type:deb
" > aptarchive/mirror.txt
rm -rf rootdir/var/lib/apt/lists
testsuccess apt update -o Acquire::By-Hash=force #-o Debug::pkgAcquire::Worker=1
cp rootdir/tmp/testsuccess.output forcedbyhash.output
testfailure grep "localhost:${APTHTTPPORT}/failure" forcedbyhash.output
testrundownload 'foo=2'
msgmsg 'The prefix for the mirrorlist is' 'passed on' msgmsg 'The prefix for the mirrorlist is' 'passed on'
echo 'Dir::Bin::Methods::foo+mirror+file "mirror"; echo 'Dir::Bin::Methods::foo+mirror+file "mirror";
Dir::Bin::Methods::foo+mirror+http "mirror"; Dir::Bin::Methods::foo+mirror+http "mirror";
......
...@@ -146,6 +146,7 @@ testrred 'Multi line change' 'more' '5,7c ...@@ -146,6 +146,7 @@ testrred 'Multi line change' 'more' '5,7c
- even more good stuff - even more good stuff
- bonus good stuff - bonus good stuff
$(tail -n 12 ./Packages)" $(tail -n 12 ./Packages)"
testrred 'Patch file' 'empty' '' "$(cat ./Packages)"
failrred() { failrred() {
msgtest 'Failure caused by' "$1" msgtest 'Failure caused by' "$1"
...@@ -161,7 +162,6 @@ failrred 'Bogus content' '<html> ...@@ -161,7 +162,6 @@ failrred 'Bogus content' '<html>
</html>' </html>'
# not a problem per-se, but we want our parser to be really strict # not a problem per-se, but we want our parser to be really strict
failrred 'Empty patch file' ''
failrred 'Empty line patch file' ' failrred 'Empty line patch file' '
' '
failrred 'Empty line before command' ' failrred 'Empty line before command' '
...@@ -222,7 +222,8 @@ createpatch 'Remove more stuff and fix later' '23d, ...@@ -222,7 +222,8 @@ createpatch 'Remove more stuff and fix later' '23d,
testsuccess apthelper cat-file --compress gzip Packages.ed-1 testsuccess apthelper cat-file --compress gzip Packages.ed-1
mv rootdir/tmp/testsuccess.output Packages.ed-1.gz mv rootdir/tmp/testsuccess.output Packages.ed-1.gz
testsuccess rm Packages.ed-1 testsuccess rm Packages.ed-1
createpatch 'Remove (old) dog paragraph' '10,19d' > Packages.ed-2 touch Packages.ed-2 # an empty patch
createpatch 'Remove (old) dog paragraph' '10,19d' > Packages.ed-3
mergepatches '11,19c mergepatches '11,19c
Package: extra-kittens Package: extra-kittens
Version: unavailable Version: unavailable
......
...@@ -100,12 +100,15 @@ testrun() { ...@@ -100,12 +100,15 @@ testrun() {
PATCHINDEX='aptarchive/Packages.diff/Index' PATCHINDEX='aptarchive/Packages.diff/Index'
echo "SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new") echo "SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
SHA256-History: SHA256-History:
$(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") 2000-08-18-2013.28
01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
$(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE") $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
SHA256-Patches: SHA256-Patches:
$(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") 2000-08-18-2013.28
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
$(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE") $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
SHA256-Download: SHA256-Download:
$(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") 2000-08-18-2013.28.gz
d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
$(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" > "$PATCHINDEX" $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" > "$PATCHINDEX"
...@@ -251,16 +254,10 @@ SHA256-Download: ...@@ -251,16 +254,10 @@ SHA256-Download:
cp Packages-future aptarchive/Packages cp Packages-future aptarchive/Packages
rm -f rootdir/var/lib/apt/lists/*_Contents-* rm -f rootdir/var/lib/apt/lists/*_Contents-*
webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/hacked-i386.gz' webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/hacked-i386.gz'
# This should work in at least 4% of the cases... testfailure apt update "$@"
for i in $(seq 25); do
testfailure apt update "$@"
if ! grep 'rred:600' rootdir/tmp/testfailure.output; then
break
fi
done
webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/Contents-i386.gz'
cp rootdir/tmp/testfailure.output patchdownload.output cp rootdir/tmp/testfailure.output patchdownload.output
testfailure grep 'rred:600' patchdownload.output webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/Contents-i386.gz'
testfailure grep -q -z 'AbortTransaction.* [a-zA-Z0-9+-]\+:600%20' patchdownload.output
testnopackage newstuff futurestuff testnopackage newstuff futurestuff
testsuccessequal "$(cat "${PKGFILE}") testsuccessequal "$(cat "${PKGFILE}")
" aptcache show apt oldstuff " aptcache show apt oldstuff
...@@ -281,7 +278,8 @@ SHA256-Download: ...@@ -281,7 +278,8 @@ SHA256-Download:
rm "${PATCHFILE}.gz" rm "${PATCHFILE}.gz"
testsuccess apt update "$@" testsuccess apt update "$@"
cp rootdir/tmp/testsuccess.output patchdownload.output cp rootdir/tmp/testsuccess.output patchdownload.output
testsuccess grep '^Falling back to normal index file acquire' patchdownload.output # it should be anchored on line start, but multiple processes on the same output stream…
testsuccess grep 'Falling back to normal index file acquire' patchdownload.output
testnopackage oldstuff testnopackage oldstuff
testsuccessequal "$(cat Packages-future) testsuccessequal "$(cat Packages-future)
" aptcache show apt newstuff futurestuff " aptcache show apt newstuff futurestuff
......
#!/bin/sh
set -e
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture "i386"
confighashes 'SHA512'
mkdir tree
head -c $((5*1024)) /dev/urandom > tree/data-file
buildsimplenativepackage 'a' 'all' '1.0' 'stable'
buildsimplenativepackage 'b' 'all' '1.0' 'stable' '' '' '' '' "$PWD/tree"
buildsimplenativepackage 'c' 'all' '1.0' 'stable'
setupaptarchive
changetowebserver
# Disable sandbox
echo 'APT::Sandbox::User "root";' > rootdir/etc/apt/apt.conf.d/no-acquire-sandbox
# XXX: Remove temporary hack
rm rootdir/etc/apt/apt.conf.d/temporary-allow-unsized-packages
testsuccess apt update
for file in rootdir/var/lib/apt/lists/*Packages; do
awk '!(/^Size/ && ++cnt==2)' $file > $file.new
mv $file.new $file
done
size_a=$(wc -c aptarchive/pool/a_1.0_all.deb | awk '{print $1}')
size_b=$(wc -c aptarchive/pool/b_1.0_all.deb | awk '{print $1}')
size_c=$(wc -c aptarchive/pool/c_1.0_all.deb | awk '{print $1}')
testsuccessequal "Get:1 http://localhost:${APTHTTPPORT} stable/main all a all 1.0 [$size_a B]
Get:2 http://localhost:${APTHTTPPORT} stable/main all b all 1.0 [$size_b B]
Get:3 http://localhost:${APTHTTPPORT} stable/main all c all 1.0 [$size_c B]" apt download a b c -o Acquire::AllowUnsizedPackages=true
rm *.deb
testwarningequal "Get:1 http://localhost:${APTHTTPPORT} stable/main all a all 1.0 [$size_a B]
Get:2 http://localhost:${APTHTTPPORT} stable/main all b all 1.0 [$size_b B]
Get:3 http://localhost:${APTHTTPPORT} stable/main all c all 1.0 [$size_c B]
W: Repository is broken: b:i386 (= 1.0) has no Size information" apt download a b c