When placing new partitions and there's space left because the new partitions aren't occupying the whole free space, context_grow_partitions_on_free_area() is supposed to distribute the free space between the new partitions. If still no partition wants the free space, the free space ends up becoming padding. Currently that padding is allocated to the partition preceding the FreeArea (ie. a->after). This obviously means that the new partitions now end up at the *end* of the free area rather than at the beginning, which is somewhat unexpected given how partition placement usually is done. Fix it by finding the last partition that belongs to the free area, and then allocating the padding to that partition, so that the new partitions end up getting aligned with the beginning of the free area, not the end. Because the span might not be rounded to grain if there's a pre-allocated a->after partition before the free area, we need to round it down ourselves (otherwise the "left >= p->new_padding" assertion in context_place_partitions() is going to fail). Also ensure the fix works as expected by adding a test.
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
