<feed xmlns='http://www.w3.org/2005/Atom'>
<title>apt/ftparchive, branch 2.9.10</title>
<subtitle>Debians commandline package manager</subtitle>
<id>https://git.kalnischkies.de/apt/atom?h=2.9.10</id>
<link rel='self' href='https://git.kalnischkies.de/apt/atom?h=2.9.10'/>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/'/>
<updated>2024-10-07T14:17:32Z</updated>
<entry>
<title>ftparchive: contents: Avoid exponential complexity and overflows</title>
<updated>2024-10-07T14:17:32Z</updated>
<author>
<name>Julian Andres Klode</name>
<email>julian.klode@canonical.com</email>
</author>
<published>2024-10-04T16:35:15Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=604d1fac652965ec71629fec09ca39660c8bb8dc'/>
<id>urn:sha1:604d1fac652965ec71629fec09ca39660c8bb8dc</id>
<content type='text'>
Wstored directory entries as a binary tree, but we did not balance it,
leading to exponential complexity on insertion and potentially
exponential levels of stack recursion in DoPrint(), causing overflows.

Simply use an std::set storing pairs of (path, package) instead,
this is very simple, and handles aspects such as ordering or the
same package appearing multiple times correctly.

Iteration becomes a bit tricky: After seeing (file1, pkg1) when
we see (file1, pkg2) we need to append pkg2 to the current line;
once we see (file2, anything), we need write out the line and
start a new one.

For memory optimization, we use a new class StringInBlock to handle
the block-managed C strings generated by Mystrdup() in a type-safe
manner. This ensures proper lifetime of objects and no accidental
conversions to std::string. This saves a significant amount of
space (a pair of std::string is 64-byte large; a pair of pointers
is 16 byte large, a 48 byte saving per entry); reproducing the Contents
file of Ubuntu 24.10, using straight-forward std::string resulted in
GB of memory usage, whereas the C-style string only uses 1.35 GB.

As a side effect of the patch we also remove arbitrary 1024-byte
buffer sizes. There also is a change in output: The package names
are now sorted alphabetically, instead of being in visit order.

LP: #2083697
</content>
</entry>
<entry>
<title>ftparchive: Mystrdup: Add safety check and bump buffer size</title>
<updated>2024-10-07T14:02:06Z</updated>
<author>
<name>Julian Andres Klode</name>
<email>julian.klode@canonical.com</email>
</author>
<published>2024-10-07T13:55:44Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=d61d86c73104d1aa84fd6ca506c2230e67727b17'/>
<id>urn:sha1:d61d86c73104d1aa84fd6ca506c2230e67727b17</id>
<content type='text'>
Add a safety check to ensure that the block were are allocating
actually fits the string we want to write. If it doesn't, abort
the program.

While we are here, bump the buffer size from 40 KiB to 4 MiB,
because why bother with smaller buffers.
</content>
</entry>
<entry>
<title>Modernize standard library includes</title>
<updated>2024-02-20T12:49:04Z</updated>
<author>
<name>Julian Andres Klode</name>
<email>julian.klode@canonical.com</email>
</author>
<published>2024-02-20T12:43:08Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=40a75722c43ae24cb9a99d6730a3b25b65819c49'/>
<id>urn:sha1:40a75722c43ae24cb9a99d6730a3b25b65819c49</id>
<content type='text'>
This was automated with sed and git-clang-format, and then I had to
fix up the top of policy.cc by hand as git-clang-format accidentally
indented it by two spaces.
</content>
</entry>
<entry>
<title>Drop unneeded usage of deprecated std::binary_function</title>
<updated>2023-01-29T11:19:51Z</updated>
<author>
<name>David Kalnischkies</name>
<email>david@kalnischkies.de</email>
</author>
<published>2022-03-20T13:39:31Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=ec60f73a790ea10a592eb5f4bb96a38f3598711a'/>
<id>urn:sha1:ec60f73a790ea10a592eb5f4bb96a38f3598711a</id>
<content type='text'>
The code isn't using any of the member types this template provides,
so we can just drop it from the code without any practical effect.

Reported-By: gcc -Wdeprecated-declarations
Gbp-Dch: Ignore
</content>
</entry>
<entry>
<title>typecast time_t and suseconds_t from std::chrono</title>
<updated>2022-09-17T03:07:40Z</updated>
<author>
<name>Khem Raj</name>
<email>raj.khem@gmail.com</email>
</author>
<published>2022-09-17T03:00:30Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=66b305f86fdee1c27edcb39f299b052c87d2d82e'/>
<id>urn:sha1:66b305f86fdee1c27edcb39f299b052c87d2d82e</id>
<content type='text'>
This fixes build on some architectures like mips
progress.cc:125:31: error: non-constant-expression cannot be narrowed from type 'std::chrono::duration&lt;long long&gt;::rep' (aka 'long long') to '__time_t' (aka 'long') in initializer list [-Wc++11-narrowing]
   struct timeval NowTime = { Now_sec.count(), Now_usec.count() };

