commit 4588bc3f994338502d2770ad24cbfcdaa6c335ec
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Wed Mar 1 15:46:05 2023 +0100

    Preparing for rpm 4.18.1
    
    Bump current in rpm_version_info to supersede 4.17.x.  No soname bump
    (age 0) required though since we didn't change or remove any interfaces
    since 4.18.0.
    
    Resolves: #2113

commit 1e01be65ddd534d595f7397ee604fa51e32130b4
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Feb 22 09:31:06 2023 +0200

    Copy original lead on signing instead of recreating
    
    Fixes a regression from commit 3255273ae0fabd03c9738249a29c9c1e15f28f64
    where the arch and os fields of the lead may change depending on the
    package arch and the host where --addsign/--delsign is executed.
    
    This is hard to test for specifically as the test-suite can run on any
    architecture, but the bit-per-bit comparison test added in the previous
    commit will catch differences here too.
    
    Fixes: #1326
    (cherry picked from commit 0c02e4899e72eae8ccb484fbb22c04f12fae2f0d)

commit a94e971dbb10e8bc929108a65c7bb1d5b1d9e77e
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Feb 22 12:01:59 2023 +0200

    Fix signature reserved space not restored on --delsign (#2382)
    
    Fixes a regression from commit 5c279fb149a44a1bc4d19e11c3c01942732b8486
    simplifying this a bit too much, and failing to restore the reclaimed
    reserved signature space on after --delsign. Add a test-case to ensure
    --addsign + --delsign returns the package to its original state
    bit-by-bit.
    
    Fixes: #2382
    (cherry picked from commit be950eabb84a88e5773e096435c37b92e3d47ebb)

commit e5592b233c1fe4d3e66597055e40f0b5ff043b47
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Tue Feb 21 14:21:14 2023 +0100

    Don't repeat %patchN deprecation warning
    
    Avoid flooding the build log for SPECs that contain a lot of these
    lines, one warning should be enough.  Just mention how many were found.
    Including the line itself in the message is no longer relevant so remove
    that, too.
    
    The cost we pay for having the total count is that we'll no longer log
    the warning when an RPMLOG_ERR occurs somewhere in the process.  Moving
    it below the exit label would fix that but also cause the warning to
    always be printed *last*, possibly confusing the user if there's an
    actual error further up in the output... so just go with the former.
    
    Note that we may want to revert this in the future and replace it with a
    proper rpmlog-native suppression mechanism for duplicate warnings.
    
    Fixes: #2383
    (backported from commit 6c17e2fbee8ae2aa7ab960a4ede380dfba55e610)

commit 67b6660d7ed862e5203695e2a401023a6a00e9b6
Author: Jan Engelhardt <jengelh@inai.de>
Date:   Mon Feb 20 10:00:44 2023 +0100

    docs: update grammar in dependency_generators.md
    
    (cherry picked from commit e3c11a790367016aed7ea48cfcc78751a71ce862)

commit 3113c591f578b8909f3de5ca8db53d8085a3a647
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Feb 16 12:25:24 2023 +0200

    Disable debuginfod server lookups in build and dependency generator scripts
    
    With recent elfutils (0.182 or so) various seemingly innocuous tools
    such as `readelf` like to do network lookups for ELF symbol information.
    There's no circumstance where we'd want that to happen during rpmbuild,
    so disable these lookups during all spec build scriptlets and also
    dependency generator children.
    
    (cherry picked from commit b927c044b8809c4dd892f75737240a20c32c2b90)

commit 4d866dce3454989348fe5527f2051c8323f056ac
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Feb 16 12:18:02 2023 +0200

    Exclude kernel modules from ELF dependency generation
    
    The kernel modules are technically ELF DSO's but we only care about
    library level dependencies which the kernel modules will never have, so
    processing them is just waste of time.
    
    This "regressed" when we dropped the "exeonly" flag from ELF in
    commit 8901a6be1652519c4875436e29e0a663be0790b7.
    
    (cherry picked from commit 91467e715769e8ef0b1dafce288e9313aca41bb4)

commit c187c29a394ace01e1ed929450c1a4ee9df74456
Author: Pavel Simovec <psimovec@redhat.com>
Date:   Tue Feb 7 15:06:24 2023 +0100

    fix typo
    
    (cherry picked from commit 045dd10e1f52190b6bada3c83e4537354889626f)

commit 4d373b36b89ddcb284a3c22eff71d0fc7d266d32
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Feb 6 09:48:22 2023 +0200

    Document rpm codebase comment style
    
    (cherry picked from commit 7f8675936c87209f41e248da79277ff5f2a385c2)

commit ee38497d72012828ce3ba0ee4a99dc41c6e4953f
Author: (GalaxyMaster) <galaxy4public@users.noreply.github.com>
Date:   Tue Jan 31 18:24:55 2023 +1100

    support for POSIX getopt() behaviour
    
    [POSIX defines optarg only for options with arguments](https://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html) and callback() is expecting optarg to be NULL for options without arguments, however, at least on musl optarg will carry a pointer to the argument of the previous option with argument.  This commit makes the behaviour deterministic and expected.
    
    (cherry picked from commit 1f47b1cc0eddbb1921d81249a4bd604089c71495)

commit 540e178782c884f2307324c73e0259fe4226dee3
Author: Tomas Korbar <tkorbar@redhat.com>
Date:   Thu Jan 26 11:19:46 2023 +0100

    Split ___build_pre macro to make mocking rpm build environment easier
    
    New macro ___build_package_notes_env contains environment variables
    that package-notes depends on. This allows easier mocking of rpm
    build environment and isolated execution of check phase of rpm
    packages possible.
    
    (cherry picked from commit a3889fe5b96812c0dd787317cbc9f1ecda917995)

commit 64a81370faa561d673cacc42a707001c990e4fff
Author: Adam Williamson <awilliam@redhat.com>
Date:   Sat Jan 28 12:28:51 2023 +0800

    Update comments
    
    (cherry picked from commit a9ac1727a637e24c27570daeb045651cc1b8f45f)

commit 719ea7e09e3e077d78960ccb16110e796892baf1
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Jan 19 09:55:14 2023 +0200

    Fix macro scoping level on re-entry from %[] expresssion (#2354)
    
    This is the same issue as commit 1767bc4fd82bfacee622e698f9f0ae42c02126fa
    was with Lua, and so the same fix works: restore the nesting level
    from the macro context when re-entering macro engine from %[]
    expression. Analysis and suggested fix by Michael Schroeder,
    reproducer from Miro Hrončok.
    
    Add tests for both %[] and %{expr:...}, although the latter isn't
    affected because the expression is macro-expanded beforehand.
    
    Fixes: #2354
    (cherry picked from commit fd2f743b3ef543a5b6fe963b2ec8c3c43b8424b9)

commit c90144e2f899e4a5e053ecf899b1c4036be3e35c
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Jan 16 12:08:48 2023 +0200

    Issue deprecation warnings on %patchN syntax
    
    (cherry picked from commit eb5ece1267a22330f6116149997cf5cc1c22b21f)

commit 56c190f181b1a75f6402400fef1e3229f3701276
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Jan 16 12:06:47 2023 +0200

    Briefly document %setup and %patch in reference manual
    
    Take the opportunity to document the recommended and deprecated syntaxes
    and their availability across rpm versions.
    
    Fixes: #2209
    (cherry picked from commit c18f62e7b0630394e0bf2ccee0239a0cddd93d0a)

commit 632cda5d8da10ee8bc611839e55bb7c2d3ae1d3b
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Jan 16 11:07:33 2023 +0200

    Convert most of our examples to use a modern %patch syntax
    
    In order to properly deprecate the syntax, we need to move ourselves
    off it first...
    
    (cherry picked from commit 6edbb02d30a862be990c634d859ac80c6239f3f8)

commit ae19700160b3c4a029cb62f96d09422c6c9758c8
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Jan 13 11:03:27 2023 +0200

    Use our O_DIRECTORY equivalent when opening files for setmeta
    
    Ie if we expect a directory, ensure we got one.
    
    (cherry picked from commit ccfca4146d3c0c7ac3a3be37b3ea501620954d2f)

commit 6792666f1be55abe487648f564fb0855d4cb8c15
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Jan 13 10:57:03 2023 +0200

    Explicitly specify O_RDONLY when opening files for setmeta
    
    On Linux, this is a no-op as O_RDONLY is 0 but this may not be so on
    other platforms. Another 4.18 regression.
    
    (cherry picked from commit 3a7c8bc401a97f0ebf57bef3987a337129e4371f)

commit f72c7800ae1e02ed6dfe3a240c4dc756883cc2ac
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Jan 13 10:44:28 2023 +0200

    Add a test for special device node installation
    
    This is a bit theoretical as it does not work for regular users or in
    containers which are the typical scenarios for running the test-suite.
    
    (backported from commit 5dcc399cd21f607f13eb092a3abfc8b8daa59d4c)

commit 1c169a4089c3d08069651a33a20be67f26cfbfc4
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Jan 13 10:16:35 2023 +0200

    Never follow links in path-based chown()
    
    This is basically a leftover from the initial conversion to the *at()
    family in commit 1bab34c6e45c549c7829e469ba35bdececbb84e8 - the logic
    was already there and only converted to the *at() form. But this is not
    only potentially insecure (remember all those symlink CVEs) but also
    wrong simply because it's inconsistent with the other metadata ops which
    never follow links in path-based mode.
    
    (cherry picked from commit 3a3e10b9813bdfc4223aedc82292386a50510b04)

commit 8b5cce9a68f93a3b7826a9de6547341855e9dfe2
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Jan 13 10:00:37 2023 +0200

    Use fd-based ops for metadata in FA_TOUCH mode too, when possible
    
    Fixes another brainfart in commit 25a435e90844ea98fe5eb7bef22c1aecf3a9c033.
    
    (cherry picked from commit 932013698149d43720cc321c8df2f99f51866e18)

commit e10255a7427ba0bf1f509afe9f5a9f1ead23cd99
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Jan 13 08:57:27 2023 +0200

    Fix install of block and character special files (#2195, #2275)
    
    While it's possible to open special files, they are, well, special and
    have "side-effects" also known as, ahem, semantics. Opening a device
    file in Unix means accessing that *device*, and FIFOs have their own
    semantics.  In other words, for rpm's purposes, we should never EVER
    open these files as a part of the install / permission setting etc.
    Fix this major brainfart in 25a435e90844ea98fe5eb7bef22c1aecf3a9c033.
    
    OTOH this forces us back to the less secure path based operations for
    these files, which is what we were trying to avoid in the first place.
    There always was a tiny race between create + open for these (because
    there's no atomic way to create + open anything but regular files) but
    this opens up the window quite a bit.
    Nobody should be placing device nodes in user-owned directories but
    FIFO's may be a different story.
    
    We haven't had tests for device nodes because it requires privileges the
    test-suite usually doesn't have, not testing FIFOs I have no excuse for.
    Add that test now.
    
    Fixes: #2195, #2275
    (backported from commit 28c92fd54c93371c3062664d8a938438a2be88d6)

commit 9513d3e7949dc302508028839dd43b52abf2439f
Author: Wenlong Zhang <zhangwenlong@loongson.cn>
Date:   Tue Jan 3 14:29:18 2023 +0800

    Revise ISANAME for loongarch
    
    %_isa is already adding -64. No need to have 64 twice.
    
    Signed-off-by: Wenlong Zhang <zhangwenlong@loongson.cn>
    (cherry picked from commit a4a0a10b1fc8f02b32bd21d22215b54e049e93f9)

commit 5e6a510abe52cd6337758d088739e4539ae0e571
Author: yangchenguang <yangchenguang@uniontech.com>
Date:   Fri Jan 6 11:14:03 2023 +0800

    Testcases: rpmbuild source name with space
    
    Signed-off-by: yangchenguang <yangchenguang@uniontech.com>
    (backported from commit 2b9342a0ecde00be145653e122e8cd32fabbae5a)

commit 53cb48224421a74aa4d0dc3c378420599fdaa152
Author: wangpeng <wangpengb@uniontech.com>
Date:   Fri Jan 6 09:49:50 2023 +0800

    Quote source file names in %setup
    
    Resolves: #2335
    Signed-off-by: wangpeng <wangpengb@uniontech.com>
    Co-authored-by Florian Festi <ffesti@redhat.com>
    (cherry picked from commit 71dedfd2f434ea54fc3a920e4b44a8737ba6cb25)

commit e12ad60e5017a5e6b1133fa8f4c9e2c09f6f9b3a
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Jan 11 11:42:59 2023 +0200

    Un-deprecate %_changelog_trimtime
    
    Deprecating implies plans to remove later, but this is actually just an
    alternative strategy for changelog trimming, and different distros may
    have different needs.
    
    (cherry picked from commit 4fde659835409669b51850a8e49743b468f0631b)

commit c39626ec68b0cc5b5efd66aecfaf23992c762467
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Jan 9 09:59:27 2023 +0200

    Use proper macro conditional negation syntax in the manual
    
    Historically only %{!?foo} syntax has been used, the reversed ?! version
    was only introduced in 0d75ef1e0a0609ee61386f02fa311d6d8ac79450 (perhaps
    accidentally) and should not be used, much less recommended.
    
    (cherry picked from commit 7b0b5e7d2cf53817ec5e2545c5f591a26db72cec)

commit b3f0720413f924019ff2ce53c4d7cb4bca0e6a10
Author: Sean Molenaar <SMillerDev@users.noreply.github.com>
Date:   Fri Dec 30 19:40:15 2022 +0100

    brp-remove-la-files: use -0 to work on macOS
    
    (cherry picked from commit 492be59ece28a7341de0bd88c0a23125ba54d2ce)

commit 65f61ab0c2b3bb618bcbd560300a4d59474a872a
Author: Dimitrios Soumis <jimsoumis@gmail.com>
Date:   Sat Dec 24 22:37:58 2022 +0200

    Fix typo in macros.in
    
    (cherry picked from commit e9bd7c761fbf1e5593a82d5ab4572854d8314593)

commit fcd2ead5ead22ff04445ffb6ef8936b733b2e3f7
Author: xujing <xujing125@huawei.com>
Date:   Mon Nov 28 11:34:24 2022 +0800

    Fix fileleak when urlGetFile fails in rpmInstall
    
    The "tfn" is created by calling rpmMkTempFile but not unlinked when
    urlGetFile fails in rpmInstall. Fix it.
    
    (cherry picked from commit af81c95114bc2c01f005f15f17646a5188b5855d)

commit d336ec8303667b2edc361439aa1f4d7dc374b413
Author: xujing <xujing125@huawei.com>
Date:   Mon Nov 28 11:19:20 2022 +0800

    Fix fileleak and memleak in rpmInstall
    
    The "*eiu->fnp" from "eiu->pkgURL[eiu->pkgx]" which is alloced. when
    Fopen or rpmReadPackageFile fails in tryReadHeader, "*eiu->fnp" is
    set to NULL but not freed. In addition, if "eiu->pkgState[eiu->pkgx]"
    is set, the file is leaked too. Fix it.
    
    Only resource free is added, no other logic change.
    
    (cherry picked from commit f0f983b145583eeed618cf3cbc5d39bedd8af5a5)

commit d1d6eb987f9e8294ecd5c166f71eea16a048403e
Author: xujing <xujing125@huawei.com>
Date:   Mon Nov 28 11:10:19 2022 +0800

    Fix memleak when fsmRename failed in fsmCommit
    
    The "dest" is alloced in fsmFsPath but not freed when fsmRename failed
    in fsmCommit. Fix it.
    
    (cherry picked from commit 688c4ad34d197055eb8f58fb4e45065af881598c)

commit 0557b0f9a564c2af227f6cb7c357e46db5b73821
Author: xujing <xujing125@huawei.com>
Date:   Mon Nov 28 11:02:47 2022 +0800

    Fix memleak when running %generate_buildrequires
    
    The "output[i]" is alloced in argvSplit but not freed when running
    %generate_buildrequires. Fix it.
    
    (cherry picked from commit 3b0b9d491f5828a40c15b76b4a19ca00006cf81e)

commit 5542a1ede3bcb2c1bdadf121da5adc9f9ef1245c
Author: xujing <xujing125@huawei.com>
Date:   Sat Nov 26 11:39:48 2022 +0800

    Fix *sbp leak when running rpmbuild with --quiet
    
    When running rpmbuild with --quiet, the "*sbp" may be alloced many
    times in buildSpec by calling doScript but only freed once. Fix it.
    
    (cherry picked from commit 6130bd31038ff17a03fcac6ec7e41ac744163dde)

commit fdb2e428544f5ca61dda552e0a09ca8a24e99083
Author: xujing <xujing125@huawei.com>
Date:   Fri Nov 25 17:11:22 2022 +0800

    Fix elf leak in getElfColor
    
    The "elf" is leaked in getElfColor when gelf_getehdr return fail.
    
    (cherry picked from commit 01196e00beefc2ba6f7f0787350c5dd76891829a)

commit 32adbfffc63af1941ade9c734e4c8775d483dd14
Author: xujing <xujing125@huawei.com>
Date:   Fri Nov 25 17:04:11 2022 +0800

    Fix prog leak in parseScript
    
    The "prog" will be alloced when using "-p" options, which cause src
    "proc" leak. Add "origproc" to point to src "proc" to fix it.
    
    (cherry picked from commit c013821c0c9350b67d9f9a02848e1a7f87fa180b)

commit 0be727e66dbec5f03dd6c2045acb1558fefb8b76
Author: xujing <xujing125@huawei.com>
Date:   Fri Nov 25 16:48:34 2022 +0800

    Fix BANames leak in handlePreambleTag
    
    The "BANames" is alloced from popParseArgvString but not freed
    when spec->packages != pkg. Fix it.
    
    (cherry picked from commit 7fcdfd3b40f69af6a1d4980683859eef05f39b4e)

commit 7cb2da5a398dd93d5ee68df1a4bb80dbe877f2d5
Author: xujing <xujing125@huawei.com>
Date:   Fri Nov 25 17:18:33 2022 +0800

    Fix Header leak when running rpm2cpio
    
    Header "h" is alloced in rpmReadPackageFile but not freed when
    running rpm2cpio. Fix it. Remove redundant whitespace between
    the Fclose()'s too while at it for logical cleanup grouping.
    
    (cherry picked from commit cf27c6f4963dcf27302d0f4fa39d7787dd03f942)

commit 393be1b139b99b062d80c5eb9d13f7a411bde170
Author: olf <Olf0@users.noreply.github.com>
Date:   Tue Nov 29 21:26:15 2022 +0100

    Add missed full stop.
    
    (cherry picked from commit 642dafdfc9920a563796f117923376904cf6671a)

commit dad1de043b6c04f4de746b5e390d2d03baa7de24
Author: olf <Olf0@users.noreply.github.com>
Date:   Tue Nov 29 21:17:16 2022 +0100

    Fix broken markdown quoting …
    
    … introduced in [commit 8b635e2](https://github.com/rpm-software-management/rpm/commit/8b635e2016931ec5bb7dddd6608c09b0b16f7b8e):
    - [Lines 98 - 101](https://github.com/rpm-software-management/rpm/commit/8b635e2016931ec5bb7dddd6608c09b0b16f7b8e#diff-f0f022b189e54462e3284599236a3b192b721928da4bea1a85d738b25ba5eaa7R98-R101): The two tildes lacked quoting, hence the text between them was struck out.
    - [Line 96](https://github.com/rpm-software-management/rpm/commit/8b635e2016931ec5bb7dddd6608c09b0b16f7b8e#diff-f0f022b189e54462e3284599236a3b192b721928da4bea1a85d738b25ba5eaa7R96): Eliminate IMO superfluous triple quoting:  "**\`\`\`**" → "*\`*"
    - Rephrase [lines 95 - 96](https://github.com/rpm-software-management/rpm/commit/8b635e2016931ec5bb7dddd6608c09b0b16f7b8e#diff-f0f022b189e54462e3284599236a3b192b721928da4bea1a85d738b25ba5eaa7R95-R96), to be more concise.
    
    (cherry picked from commit a108d36acf29796b443285658a606c1b13866d9a)

commit 95815f6ccc866659c90b6e5b83744bb973bceab1
Author: olf <Olf0@users.noreply.github.com>
Date:   Tue Nov 29 23:05:22 2022 +0100

    Fix markdown syntax typo
    
    (cherry picked from commit 7064a63a61ca631e745156a64c5ba9387df5e467)

commit 078f94a98e1102b0de053c541c9ccaed6a0a6ef7
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Nov 25 13:08:38 2022 +0200

    Bump CI to Fedora 37
    
    After being stuck on an EOL Fedora for so long, it's nice to be on the
    leading edge for a change.
    
    (cherry picked from commit 17eb3a457a2d9f33ec7e9f031ccf7a951318cc7c)

commit e970cfc0d5a25d1e37a00da7fabf98dd22efac35
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Nov 23 13:39:59 2022 +0200

    Issue a warning when signing created an OpenPGP v3 signature
    
    https://bugzilla.redhat.com/show_bug.cgi?id=2141686 revealed that much
    of the rpm-ecosystem is still using the obsolete v3 OpenPGP signature
    format, I think largely due to workarounds for legacy rpm versions (from
    around the turn of the millennium) that have just been forgotten in
    place. Lets at least issue a wake-up warning when that happens.
    
    Unfortunately this is can't really be tested as current GnuPG versions
    just ignore any --force-v3-sigs arguments.
    
    Fixes: #2286
    (cherry picked from commit ee4356ef27180c370c311ce57d9829adc74264a1)

commit 9ae18b383e72f19e6a93f1e32630635a1c790bdf
Author: xujing <xujing125@huawei.com>
Date:   Thu Nov 24 17:33:53 2022 +0800

    Fix h->blob leak when installing source rpms
    
    When installing source rpms, "ei" is malloced and is saved in
    blob->ei by rpmReadPackageFile->rpmpkgRead->hdrblobRead, and then
    blob->ei is saved in h->blob by rpmReadPackageFile->hdrblobImport,
    which is leaked during installation.
    
    (cherry picked from commit 86c1d9738de58eb8f8844c5345baeb578ace9485)

commit 1527b05c142bef89614df1d5176b94b29e2bae76
Author: xujing <xujing125@huawei.com>
Date:   Thu Nov 24 17:16:46 2022 +0800

    Fix file leak when src rpm in URL format is used for installation
    
    %{_tmppath}/rpm-tmp.* is created by rpmMkTempFile() when src rpm in
    URL format is used for installation, which is leaked.
    
    (cherry picked from commit 0b34438ccc3fdcbdaa6226d2398df88cc7439603)

commit 7489ee80bfc9f298ae3070b09d7e124ff0e979f8
Author: xujing <xujing125@huawei.com>
Date:   Thu Nov 24 11:43:28 2022 +0800

    Fix eiu->sourceURL info leak in rpmInstall()
    
    When installing source rpms, eiu->sourceURL info is leaked.
    
    (cherry picked from commit 084c64d5ea0e1a309d3b57dc95926eb1536d0a7a)

commit 3a13209d9ad0b15f667cb8eda97cdab45347ce09
Author: xujing <xujing125@huawei.com>
Date:   Thu Nov 24 10:43:11 2022 +0800

    Fix header leak in rpmInstall()
    
    When rpm installs a package, the header from tryReadHeader()
    in rpmInstall() is leaked in some cases.
    
    (cherry picked from commit 15a0c73f4698bc58fa2a633d46527c7813150f3a)

commit 35d14c0e250a84536b14233fd37cc573ca46670f
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Nov 24 10:51:04 2022 +0200

    Add some basic tests for OpenPGP v3 signatures
    
    Wider exposure of the Sequoia backend taught us that OpenPGP v3 signatures
    are surprisingly common still in the rpm-ecosystem, and in fact more
    common than v4 signatures. It's a bit surprising, considering that gnupg
    has defaulted to creating v4 signatures since 1.4.8 from late 2007 gnupg2
    refuses to create them at all.
    
    For future reference, the sample package here was signed with
    
       rpmsign --addsign --rpmv3 \
            --digest-algo=sha256 \
            --key-id=rsa@rpm.org \
            --define "__gpg /usr/bin/gpg1" \
            --define "_gpg_sign_cmd_extra_args --force-v3-sigs" \
            /tmp/hello-2.0-1.x86_64.rpm
    
    The two defines are the key to creating OpenPGP v3 signatures in 2022,
    the. Note that the --rpmv3 switch has absolutely nothing to do with
    OpenPGP v3 signatures, it's there to force *rpm* v3 signatures on the
    package similar to the other signed sample package.
    
    Fixes: #2276
    (backported from commit 9daaf3d2ffa1a8b625e9a2657eac9b7ab3da3d8f)

commit 8454e982e1f754ff3d6ceaee375e70bddead40ac
Author: Florian Festi <ffesti@redhat.com>
Date:   Wed Nov 16 17:16:05 2022 +0100

    Test if BuildDependencies are checked for %prep
    
    Have package build fail for rpm -bp
    
    (cherry picked from commit 8a7a4e130578b11bf8087b503c53b8633478ed86)

commit f08ae8493812b4e6d706431c39dddff90500a389
Author: Paul Donohue <git@PaulSD.com>
Date:   Tue Nov 8 11:00:23 2022 -0500

    Fix regression: -bp should check BuildRequires
    
    Some source packages assume that BuildRequires are installed before
    %prep is executed.  For example, `openssh` BuildRequires `automake` and
    runs `autoreconf` in %prep.
    
    Prior to 11c56d5 `rpmbuild -bp` checked BuildRequires and printed a
    helpful error message if there were any missing dependencies.  Since
    that commit, `rpmbuild -bp` skips the BuildRequires check, which can
    lead to misleading errors in %prep.
    
    This commit restores the BuildRequires check in `rpmbuild -bp`.
    
    Co-authored-by: Florian Festi <ffesti@redhat.com>
    (cherry picked from commit 0d6429a4d9498786491a7b806a775585d806f96e)

commit 848143d86248477e4ce5a583f9b3132fb0a7ca2d
Author: xujing <xujing125@huawei.com>
Date:   Wed Nov 2 16:14:47 2022 +0800

    tests: add test for Obsoletes
    
    add test which is previously uncovered case.
    
    (cherry picked from commit 1281c928a78181eb54d4c371d4c8ad5be20904a7)

commit 71bb371c940048dc74f04a54c097a60d367ad154
Author: xujing <xujing125@huawei.com>
Date:   Wed Nov 2 16:08:10 2022 +0800

    tests: add test for %verify in %files
    
    add test which is previously uncovered case.
    
    (backported from commit 25022624fd7c178c76f75afe25e1ad07f4628370)

commit c450a725058914594f67255828cac1a671de1b33
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Nov 14 14:29:24 2022 +0200

    Remove unrelated %undefine output from macro scoping test
    
    %undefine output is not what this test is about, it's what happens
    afterwards. Commit aec8bdb53a3013eabf16368e17a65ab69c2136ee changed
    what happens in this very context, but then %undefine is not intended to
    used this way and its output is not what is being tested here, macro
    scope behavior is.
    
    (cherry picked from commit e73c9827a5ad492e6f86d387fa17b1011a09057a)

commit 915173b789e8e10b551e64f02ee87077a49a877f
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Oct 4 14:50:38 2022 +0300

    Enable malloc checking with random perturb in the test-suite
    
    Glibc provides low-cost memory sanity checking on it's own, it'd be
    foolish not to take advantage of this in the test-suite for our CI.
    As this introduces a level of randomness to the system, record the
    environment in a file (in particular, glibc.malloc.perturb value) to
    make possible failures reproducable.
    
    This is effective for glibc >= 2.34 only, in older versions the
    mechanism to enable differs.
    
    Based on initial patch by Elia Pinto.
    
    (cherry picked from commit 52dc80022ec8c01ab77ecdc5a79a323289ae48ae)

commit 0cd3640edc5a4ee6c0e32705ad68db6fcd94d495
Author: Neal H. Walfield <neal@walfield.org>
Date:   Thu Nov 10 08:39:20 2022 +0100

    Fix rpmkeys type confusion test.
    
    The `rpmkeys type confusion` test was added in ec13083f46a1e to check
    that the internal OpenPGP parser rejects a certificate with an invalid
    component.  The Sequoia backend happily accepts the certificate and
    ignores the invalid component, which causes the test to fail.  Mark
    the test as specific to the internal OpenPGP backend.
    
    Fixes #2272.
    
    (cherry picked from commit db1c9da7fe507b7eb0424bf9c76b6cf37094ed36)

commit 3caf55b397c431537cd18f884e57005efdd2d455
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Nov 8 16:02:24 2022 +0200

    Make %_smp_mflags build rather than parse time determined
    
    Decisions about number of CPUs to use need to be determinable at the
    exact time of build, the moment of parsing has little to do with it.
    Have %_smp_mflags take its value from the environment which we do
    control at the time of build, rather than the spec parse moment.
    
    (cherry picked from commit 0576d24756fe975d890f5535a21cfdfd35fc2ca4)

commit 8fc32c9a82bff78ccef6c588a60ba685da7c277c
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Nov 7 10:41:34 2022 +0200

    Make CPU and thread-related macros available on all platforms
    
    %_smp_mflags and the related macros that it grew around itself used to
    be platform specific as they relied on external tooling (eg getconf for
    getting processor count), but since rpm 4.15 this has been backed by the
    built-in %{getncpus} macro which is available on all platforms, so
    there's zero reason to duplicate this stuff on all platform files.
    
    Fixes: #2265
    (cherry picked from commit 5049fc701561b258b722b3400460d8828ce9e64e)

commit 6b958e2ef473b7859b796092f6546b3c72f9a8dc
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Nov 8 09:34:56 2022 +0200

    Eliminate remaining %{u2p:...} uses
    
    The build and source directories are plain old directories, never any
    sort of URLs. Drop the misleading and obfuscating u2p macro uses from
    the build environment setting.
    
    As of this commit, u2p is unused within rpm.
    
    (cherry picked from commit 3d56ca240a8396537dff9bb3005d1351d16d5224)

commit b9efbdf291209e0577b902a69e940449b5822115
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Nov 4 13:51:49 2022 +0200

    Avoid bashisms in test-suite specs
    
    On Debian and derivates, /bin/sh points to /bin/dash which among other
    things doesn't support brace expansion.
    
    (cherry picked from commit cdecb62ad4263654dc24ea1739a7d2471d29e528)

commit e86810b733024410c55042f5a333689b96ccee1a
Author: Demi Marie Obenour <demi@invisiblethingslab.com>
Date:   Thu Mar 17 03:05:33 2022 -0400

    Reject multiple PGPTAG_PUBLIC_KEY packets
    
    RPM’s simple public key parser cannot handle multiple public keys in the
    same input stream.  While this could be fixed, it would require
    substantial refactoring in code that will eventually be replaced.  This
    is because the pgpDigParams struct can only hold a single public key.
    
    Currently, a second public key packet does not update the
    algorithm-specific data for the public key.  However, it *will* update
    the public key algorithm, if no signature packet has appeared in the
    meantime.  This prevents the security check in the previous commits from
    working and leads to a type confusion bug.
    
    Fix this bug by returning an error if a second PGPTAG_PUBLIC_KEY packet
    is found in the input stream.  This *does not* affect `rpmkeys --import`
    because it explicitly checks for multiple PGPTAG_PUBLIC_KEY packets and
    imports them separately.  It *does* affect the rpmPubkeyRead() and
    rpmPubkeyNew() functions; these will need to be fixed if this limitation
    is a problem for them.
    
    (cherry picked from commit c94051f99a6d134e719be9af1c8934d818594c74)

commit fddc2def8ad043ba578d7d264e9ad155a02a3fc7
Author: Demi Marie Obenour <demi@invisiblethingslab.com>
Date:   Fri Mar 4 10:43:44 2022 -0500

    Check packet types of signatures and public keys
    
    pgpVerifySignature() should check that the provided signature is in fact
    a signature, and that provided key is in fact a public key.  Otherwise,
    a type confusion bug could result if something that is not a signature
    or public key is passed.  RPM itself never calls pgpVerifySignature()
    without having checked the types so all calls in RPM are safe.
    
    (cherry picked from commit 201cd279ec4ea743123d067cf31b04d76f86829e)

commit 1423ff3b43b12da7fef8c3fc82f0e47af2ff9122
Author: Demi Marie Obenour <demi@invisiblethingslab.com>
Date:   Thu Mar 3 23:34:01 2022 -0500

    Avoid type confusion when verifying signatures
    
    In RPM, both signatures and public keys are stored as heap-allocated
    opaque structs.  The type of the struct is determined by whether this is
    a signature or a key and by the public-key algorithm in the associated
    pgpDigParams_s struct.  However, when verifying a signature, RPM did not
    check that the signature and public key used the same public-key
    algorithm.  If they did not, the signature verification code will
    interpret a pointer to the struct specified by the public key’s
    public-key algorithm as a pointer to the struct specified by the
    signature’s public-key algorithm.  This is not a problem when verifying
    package signatures, as findbySig() (in rpmio/rpmkeyring.c) checks that
    the public-key algorithms used by the signature and the public key
    match.  If they do not, it returns NULL, causing both rpmKeyringLookup()
    and rpmKeyringVerifySig() to return RPMRC_NOKEY.  However, the code that
    checks subkey binding signatures does *not* check this, so the type
    confusion can be triggered when importing a crafted key.  This is
    demonstrated by the included test case, which segfaults when OpenSSL is
    used as the underlying cryptographic library.  Fix the problem by
    checking that the algorithms match in pgpVerifySignature().
    
    (backported from commit ec13083f46a1efe8700925538b4f98dc45af93bc)

commit f97c3992d28766a139ba806d9375b0e18e6ea2ea
Author: Frank Dana <ferdnyc@gmail.com>
Date:   Wed Nov 2 10:11:24 2022 -0400

    Docs: macros: Add some missing fencing, fix grammar
    
    (cherry picked from commit 752ed08d1026aeb4aa1716f32064453005e12d5e)

commit 15fffd127a612665f84842ed38ffc394aede74ee
Author: Frank Dana <ferdnyc@gmail.com>
Date:   Mon Oct 31 19:51:05 2022 -0400

    Docs: Macros: Attempt to fix literal backslash
    
    (cherry picked from commit 43155029ccf530a5cd184a53c68ddcb46ce7983b)

commit 82c45b2250df13747ec927dbe36acfae90427f22
Author: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date:   Tue Nov 1 15:21:33 2022 -0400

    Docs: macros: backtick-fence more literals in body
    
    (cherry picked from commit 14e14a5c2a5140b00816ac7b8f104af810ab5208)

commit 2b3d924ee53f3b45a26ea1d684f5aa128f68d778
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Oct 31 09:43:54 2022 +0200

    Doh, unbreak CI from commit 190354cb19af6ecdfec6f7eaa454d6afcf381128
    
    Adding a comment to a spec can't affect the test-suite, right? Well,
    wrong.
    
    Certainly did not remember we have a --parse test on this particular
    spec. Doh.
    
    (cherry picked from commit bf1771b06009a34fecc4e764601757cbb4ee97a4)

commit 40896035a64feb652c1d81a9781cd061d014a516
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Oct 26 14:55:53 2022 +0300

    Add a blurb to hello.spec cautioning against its use
    
    For most tests, it's the worst possible example because it's arch
    dependent and requires complicated external tools to build. Both of
    which are wholly unnecessary complications you don't want to deal with,
    unless your test-case actually requires running a compiler from rpmbuild
    and inspecting its output.
    
    (cherry picked from commit 190354cb19af6ecdfec6f7eaa454d6afcf381128)

commit 54330df5d060c1b873c9fb8dfd54fa5f5a2524e6
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Oct 24 17:39:04 2022 +0200

    Add payload compression macro documentation
    
    Just refer to the newly added mode string API docs.
    
    (cherry picked from commit bf6a97da0b035ce1d341f01b6301407dcad5a5af)

commit 523d3b3cae0f90446077b7108205e5caa7ea19f8
Author: Michal Domonkos <mdomonko@redhat.com>
Date:   Mon Oct 24 17:38:22 2022 +0200

    Add mode string documentation to Fopen()/Fdopen()
    
    (cherry picked from commit 919c835610c05e5a69d0813d28a3f3a6b7eddcd8)

commit bb9d5ac646118d0f913fb298ed7fd318ddfa7bf9
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Oct 11 10:39:14 2022 +0300

    Handle downgrade within V-R when epoch goes away (RhBug:1845069)
    
    A missing epoch is returned as NULL from rpmteE(), but the rpmdb
    matching code can't handle NULL in any meaningful way currently.
    Arguably it should, but that's a bigger topic...
    
    Specifically convert a missing epoch to a "0" which matches the behavior
    in mireSkip() to handle, adjust testcases as appropriate.
    
    (cherry picked from commit 89676fad73d0808588dca620344efa4d6b3889b4)

commit 448d68a67144f284c4fc2551ce3f5b34a99c84f1
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Oct 11 10:24:57 2022 +0300

    Add a whole bunch of epoch behavior install tests
    
    Backport notes:
    
    Replace "~/.rpmmacros" with a non-tilde default path due to a bug in the
    bundled glob(3) implementation which doesn't yield any matches for a "~"
    pattern in a fakechroot environment where FAKECHROOT_BASE and HOME both
    point at the same directory (thus preventing RPM from picking up the
    %_query_all_fmt macro in the tests).  This is not an issue on master
    since it carries commit 66fa46c006bae0f28d93238b8f7f1c923645eee5 but
    that's not appropriate for a stable branch.
    
    (backported from commit 7788763e09b7beed75345e11c223735ad4829fdb)

commit ef1e889d0d83410878aaaea88ae9b8910064b836
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Sep 22 11:54:47 2022 +0300

    Add a handler for libselinux log messages (RhBug:2123719, RhBug:2050774)
    
    libselinux logs to stderr by default, which up to now has been just fine
    with us. However somewhere around libselinux 3.2 it begun issuing
    log messages for events discovered in selinux_status_updated().
    We only call that to see whether the status *was* updated behind our
    back and are not interested in these audit-style messages for our
    functionality, but to suppress them while preserving actually relevant
    errors and warnings, we need to have a log callback of our own. Might as
    well forward them to rpmlog then.
    
    SELINUX_ERROR and SELINUX_WARNING are pretty obvious, of SELINUX_AVC
    selinux_set_callback(3) says it should be treated as SELINUX_ERROR if
    not audited. The rest we suppress to debug messages, they may be handy
    for diagnostics some day.
    
    Note that this intentionally avoids explicit SELINUX_POLICYLOAD and
    SELINUX_SETENFORCE cases in the switch: we don't want to introduce
    libselinux >= 3.2 dependency just because of this silly thing.
    
    (cherry picked from commit 96888e99c5103d9dea5230c917b946732de2d302)

commit 9841eed905b9433dc5d89583d34e4590842aa582
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Wed Oct 5 09:21:09 2022 +0300

    Permit building rpm from git without pandoc
    
    Pandoc is only required for converting .md to man pages, which is not
    terribly interesting unless you're creating a dist tarball. We already
    have an automake conditional for pandoc, might as well use it.
    "make dist" will still fail without pandoc, but that's exactly how we
    want it.
    
    (cherry picked from commit 1b8f7a182fe917ed5af5086d715cae529540a4d3)

commit 73bd78686938483ab16704e6798459bfb800a7b9
Author: Carl George <carl@george.computer>
Date:   Fri Sep 30 20:44:48 2022 -0500

    Fix typo in macros manual
    
    (cherry picked from commit 9f59af51b5969ab38f64bb7dcf881f45b8a41e7f)

commit 9bc34d9a6f89dce18cc1f556d69efd56299881e3
Author: Radovan Sroka <rsroka@redhat.com>
Date:   Thu Aug 25 15:38:01 2022 +0200

    fapolicyd: Make write() nonblocking
    
    - switch to read only and non blocking mode for pipe
    - add 1 minute loop to wait for pipe to reappear
    
    Sometimes during the system update/upgrade fapolicyd
    get restarted e.g. when systemd gets updated.
    That can lead to the situation where fapolicyd pipe
    has been removed and created again.
    In such cases rpm-plugin-fapolicyd gets stuck on
    write() to the pipe which does not exist anymore.
    After switching to non blocking file descriptor
    we can try to reopen the pipe if there is an error
    from write(). Assuming that a new pipe should appear
    when fapolicyd daemon starts again.
    If not then after 1 minute of waiting we expect
    fapolicyd daemon to be not active and we let the
    transaction continue.
    
    Signed-off-by: Radovan Sroka <rsroka@redhat.com>
    (cherry picked from commit 534fd1f0c84b12ba6080a46e07c57ef913c77cba)

commit 458f7eb2b8373102b1f0c6daddd7636c524f1f5f
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Jun 6 12:04:15 2022 +0300

    Fix potential uninitialized variable use in rpmtsImportPubkey()
    
    Commit d703160334ff545ce8bf7475da5689422f43dacc introduced a new step
    to key import which can fail before keyring is initialized.
    
    Always initialize your variables, never need "fixes" like this.
    
    (cherry picked from commit a3d11f7a53811e42cbe36a91a1583a723c2fe108)

