commit b3323786668cf99bc9aed7e60ccdab0bc25e19da
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Oct 7 11:35:46 2024 +0200

    Preparing for 4.20.0

commit 9634d6c636091ac494196fe395fb2580edb146eb
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Sep 9 16:10:52 2024 +0200

    Preparing for 4.20 rc2

commit 95da643d703c31f859cfb5e404fe3896735a859a
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Sep 9 16:08:10 2024 +0200

    Update translations
    
    Been a while since the last update, might as well now before 4.20 rc2.
    
    (cherry picked from commit c62a1f41870d4561b8c9004b2a0fde7e1db61e72)

commit cc8f2abf141f4f440d6b8834ee3b58c39e36c533
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Sep 9 15:19:52 2024 +0200

    Declare signCmd() static
    
    Commit 2c9ad2bbc1d00010880076cd5c73e97ffcb946ed added this new helper
    function for internal use and depite a missing declaration, the compiler
    defaulting to WITH_CXX=ON on master chugged along just fine... only
    until porting the same commit to a C-only branch (hello rpm-4.20.x)
    where it now produces a warning, oops.
    
    (cherry picked from commit a7784eccd9de674e97fc9577434334060b3abd23)

commit 6935aa9995db567f9ef4cf82c98785cbe13d0d83
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Sep 5 09:44:40 2024 +0300

    Eliminate hardcoded GPG references from user visible messages
    
    Use the OpenPGP standard name or the configured+parsed signing command
    in messages as appropriate. Also detect if we're specifically using
    gpg and only set up its environment in that case to avoid bleeding
    those messages to innocent bypassers.
    
    Fixes: #3274
    (cherry picked from commit a3cf4f674dd59c1c80f97780643c184e705518ce)

commit 77fb0c34114175a79fbe71cf963b329998564303
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Sep 5 09:07:26 2024 +0300

    Refactor sign command expand and parse out of runGPG()
    
    We'll need the wider visibility of the executing command for the next
    steps. While at it, ensure the parsed signing command is minimally
    sufficient for what the code expects, ie has at least two items in
    the array.
    
    We now need two exit points, one for the case where we forked and one
    where we didn't. Also the case where waitpid() failed entirely must
    not return directly to avoid leaking, so merge it with the rest of
    the error handling if instead.
    
    (cherry picked from commit 2c9ad2bbc1d00010880076cd5c73e97ffcb946ed)

commit 3206798d2f50d843e79388e63c6bf830a112356b
Author: xujing <xujing125@huawei.com>
Date:   Thu Sep 5 16:28:17 2024 +0800

    Specify the private key in "rpm --addsign"
    
    Using "*.secret" may cause "rpm --addsign" to fail, and the testcase
    is actually related only to rpm.org-rsa-2048-test.secret.
    
    Fix https://github.com/rpm-software-management/rpm/issues/3277
    
    (cherry picked from commit 3141bf74ffcc0650c64611066ede8718a98ecebe)

commit 26638b496ad17e0aee11e7785b3e6cde6ebdcccb
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Sep 5 10:17:54 2024 +0300

    Pull in the main p7zip package to CI image instead of p7zip-plugins
    
    The main convoluted reason for this change is that our build process
    primarily looks for 7za and falls back to 7z if not found. Which is
    all fine except when running the test-suite locally with p7zip
    installed, which will causes the uncompress tests to fail for no good
    reason.
    
    p7zip-plugins contains the command 7z but we 7za from the main package
    handles this format just fine AFAICS, and is slightly smaller too so
    there's an additional reason to favor it in CI.
    
    (cherry picked from commit 1087a3dfae89bab79329037dd73729f85d1ac1dc)

