diff options
| author | Julian Andres Klode <julian.klode@canonical.com> | 2024-11-11 14:09:41 +0100 |
|---|---|---|
| committer | Julian Andres Klode <julian.klode@canonical.com> | 2024-11-20 15:04:28 +0100 |
| commit | 709adda89a575e6c542310e6632c090632bb9732 (patch) | |
| tree | cd53499ae57556e016f3d87dc3e596ec69919fd9 /test | |
| parent | b888c66c7244de9b20d174555ffdc22829d6c222 (diff) | |
ftparchive: cachedb: Remove 600-byte key limit
Instead of snprintf() into a fixed-size buffer, construct an
std::string using assign() and append().
A previous version used strprintf() which would have been
hilariously inefficient.
LP: #2087848
Diffstat (limited to 'test')
| -rwxr-xr-x | test/integration/test-apt-ftparchive-cachedb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb index e1cd9867d..1ba1f23ba 100755 --- a/test/integration/test-apt-ftparchive-cachedb +++ b/test/integration/test-apt-ftparchive-cachedb @@ -1,6 +1,11 @@ #!/bin/sh set -e +db_dump=db_dump +if command -v db_dump-5 >/dev/null 2>&1; then + db_dump=db_dump-5 +fi + ensure_correct_packages_file() { testequal "Package: foo Architecture: i386 @@ -109,6 +114,33 @@ testsuccessequal "Priority: priority${manyX}" grep ^Priority ./aptarchive/dists/ testsuccessequal "Section: overrideSection" grep ^Section ./aptarchive/dists/test/main/binary-i386/Packages testsuccessequal "Extra: ${manyX}trailer" grep ^Extra ./aptarchive/dists/test/main/binary-i386/Packages + +msgmsg "Test long paths" +x128=$(head -c 128 /dev/zero | tr '\0' 'X') +longPath=${x128}/${x128}/${x128}/${x128}/${x128}/${x128}/${x128}/${x128} +mkdir -p aptarchive/pool/main/$longPath +mv aptarchive/pool/main/foo_1_i386.deb aptarchive/pool/main/$longPath/foo_1_i386.deb + +# before +testsuccess $db_dump -f dump -p aptarchive-cache/packages-main-i386.db +testsuccess grep "^ ./aptarchive/pool/main/foo_1_i386.deb:cl$" dump +testsuccess grep "^ ./aptarchive/pool/main/foo_1_i386.deb:cn$" dump +testsuccess grep "^ ./aptarchive/pool/main/foo_1_i386.deb:st$" dump + +testsuccess aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 + +# file is still found +testsuccessequal "Filename: pool/main/${longPath}/foo_1_i386.deb" grep ^Filename ./aptarchive/dists/test/main/binary-i386/Packages +testsuccessequal "Priority: priority${manyX}" grep ^Priority ./aptarchive/dists/test/main/binary-i386/Packages +testsuccessequal "Section: overrideSection" grep ^Section ./aptarchive/dists/test/main/binary-i386/Packages +testsuccessequal "Extra: ${manyX}trailer" grep ^Extra ./aptarchive/dists/test/main/binary-i386/Packages + +# file is in the database +testsuccess $db_dump -f dump -p aptarchive-cache/packages-main-i386.db +testsuccess grep "^ ./aptarchive/pool/main/${longPath}/foo_1_i386.deb:cl$" dump +testsuccess grep "^ ./aptarchive/pool/main/${longPath}/foo_1_i386.deb:cn$" dump +testsuccess grep "^ ./aptarchive/pool/main/${longPath}/foo_1_i386.deb:st"$ dump + msgmsg "Test Clean" # and clean rm -rf aptarchive/pool/main/* |