Signed-off-by: Khem Raj &lt;raj.khem@gmail.com&gt;
</content>
</entry>
<entry>
<title>Include our config.h in all C++ files to avoid ODR violations</title>
<updated>2022-05-07T08:45:44Z</updated>
<author>
<name>David Kalnischkies</name>
<email>david@kalnischkies.de</email>
</author>
<published>2022-04-22T15:05:36Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=320245536a7ad21606286d9dcf54acf3bdf096c6'/>
<id>urn:sha1:320245536a7ad21606286d9dcf54acf3bdf096c6</id>
<content type='text'>
Some of our headers use APT_COMPILING_APT trickery to avoid exposing too
broadly details we don't want external clients to know and make use of.
The flip-side is that this can lead to different compilation units
seeing different definitions if they aren't all using the same config.
</content>
</entry>
<entry>
<title>Parse Checksum fields via pkgTagSection::Key, too</title>
<updated>2022-04-01T12:16:19Z</updated>
<author>
<name>David Kalnischkies</name>
<email>david@kalnischkies.de</email>
</author>
<published>2022-04-01T09:37:26Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=05fae6fae95d8ef6690f3d56863e3bb6a44d424c'/>
<id>urn:sha1:05fae6fae95d8ef6690f3d56863e3bb6a44d424c</id>
<content type='text'>
We abstract hashes a fair bit to be able to add new ones eventually,
which lead us to building the field names on the fly. We can do better
through by keeping a central place for these names, too, which even
helps in reducing code as we don't need the MD5 → Files dance anymore.
</content>
</entry>
<entry>
<title>Use pkgTagSection::Key in more places in src:apt</title>
<updated>2022-04-01T12:16:19Z</updated>
<author>
<name>David Kalnischkies</name>
<email>david@kalnischkies.de</email>
</author>
<published>2022-04-01T11:45:09Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=472376be6818b5ea43250abcbecfcab53b4a729a'/>
<id>urn:sha1:472376be6818b5ea43250abcbecfcab53b4a729a</id>
<content type='text'>
The speed critical paths were converted earlier, but the remaining
could benefit a tiny bit from this as well especially as we have the
facility now available and can therefore brush up the code in various
places in the process as well.

Also takes the time to add the hidden Exists method advertised in
the headers, but previously not implemented.
</content>
</entry>
<entry>
<title>Drop support for long obsoleted Suggests alias: Optional</title>
<updated>2022-04-01T12:16:15Z</updated>
<author>
<name>David Kalnischkies</name>
<email>david@kalnischkies.de</email>
</author>
<published>2022-03-28T13:25:36Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=7b8da771e2061462b9196f38366c34e4f919d0df'/>
<id>urn:sha1:7b8da771e2061462b9196f38366c34e4f919d0df</id>
<content type='text'>
dpkg-dev stopped recognizing it in 2007 (1.14.7) while building packages.
The rename itself happened in 1995 (0.93.72).
</content>
</entry>
<entry>
<title>Rename CMake find_package helpers to avoid developer warnings</title>
<updated>2020-11-05T08:40:50Z</updated>
<author>
<name>David Kalnischkies</name>
<email>david@kalnischkies.de</email>
</author>
<published>2020-11-04T23:14:32Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=287912d6fc7ab0ab0b5f69a4a5260b5bf53121ba'/>
<id>urn:sha1:287912d6fc7ab0ab0b5f69a4a5260b5bf53121ba</id>
<content type='text'>
| CMake Warning (dev) at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
|   The package name passed to `find_package_handle_standard_args` (Berkeley)
|   does not match the name of the calling package (BerkeleyDB).  This can lead
|   to problems in calling code that expects `find_package` result variables
|   (e.g., `_FOUND`) to follow a certain pattern.
| Call Stack (most recent call first):
|   CMake/FindBerkeleyDB.cmake:57 (find_package_handle_standard_args)
|   CMakeLists.txt:83 (find_package)
| This warning is for project developers.  Use -Wno-dev to suppress it.

And indeed, we checked for BERKLEY_DB_FOUND which was not defined so our
HAVE_BDB was not set – just that it is never used, so it wasn't noticed.
</content>
</entry>
</feed>