commit 9c498f9cc54dca7886f56d0c1b888c417405a531
Author: Dirk Stöcker <github@dstoecker.de>
Date:   Thu Sep 5 10:28:31 2024 +0200

    Delete perl dependency generator leftovers (#3275)
    
    Commit 8eac3304261f229d380246cc773e88fac3c22282 forgot to remove the various .attr files along with the scripts themselves.
    
    (cherry picked from commit 727ad8a776f890d3a3cb851c091d29fbf104fddb)

commit a2235f035cdaf56e000e5e6ce6fd2b237d9aa773
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Sep 5 11:15:41 2024 +0300

    Force older gdb version in CI due to index create regression in 15.1
    
    gdb 15.1 causes our "rpmbuild debuginfo gdb index included" to fail
    because no index is created. Reported to Fedora bugzilla:
    https://bugzilla.redhat.com/show_bug.cgi?id=2310156
    
    Related: #3278
    (cherry picked from commit 8ce8afe4f9b303ddb347def7389676b5cf715b38)

commit 3faec1760dd88b3a927a3e613afd013ba67c738b
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Sep 4 10:43:26 2024 +0300

    Fix %pre and %post referred to as %prein and %postin in the docs
    
    Fixes: #2834
    (cherry picked from commit c5878f4684aa300c1bdb921bd780ef30d7e5f4cb)

commit f72d01f37dc8a8b111aa91d1666d535cd9746e6c
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Sep 2 13:08:22 2024 +0300

    Fix %transfiletriggerpostun execution over multiple prefixes
    
    Since its introduction, %transfiletriggerpostun has only executed
    matches on the first prefix of a trigger due to a missing inner
    loop on the intel gathering stage. This is pronouncedly different
    from the other trigger types where the loop does take place as a
    part of calling matchFilesNext() repeatedly. I think...
    
    Fixes: #3048
    (cherry picked from commit 60770068f9b26ba5fb9d649662277e5ae8f51e3d)

commit 66153ec9e8d77e97bafcbbac3a5645284af7f0e6
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Sep 2 13:03:31 2024 +0300

    Fix inconsistencies wrt trigger priority handling
    
    Other file triggers were added whether they have a priority or not,
    but %transfiletriggerpostun was using a different logic that caused
    it to silently skip any items without priorities.
    
    Refactor the priority retrieval to common helper and use that, and
    also use the default trigger priority of 1000000 instead of 0 if
    missing. Released rpm versions always supply a priority tag with file
    triggers but #1636 suggests there may be packages without them floating
    around. Being safe doesn't hurt, also use rpmtdGetNumber() which in
    the worst case gives us a zero instead of a NULL pointer dereference.
    
    (cherry picked from commit ec5034b9b16bede0f6fc6d32bfb79ed36649f772)

commit 8fc2fdf57a148d739e0d8d0b931faa54e71bf54e
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Sep 2 17:57:08 2024 +0200

    Add test for multiple trigger packages
    
    Like the previous commit but for regular (non-file) triggers.  Here, we
    can't distinguish the package name that caused the particular trigger to
    fire so just reuse the existing trigger.spec.
    
    (cherry picked from commit e24f7120f19b308de9512b7cc60d0c141adba607)

commit c33fe26fef6080d3265107374ffd4061720610cc
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Sep 2 16:55:07 2024 +0200

    Add test for multiple file trigger prefixes
    
    Funnily enough, we never tested multiple prefixes.  No wonder there were
    some bugs lurking in the dark corners (see #3048 and #3267)!
    
    - Add yet another test spec for triggers! (There's never enough of them)
    - Have the scripts print the prefix(es) that triggered them
    - Add an unused /etc prefix to test just that - an unused prefix
    - Shuffle the prefixes randomly in some scripts, to make it more
      interesting (and to verify that the order doesn't affect anything)
    - Rename the existing "basic file triggers 2" test to make it better
      reflect its main goal (which is "runtime arguments") and to make it
      more consistent with the newly added one
    - Mark the new test as AT_XFAIL_IF for now because the
      %transfiletriggerpostun scriptlets won't execute (to be fixed by
      #3267)
    
    (cherry picked from commit 3f1d05eae9079501ce94a106be40b9a18cd40018)

commit 4a750aea11164f1be1a7d30641c670663392eabd
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Sep 3 09:00:45 2024 +0300

    Issue deprecation warnings for rpm.redirect2null() too, oops
    
    Commit 46bd0ed2a9e70f942e7c58f953f30a66d30a5142 did document
    rpm.redirect2null() as deprecated but failed to add an actual warning
    on it. Meaning no existing user will notice it being deprecated,
    unless they were also using some of the other deprecated items too.
    
    Turn check_deprecated() into an actual function for better control,
    we'll have use for that later on.
    
    (cherry picked from commit ce269ed5ed5d9aca7ab05061b4aa27d692276024)

commit 0096735705364412406ba222e3c17fe505d32339
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Sep 2 10:51:57 2024 +0300

    Fix rpmuncompress going interactive on re-extraction of zip / 7zip archives
    
    Testing this is a PITA compared to the issue itself: we can't use the
    existing -C tests because that fails due to mv, and to avoid -C we
    need to control where it runs, and to do that we need --chdir which
    causes extra warnings from brap so we need to ignore stderr which
    we would not want to do here, really.
    
    Fixes: #2779
    (cherry picked from commit fa3ec7e3d73a93911bb8d3d1ac87c2d64eeda680)

commit d011b2559041a238eb4d949aa389643c1144fa68
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Sep 2 10:36:13 2024 +0300

    Stabilize the new rpmuncompress -C tests
    
    On-disk order can vary, sort the output.
    
    (cherry picked from commit 01fe3476a245c5e45efcef0a328d18ab510e36c0)

commit 15ff708a6c2d6048086b9c6e1eb13f6ccaf76d1b
Author: Florian Festi <ffesti@redhat.com>
Date:   Thu Aug 29 15:11:51 2024 +0200

    rpmuncompress: Support -C for zip and 7zip archives
    
    As both don't support an equivalent to tars --strip-components=1 we move
    the files out of top directory ourselves with shell commands.
    
    Support for Ruby gems is still missing - iff at all possible or
    desirable.
    
    Resolves: #3249
    (cherry picked from commit abf057616d8f73cc0540520121ea3c4cad5d8cdd)

commit 2fdbc85a6afa898ee57059bee2db969d4edbabff
Author: Florian Festi <ffesti@redhat.com>
Date:   Thu Aug 29 15:40:18 2024 +0200

    Return unique top directory iff it exists
    
    Used in the next commit.
    
    (cherry picked from commit 7b46a0d0c336ee865821de53cdcfff09752669ed)

commit 2badcab25d03e03146b8d6e64c6839e89c882526
Author: Florian Festi <ffesti@redhat.com>
Date:   Thu Aug 29 12:29:05 2024 +0200

    Replace gcc only ? : operator usage
    
    (cherry picked from commit c90733d96e93f3544853821787190fbb01472b15)

commit 130da0a24f317251d90759a5d6e66d6d66361c10
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Aug 30 09:41:37 2024 +0300

    Bump CI to Fedora 40
    
    (cherry picked from commit 3b52142b0943f61f29f3a0618baf2c1f5cc955a7)

commit f98d6d91499a42e6eb8cdc8548df49ad6382ca68
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Aug 30 09:28:27 2024 +0300

    Fix API docs build with Doxygen 1.10.0
    
    Doxygen has learned to enforce that \ingroup reference existing,
    declared groups. Good thing too, we had quite a few dangling bits
    and pieces out there.
    
    (cherry picked from commit c19b13f122120f9d0682ff795c44fc3c5465a3a0)

commit 5c94f03d287ebeb36dbef51c7612205e4507d9b2
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Thu Aug 29 15:23:16 2024 +0200

    Preparing for 4.20 rc1

commit fa2241b4bc06fe583f6efdecbddf00c7482c43a5
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Aug 27 13:27:20 2024 +0300

    Work around unowned directories in rpmuncompress -C
    
    Some archives have a directory prefix but are missing the leading
    directory entry, work around it by just comparing the leading directory
    components (if any) across the archive.
    
    Add tests for unowned directories with rpmuncompress -C
    
    GNU tar seems to always place the root directory node in there, but
    clearly not all implementations do. One of them being Python tarfile
    as of Python 3.12.5, so the test-tarballs created from the pre-existing
    source-singleroot.tar.gz content with:
    
            import tarfile
    
            tar = tarfile.open("source-singleroot-unowned1.tar.gz", "w:gz")
            for name in ["source-strip/file1", "source-strip/file2"]:
                tar.add(name)
            tar.close()
    
            tar = tarfile.open("source-singleroot-unowned2.tar.gz", "w:gz")
            for name in ["source-strip/dir1", "source-strip/file1",
                            "source-strip/file2"]:
                tar.add(name)
            tar.close()
    
    Fixes: #3250
    (cherry picked from commit 671fc8e5d6633c14c9621903a23c0040acb43f65)

commit f180f4aef454517d1e662d49359283b5f158d61b
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Aug 29 09:20:12 2024 +0300

    Extend manual debuginfo test to cover the two other main scenarios
    
    Debuginfo is traditionally disabled in packages by defining
    %debug_package to %{nil}, but since 4.20 we support the more formal
    %_enable_debug_packages switch too. Test that, and also that it fails
    if both automatic and manual debuginfo is specified.
    
    (cherry picked from commit 6c0bf4131097b8569fcf017a0ee118108be0c268)

commit 49f906998f3cf1f4152162ca61ac0869251c380f
Author: Florian Festi <ffesti@redhat.com>
Date:   Wed Apr 24 16:19:00 2024 +0200

    Honor %__debug_package when processing files
    
    If the automatic creation of debuginfo packages is switched off via the
    %__debug_package macro don't touch debuginfo packages that are
    declared in the spec file. If the packager created those on their own we
    should not mess with them.
    
    Also don't generate buildid files.
    
    Resolves: #3057
    (cherry picked from commit e0b9ffea8e73710622316e0308856cba96407d9a)

commit 2112f6d373e3d5076d16a889638ffbdf795092b5
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Aug 29 08:55:59 2024 +0300

    Fix %__debug_package value mismatch on -bb --short-circuit builds
    
    %__debug_package is used internally for determining whether debug
    packages are being generated or not. This gets defined as a side-effect
    of expanding %debug_package macro from the %install section template,
    IFF %install is processed. If we skip straight to package generation
    with -bb --short-circuit, that step is missed but rpm-debuginfo.specpart
    is still being read, causing a mismatch between expectations. This
    only works now because of bug #3057 and without this change, the
    the tests on -bb --short-circuit would fail when that bug is fixed.
    
    To fix the discrepancy, place a duplicate %__debug_package definition
    into the rpm-debuginfo.specpart so it gets defined whenever that file
    is read. Unfortunately the definition there is not enough for other
    parts of the machinery, the %install template macros need
    %__debug_package defined before we get to reading rpm-debuginfo.specpart
    for the first time.
    
    (cherry picked from commit 1a9803d0f8daf15bb706dc17783ab19589906487)

commit 11ea8be65c3f6fd279a10601410f398abf64fdb7
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Aug 27 09:50:48 2024 +0300

    Fix rpm.execute() return code handling
    
    The status returned from waitpid() is not your exit code, it's encoded
    and needs processing the W*() macros, like we do in the new rpm.spawn()
    function.
    
    These two should really be refactored to use common code, but leaving
    that to later because one is in C and the other one in C++...
    
    (cherry picked from commit b066411c46589f85b77543fc83adbbc98c6b307c)

commit 72a60c6e7541911301d10b96b612785663c864b2
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Aug 12 17:03:17 2024 +0300

    Add rpm.spawn() Lua API
    
    Turns out real-world usage needs more control than rpm.execute()
    delivers. This could be crammed into rpm.execute() but it'd be forward
    incompatible in a somewhat non-obvious way, we might just as well
    add a separate function for it.
    
    Supports redirecting stdin, stdout and stderr to a given path, support
    for file descriptors, other actions and spawn attributes can be added
    later.
    
    Fixes: #3192
    (cherry picked from commit 6444f712869b1b81b4c5790ec390a6b98751336a)

commit 1f9cac325201370102ac69d9e73f2599f09725e9
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Aug 19 11:43:33 2024 +0300

    Report unsafe symlinks during installation as a specific case
    
    RPM refuses to follow non root owned symlinks pointing to files owned by
    another user for security reasons. This case was lumped in with
    O_DIRECTORY behavior, leading to confusing error message as the symlink
    often indeed points at a directory. Emit a more meaningful error message
    when encountering unsafe symlinks.
    
    We already detect the error condition in the main if block here, might
    as well set the error code right there and then so we don't need to
    redetect later. We previously only tested for the unsafe link condition
    when our O_DIRECTORY equivalent was set, but that seems wrong. Probably
    doesn't matter with the existing callers, but we really must not
    follow those unsafe symlinks no matter what.
    
    Co-authored-by: Florian Festi <ffesti@redhat.com>
    
    Resolves: #3100
    (cherry picked from commit 535eacc96ae6fe5289a2917bb0af43e491b0f4f4)

commit 35f00a2dcac8bd16b19dd3d8b2a5249987e499e9
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Aug 19 11:03:10 2024 +0300

    Refactor fsmOpenat() return style for consistency within the fsm
    
    Everything inside the fsm is returning a return code as the main
    returned data and file descriptors as one of the arguments, except
    for fsmOpenat() which I for some reason modeled after openat() instead.
    This mismatch makes for some strange code in the callers.
    
    The only visible change here is supposed to be the error message
    changing slightly due to using rpmfileStrerror() instead of strerror().
    
    Co-authored-by: Florian Festi <ffesti@redhat.com>
    (cherry picked from commit 14516542c113560dc0070df2f9102568a7a71b58)

commit 1e47ea4f783aa2c192861324ee8d230cb5d333e9
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Aug 21 16:36:07 2024 +0300

    Define --build-in-place in more clear and actually supportable way
    
    Defining in-place builds to skip %prep suddenly makes this feature start
    looking supportable, because it's no longer ambiguous every which way:
    %setup is supposed to have all manner of side-effects that in-place
    builds would skip, including cd'ing to %buildsubdir. It's not possible
    for calling %setup to both have and not have side-effects.
    
    Besides %setup ambiguity, %prep typically contains patch applications
    and those cannot be meaningfully done on in-place build because then
    the build is no longer repeatable.
    
    Update the man page description to describe the new %buildsubdir
    based behavior, and make %prep skipped on in-place builds no matter
    what other options got passed. This WILL break some existing users
    if they rely on %prep getting partially executed, but that's how
    it is with ambiguity. If there's another non-ambiguous way to
    solve this, I'm not seeing it.
    
    Fixes: #3208
    (cherry picked from commit e0925ad6e3185030b004343f73a5917fdc562d6c)

commit 822583509efdbee7715bd8cf29c4bffeebe0f29f
Author: Jakub Kadlcik <frostyx@email.cz>
Date:   Fri Jun 21 12:01:16 2024 +0200

    Add real-life examples of Python RPM
    
    See https://github.com/rpm-software-management/rpm-web/pull/54
    
    (cherry picked from commit e927be7e193fe7fea6917d78aec0f25128fef38e)

commit 580cfc63887ba710c54c78851dffc6b39b7f8853
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Aug 21 15:03:08 2024 +0300

    Restore --build-in-place with --noprep functionality
    
    In rpm >= 4.20 we always have to have the build directory.
    Commit c74ab58f081937eefd0f79af8d0310495d321864 linked its creation
    to --noprep but that was under the assumption of normal builds
    where %prep has already been executed, and we're re-entering the
    already created directory structure for another build stage.
    
    --build-in-place being what it is, there's basically nothing to do
    at %prep so it seems natural that this should work. The linux kernel
    upstream packaging uses this to allow quickly building "dirty" rpm
    from a git repo directly, but faciliate a full regular rpmbuild
    from an src.rpm built this way. It seems like a reasonable thing,
    in fact this makes me think that --build-in-place should imply
    skipping %prep, but lets not go there yet...
    
    Make sure %mkbuilddir gets run if we execute any build steps, this
    is fairly subtle to preserve --short-circuit too.
    
    Fixes: #3216
    (cherry picked from commit f4e6aecceafee90a2b2c6027c08b453218e81b91)

commit 7abb8cfb81e9c70884485fb742836db6ac934df6
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Wed Aug 21 15:15:27 2024 +0200

    Add a test for -qa with positional args
    
    This use case (of narrowing down an --all query with positional
    arguments) is no longer specifically tested after the previous commit so
    add a simple test for that.
    
    Since we want a bunch of packages to be preinstalled, make use of the
    test image's rpmdb by simply not initializing an empty rpmdb with
    RPMDB_INIT.
    
    (cherry picked from commit 19de35f5c4927c0390fcd986c6805e3d31aac544)

commit 39c91f0e53679643ab7fc25f99c0b08d80862ef2
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Wed Aug 21 15:02:36 2024 +0200

    Fix -V option usage in our tests
    
    Coupling -V with -a when querying for specific packages makes little
    sense and only causes the order of the output lines to depend on the
    database ordering.
    
    This is known to vary between the ndb and sqlite backends in particular,
    confusing some of the tests that expect the lines to be in a specific
    order.
    
    While at it, fix all such questionable usages, even those that only
    entail one package argument.
    
    Fixes: #3242
    (cherry picked from commit 826cbb8869e7d640fe3c2582a3a8dacf393e1ee0)

commit c0ce5bf7f22599a0f81b61f63dc6f03b4db378aa
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Aug 21 15:33:01 2024 +0300

    >() redirects considered harmful, part 1.5
    
    Argh, commit 2931cbd7b1281395d18ff88e40e024659b4cfbf5 forgot to
    remove the redirect. This new combo also evoked new tricks:
    now the entire stderr output goes missing sometimes.
    
    (cherry picked from commit b5f49b1275337f413bc4eded675783926c2b5529)

commit 6145a065163903aef596ff9d927d0eab8a018d28
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Aug 21 13:54:35 2024 +0300

    >() redirects considered harmful, part II
    
    Turns out it's not just the two fork-related tests mentioned in
    commit 2931cbd7b1281395d18ff88e40e024659b4cfbf5 that are unreliable,
    it's the bash-specific >() subshell redirect that causes those
    unexpected extra newlines moving around in the test-suite, and here
    are two more tests that occasionally now fail.
    
    Adjust the tests to avoid that construct, which should be considered
    banned in the test-suite from here on...
    
    (cherry picked from commit bde179aca2c5ed227c0cea750a828bd34fb94927)

commit 83d42b0ccb47d7418180b3a019df1fe243c3256c
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Aug 19 16:04:58 2024 +0300

    Make Buildsystem %conf section optional
    
    The idea behind making it mandatory was that surely every real buildsystem
    implements a configuration step, right? Well, at least Python setuptools
    only has build and install, and for our purposes it certainly qualifies
    as a buildsystem. And where there's one, there'll be more.
    
    Suggested-by: Miro Hrončok <miro@hroncok.cz>
    
    Fixes: #3244
    (cherry picked from commit 7f3488604f469f9cc99cce9cc9d36114cf8543f0)

commit caf7b8cde81f00db1678a110648cc262b07f28b7
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Aug 20 13:10:28 2024 +0300

    Another attempt at stabilizing posix.fork() and url retrieve tests
    
    Both these tests (currently 12 and 90) are flaky and sometimes fail
    with the trailing newline at the front, eg test stderr showing:
    
        +
         warning: posix.fork(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.execute() instead
         warning: posix.wait(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.execute() instead
         warning: runaway fork() in Lua script
        -
    
    It's all the more bizarre since we're NOT expecting that trailing
    an empty line after the messages in the first place.
    
    Let's try another trick from autotest: just grab the stderr into a
    file that we process in the next test. Autoconf manual says
    "This action is often used when it is desired to use grep to look for a
    substring in the output, or when the output must be post-processed to
    normalize error messages into a common form." Which is exactly
    what we're doing here.
    
    Time will tell, but at least we're now seeing the last newline on both
    tests as I would expect.
    
    (cherry picked from commit 2931cbd7b1281395d18ff88e40e024659b4cfbf5)

commit 5d5b58fa92ab6b9153cdf416447d081c06c25abb
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Aug 12 17:15:48 2024 +0200

    Fix memory leak in rpmsign
    
    Found by Coverity.
    
    Fixes: RHEL-37564
    (cherry picked from commit 65fa582b5cb267bb73c3e2b4c502f456d50c41f0)

commit dc600268c59bd0a59c603409f7cf4305a5461226
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Aug 7 12:42:36 2024 +0300

    Fix crash on Lua file trigger exiting with return'ed data (#3029)
    
    Reset the Lua stack on return from rpmluaRunScript() to discard any
    unhandled returned data from the scriptlet. This may happen if there's
    eg "return 0" from a non-macro scriptlet.
    
    We could check for a numeric return value here and treat it as an exit
    code, but then what to do with other kinds of returned data?
    Our documentation states errors in Lua scriptlets should be signaled with
    Lua error() function, it seems better to stick with that and avoid
    introducing ambiguities and incompatibilities.
    
    Update the existing file trigger tests to cover this case.
    
    Fixes: #3029
    (cherry picked from commit 05fbeb97a92608a9f66faa3f8d1c0fb67b0db62c)

commit d3a97e69ea2951941a1c3b2431612d6085c4b692
Author: Michal Čihař <nijel@debian.org>
Date:   Sun Apr 21 11:10:43 2024 +0100

    installplatform: log when a platform file is created
    
    Eases debugging problems when creating platform files, especially
    on exotic architectures
    
    (cherry picked from commit 652ee3c8898ba0ae012bcb265cc5f89505d7795f)

commit 2a617185c58feeb50121661021ad66550fa86743
Author: Florian Festi <ffesti@redhat.com>
Date:   Tue Aug 6 11:49:15 2024 +0200

    Document %__file_name and %__file_lineno
    
    (cherry picked from commit e03674aae18d15f5073e95adc5443c3b2c5ab7c3)

commit 8b4222bbadabffcece864d1ca3cfc0a7bd95a7d1
Author: Florian Festi <ffesti@redhat.com>
Date:   Mon Aug 5 16:27:59 2024 +0200

    Better warning for %autopatch without patches
    
    Add file and line number to the warning.
    
    Suppress the warning when called from %autosetup and offer -q to
    suppress the warning in general.
    
    Resolves: #3230
    (cherry picked from commit 46b3e7649d36a28da7e4bce43e8dc281ee087c1b)

commit 3e9fd56cf3042ada2538678dccc3137fc615d2ff
Author: Florian Festi <ffesti@redhat.com>
Date:   Mon Aug 5 17:16:14 2024 +0200

    Add test case for autosetup without any patches
    
    Ensure there isn't a warning created.
    
    Related: #3230
    (cherry picked from commit 6f08a20918c9e8d7017acc004ca2ece35d8cde53)

commit 52143d89458a34b56a652567b56ae69ef94d47e2
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Jul 30 11:48:18 2024 +0300

    Make the second urlhelper test much less racy
    
    /bin/false exits so fast that racing with the parent output order is
    a fifty-sixty situation at best. Use a purpose-made shell script that
    does a bit of IO and even sleeps a bit, which together with shell
    startup time should be plenty enough to guarantee stable output for
    most practical purposes. If it *still* bugs us after this, we can always
    sort the output.
    
    Fixes: #3210
    (cherry picked from commit 8e1e93596fbb37224f37c645cdae485ad7d9be0f)

commit 0a2cec7a799d7c6cd4c500080beba6331886acd9
Author: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date:   Mon Jul 29 18:03:13 2024 -0400

    Add .editorconfig, and note in CONTRIBUTING doc
    
    (cherry picked from commit dd498cd2f7c1d1123006853a74400e9b125408be)

commit d4aa7ef90bced7b709db59c2ca45d76fcc8a98a2
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Fri Jul 26 10:44:04 2024 +0200

    Fix root relocation regression
    
    When relocating the root directory, make sure we insert the new path's
    dirname to dirNames[] even if the root itself is owned by the package.
    
    This appears to have been the intention from the first version (largely
    untouched since) of this code as we allow the root to pass through the
    first checks (by setting len to 0 in that case) as well as the second
    for loop where we do the relocations.
    
    This allows fsm to properly create and remove the relocated directory
    since we're now using fd-based calls (#1919) and the parent directory
    needs to be opened first.
    
    No need to do string comparison here, the empty basename signals that
    we're processing the root directory, so just use that.
    
    Building a relocatable package that owns the root directory seems to be
    a handy way to create user-installable packages (see RHEL-28967) and it
    happened to work before with the path-based calls so this technically
    was a regression.  Add a test that emulates this use case.
    
    Fixes: #3173
    (cherry picked from commit 308ac60677732e9979b9ce11e5a3085906da1901)

commit 15d951d89cbb4eb1712e5da0337d0341546e4623
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Fri Jul 26 10:43:50 2024 +0200

    Make sure dirs are not relocated twice
    
    When processing relocations, new dirnames are added to dirNames[] first
    and then the rest is relocated.  However, we go through the entire array
    in the latter step, meaning that we may accidentally relocate an already
    relocated path.
    
    Most relocations are fine as they involve two separate directory trees,
    and we already skip over directories that don't match the old prefix.
    However, that breaks apart if we're relocating to a nested subdirectory
    (e.g. /opt -> /opt/new/dir).
    
    Fix this by simply stopping at the original dirCount as the new entries
    are always added to the end of dirNames[].
    
    Such relocations are perhaps not very common (or even unsupported) but
    relocating the root directory itself may be useful (see the next commit
    for details) and that is subject to the same issue.
    
    Note that we currently don't handle root relocations properly to start
    with but that will be addressed in the next commit, this prepares the
    ground.
    
    (cherry picked from commit 31c14ba6610568c2d634647fed1fb57221178da9)

commit 271b89f8580f692f88dc3ee02ee5dda6f74962d1
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Tue Jul 9 11:41:45 2024 +0200

    Add syntactic sugar for non-root user tests
    
    Make it easy to write tests that run commands as a regular user, and
    document it.
    
    Note that --new-session is needed with bwrap in order for sudo(8) to
    work properly when multiple bwrap containers are running in parallel
    (otherwise it would hang).
    
    To be used in the next commits, no functional change here.
    
    (cherry picked from commit 372cf5e37dea1beaec96d5c264e4e87c658cbd21)

commit 592e761cad58714ad95c64b9710f37f662f9669c
Author: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date:   Tue Jul 30 10:29:50 2024 -0400

    Build: Add include dirs to exported lib targets
    
    Each library target's exported `INTERFACE_INCLUDE_DIRECTORIES` list,
    as written into the `rpm-targets.cmake` export file, is controlled by
    the `PUBLIC` arguments supplied to `target_include_directories()` for
    the library target.
    
    * Directories scoped with the `$<BUILD_INTERFACE>` generator expression
      will be included in the export file written to the build dir by
      `export(TARGETS...)`
    * Directories scoped with `$<INSTALL_INTERFACE>` will be included in
      the `rpm-targets.cmake` file installed into the
      `${CMAKE_INSTALL_LIBDIR}/cmake/rpm/` configuration directory.
    
    Providing `PUBLIC` include directory paths for both the build and
    install contexts is important, because without them the exported
    CMake configuration is useless to library consumers.
    
    (If the build is installed into `/usr/` or `/usr/local` it won't
    matter, because the include directories required are the default
    `/usr/include` or `/usr/local/include/` paths. But an install
    targeted elsewhere with a `CMAKE_INSTALL_PREFIX` path needs an
    `INTERFACE_INCLUDE_DIRECTORIES` property of
    `${CMAKE_INSTALL_INCLUDEDIR}` to correctly locate its installed
    includes.)
    
    (cherry picked from commit 930b146bc09e7d5269281c0cefd9bef582d833ae)

commit 36a09fe2de41032a2efd2d472d25dbe1750f45a9
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Wed Jul 31 16:19:40 2024 +0200

    Fix division by zero in elfdeps (RhBug:2299414)
    
    Assume that the section does not hold a table if sh_entsize is 0 (as
    specified in the elf(5) man page) and just skip it if that's the case.
    
    (cherry picked from commit 02ffc5158d1ad270e0b5c7ce6dfe4414a6ec029f)

commit fd54040dc6d8fa932c18449e34562adeaafd9e0a
Author: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date:   Mon Jul 29 17:51:35 2024 -0400

    Macros doc: Fence left-hand column of macro tables
    
    - Remove tab characters from table definitions, and align with spaces
    - Fence or escape some bare text strings that resemble HTML tags
      (`<body>`, `<source>`)
    - Add trailing `|` in table rows that lack final column
    
    (cherry picked from commit 7ae180573869908dceab88942b4b18424c2144d6)

commit a8a0875e01b5f3d4ae2b7faaea2937eac801f8b8
Author: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date:   Mon Jul 29 17:47:47 2024 -0400

    Macros doc: Convert expansion explanation to table
    
    (cherry picked from commit de903c9ac9afd772dd37c8ef2831e2dccea44472)

commit b9a023771eff479fc8ee68ad6207c863dddb124d
Author: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date:   Mon Jul 29 17:47:01 2024 -0400

    Macros doc: Unindent fenced code blocks
    
    (cherry picked from commit 983e1de6153e0df11547d66c29ea80aa55e934d0)

commit 2199979a82624146622897d99c693da09b46fc59
Author: Florian Festi <ffesti@redhat.com>
Date:   Thu Jul 18 13:04:28 2024 +0200

    Reset recursion depth for error message
    
    $ rpm --define 'aaa %[%aaa]' --eval '%aaa'
    
    let to a core dump due to a stack overflow. This was cause by the
    generation of the error message failing due to being too deep in the
    recursion of the macro expansion - creating more error messages.
    
    Resetting the depth counter allows rendering the error message. As we are
    failing and breaking off the parse run this is fine to do.
    
    Thanks to Miro Hrončok for reporting
    
    Resolves: #3197
    (cherry picked from commit ef87d2503498f65577b5d7af07cd453d622fe02c)

commit bf6d28b26af5c6799de229438d4e172d1ff4d339
Author: Miro Hrončok <miro@hroncok.cz>
Date:   Tue Jul 23 10:17:53 2024 +0200

    Undocument %patch1 (#3193)
    
    * Undocument %patch1
    
    Co-authored-by: Florian Festi <ffesti@redhat.com>
    (cherry picked from commit be01f0075d48a7bed38f08bf2237c4c3e1d9b4f3)

commit 84783b4d08bd0de5f54951f1e0bcc860914923a1
Author: Florian Festi <ffesti@redhat.com>
Date:   Fri Jul 19 17:14:32 2024 +0200

    Properly quote REs in file attributes
    
    A literal dot needs to be quoted by two backslashes as the macro parsing
    already consumes one. This was done quite inconsistently. As a result
    several regular expressions were more permissive than they should have
    been.
    
    Resolves: #3212
    (cherry picked from commit b19395abc49c9e7d4e990f959c41d3b3b03f277d)

commit 8dfda671cd017fdfa969c95a7bffe63a72011469
Author: Florian Festi <ffesti@redhat.com>
Date:   Fri Jul 19 12:01:25 2024 +0200

    Make "minimal" file attr more clear
    
    Looks like people were confused by the fact that having a file attr not
    matching anything was legal. Be more explicit what is expected to make
    them actuaqlly useful.
    
    Resolves: #2951
    (cherry picked from commit 4dc6167465e15f8a0098a55f728f124802a40fbe)

commit 48be62f2a61051a285174c3ba30c0e7edda60865
Author: Florian Festi <ffesti@redhat.com>
Date:   Fri Jul 5 13:24:16 2024 +0200

    Sort output for test case to avoid race condition
    
    As the test uses fork() the processes can write out the lines in different
    orders
    
    Resolves: #3106
    (cherry picked from commit a57eea879d0e47a869f191dc7933fa9b1ad30b83)

commit c8ebd0560f1b68c7b9549d1a4d087b69c16128e8
Author: Florian Festi <ffesti@redhat.com>
Date:   Mon Jul 8 13:52:52 2024 +0200

    Better error for build system issues
    
    Give different errors depending on a build system not existing at all or
    not be defined properly. This makes it easier to detect issues in the
    build system declaration and no longer requires developers of new build
    system macros to pass --verbose to get meaningful messages.
    
    Resolves: #3190
    (cherry picked from commit 184475d40c7c05449e8da139a6c44974a9c4cae0)

commit eb880d88299651024ddca7eb8f84ab554ca3a0c3
Author: Bernhard Rosenkränzer <bero@lindev.ch>
Date:   Mon Jul 8 20:03:15 2024 +0200

    Add missing newline in sysusers Requires
    
    Without the newline, a sysusers file like
    
    ```
    u saned - "SANE daemon user" /etc/sane.d /bin/false
    m saned cdwriter
    m saned usb
    m saned scanner
    ```
    
    Results in "funny" requirements
    ```
    group(cdwriter)user(saned)
    group(usb)user(saned)
    ```
    
    (cherry picked from commit ea0685371f472c7591ed091a65a27f5781a1dbe0)

commit 09fc7cf26345f116354599317f61cd8767273eda
Author: Florian Festi <ffesti@redhat.com>
Date:   Tue Jul 2 14:29:33 2024 +0200

    Add warning for %autopatch not applying anything
    
    It is possible that the range given to %autopatch is not matching any
    actual patches. Issue an warning to give the packager a chance to
    realize that there is something fishy. Not turnng this into an error to
    not break existing builds.
    
    Resolves: #3093
    (cherry picked from commit d94dbcc24f6478719ab7e4c050362e28a1482891)
