diff --git a/.gitignore b/.gitignore index 64bbc1d..ebffdd9 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ /rpm-4.18.92.tar.bz2 /rpm-4.18.99.tar.bz2 /rpm-4.19.0.tar.bz2 +/rpm-4.19.1.tar.bz2 diff --git a/0001-Fix-getncpus-proc-thread-potentially-returning-zero.patch b/0001-Fix-getncpus-proc-thread-potentially-returning-zero.patch deleted file mode 100644 index b8a2e99..0000000 --- a/0001-Fix-getncpus-proc-thread-potentially-returning-zero.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 026e7f75e549280d43cdb4c8a1b2faa6e9db0fa3 Mon Sep 17 00:00:00 2001 -From: Panu Matilainen -Date: Wed, 15 Nov 2023 09:24:28 +0200 -Subject: [PATCH 1/2] Fix %{getncpus proc/thread} potentially returning zero - -Add the missing sanity check/fixup for memory starved systems where -we end up returning zero cpus. Should've been in commit -deaebd0c89a6d453bb971fd8f5a3b858e7a95733 originally. - -Reported in https://issues.redhat.com/browse/RHEL-16557 ---- - rpmio/macro.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/rpmio/macro.c b/rpmio/macro.c -index 1cccaa98a88c56ed27701f820be01c3f8e7615d1..98067442555f7c458ea4976d96b5438db01bd031 100644 ---- a/rpmio/macro.c -+++ b/rpmio/macro.c -@@ -1255,6 +1255,9 @@ static void doGetncpus(MacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *parse - if (mcpus < ncpus) - ncpus = mcpus; - } -+ /* Ensure at least one CPU, no matter how starved */ -+ if (ncpus < 1) -+ ncpus = 1; - - sprintf(buf, "%u", ncpus); - mbAppendStr(mb, buf); --- -2.43.0 - diff --git a/0002-Fix-integer-overflow-in-memory-calculations-on-32bit.patch b/0002-Fix-integer-overflow-in-memory-calculations-on-32bit.patch deleted file mode 100644 index 746063e..0000000 --- a/0002-Fix-integer-overflow-in-memory-calculations-on-32bit.patch +++ /dev/null @@ -1,78 +0,0 @@ -From eb8660e2aae2f0366886e73dc37beb236e89188b Mon Sep 17 00:00:00 2001 -From: Panu Matilainen -Date: Thu, 16 Nov 2023 14:22:15 +0200 -Subject: [PATCH 2/2] Fix integer overflow in memory calculations on 32bit - systems - -"long int" on at least x86 Linux is exactly the same as a plain "int", -so calculations can easily overflow. 32bit systems are not expected to -have hundreds of gigabytes of memory but a 32bit process on a x86_64 can -run into all sorts of funny things, such having 500GB system memory. At -which point the type capable of addressing all of process memory is -absolutely useless for calculating the total memory. - -Use uint64_t in the memory calculations to make the size explicit. Of course -one day we may cross that border too, but I hope to be retired by then. - -Fixes https://issues.redhat.com/browse/RHEL-16557 ---- - rpmio/macro.c | 20 +++++++++++--------- - 1 file changed, 11 insertions(+), 9 deletions(-) - -diff --git a/rpmio/macro.c b/rpmio/macro.c -index 98067442555f7c458ea4976d96b5438db01bd031..354b06b0ed34c030638788da5d397b7ba108e806 100644 ---- a/rpmio/macro.c -+++ b/rpmio/macro.c -@@ -1177,30 +1177,32 @@ static void doShescape(MacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *parse - mbAppend(mb, '\''); - } - --static unsigned long getmem_total(void) -+static uint64_t getmem_total(void) - { -- unsigned long mem = 0; -+ uint64_t mem = 0; - long int pagesize = sysconf(_SC_PAGESIZE); - long int pages = sysconf(_SC_PHYS_PAGES); - -- if (pagesize < 0) -+ if (pagesize <= 0) - pagesize = 4096; -- if (pages > 0) -- mem = pages * pagesize; -+ if (pages > 0) { -+ /* Cast needed to force 64bit calculation on 32bit systems */ -+ mem = (uint64_t)pages * pagesize; -+ } - - return mem; - } - --static unsigned long getmem_proc(int thread) -+static uint64_t getmem_proc(int thread) - { -- unsigned long mem = getmem_total(); -+ uint64_t mem = getmem_total(); - /* - * Conservative estimates for thread use on 32bit systems where address - * space is an issue: 2GB for bare metal, 3GB for a 32bit process - * on a 64bit system. - */ - if (thread) { -- unsigned long vmem = mem; -+ uint64_t vmem = mem; - #if __WORDSIZE == 32 - vmem = UINT32_MAX / 2; - #else -@@ -1224,7 +1226,7 @@ static void doGetncpus(MacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *parse - const char *arg = argv[1] ? argv[1] : "total"; - char buf[32]; - unsigned int ncpus = getncpus(); -- unsigned long mem = 0; -+ uint64_t mem = 0; - - if (rstreq(arg, "total")) { - /* nothing */ --- -2.43.0 - diff --git a/rpm-4.19.0-sysusers-fixes.patch b/rpm-4.19.0-sysusers-fixes.patch deleted file mode 100644 index ba5bdbd..0000000 --- a/rpm-4.19.0-sysusers-fixes.patch +++ /dev/null @@ -1,184 +0,0 @@ -From fff4b0b2249223fccddcce9eea8658ddd12f30a0 Mon Sep 17 00:00:00 2001 -From: Panu Matilainen -Date: Fri, 3 Nov 2023 11:34:54 +0200 -Subject: [PATCH 1/4] Use macro error reporting for %add_sysuser errors - -Lua has error() but no warning() (obviously) which we'll want in the next -step, so for consistency lets just use macro.error() instead. ---- - macros.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/macros.in b/macros.in -index a047d1e388..1f6d8b252f 100644 ---- a/macros.in -+++ b/macros.in -@@ -1325,14 +1325,14 @@ end - prefix = 'Provides: ' - end - if #arg < 2 then -- error('not enough arguments') -+ macros.error({'not enough arguments'}) - end - if arg[1] == 'g' then - type = 'group' - elseif arg[1] == 'u' then - type = 'user' - else -- error('invalid sysuser type: '..arg[1]) -+ macros.error({'invalid sysuser type: '..arg[1]}) - end - name = arg[2] - line = table.concat(arg, ' ') - -From 8e392aef642fba1f63b6d86b11fad85d63d94ba1 Mon Sep 17 00:00:00 2001 -From: Panu Matilainen -Date: Fri, 3 Nov 2023 11:51:11 +0200 -Subject: [PATCH 2/4] Fix an apparent thinko/typo in the sysusers test spec - -I'm quite sure I didn't really intend to test duplicate files behavior -here... ---- - tests/data/SPECS/klang.spec | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/tests/data/SPECS/klang.spec b/tests/data/SPECS/klang.spec -index 7e917fdc7f..e6cce1add8 100644 ---- a/tests/data/SPECS/klang.spec -+++ b/tests/data/SPECS/klang.spec -@@ -28,6 +28,7 @@ Summary: %{SUMMARY} server - - %install - mkdir -p ${RPM_BUILD_ROOT}/var/lib/klangd -+mkdir -p ${RPM_BUILD_ROOT}/var/lib/plongd - mkdir -p ${RPM_BUILD_ROOT}/usr/bin/ - mkdir -p ${RPM_BUILD_ROOT}/etc - mkdir -p ${RPM_BUILD_ROOT}/%{_sysusersdir} -@@ -59,5 +60,5 @@ EOF - %{_sysusersdir}/klangd.conf - %{_sysusersdir}/plong.conf - %attr(-,klangd,klangd) /var/lib/klangd --%attr(-,plong,klong) /var/lib/klangd -+%attr(-,plong,klong) /var/lib/plongd - /usr/bin/klangd - -From 59a212dbe3cb19331582c9c022105ae47b9ace21 Mon Sep 17 00:00:00 2001 -From: Panu Matilainen -Date: Fri, 3 Nov 2023 11:53:11 +0200 -Subject: [PATCH 3/4] Handle unsupported 'r' and 'm' sysusers types more - gracefully - -People will want to use existing sysusers.d files through rpm and while -we don't support 'r' and 'm' at this time, we shouldn't really call -them "invalid" and error out. Issue a warning instead, and ignore. - -This is the first half of -https://bugzilla.redhat.com/show_bug.cgi?id=2246236 ---- - macros.in | 3 +++ - tests/data/SPECS/klang.spec | 2 ++ - tests/rpmi.at | 7 +++++++ - 3 files changed, 12 insertions(+) - -diff --git a/macros.in b/macros.in -index 1f6d8b252f..fefb351ac3 100644 ---- a/macros.in -+++ b/macros.in -@@ -1331,6 +1331,9 @@ end - type = 'group' - elseif arg[1] == 'u' then - type = 'user' -+ elseif arg[1] == 'r' or arg[1] == 'm' then -+ macros.warn({'ignoring unsupported sysuser type: '..arg[1]}) -+ return - else - macros.error({'invalid sysuser type: '..arg[1]}) - end -diff --git a/tests/data/SPECS/klang.spec b/tests/data/SPECS/klang.spec -index e6cce1add8..e7c03cd7f8 100644 ---- a/tests/data/SPECS/klang.spec -+++ b/tests/data/SPECS/klang.spec -@@ -47,6 +47,8 @@ EOF - cat << EOF > ${RPM_BUILD_ROOT}/%{_sysusersdir}/plong.conf - u plong - "Plong fu" /var/lib/plong /sbin/nologin - g klong - -+m ding dong -+r - 123-321 - EOF - - %files common -diff --git a/tests/rpmi.at b/tests/rpmi.at -index 6339a70a7c..94d8967b12 100644 ---- a/tests/rpmi.at -+++ b/tests/rpmi.at -@@ -1481,7 +1481,14 @@ AT_SETUP([rpm -i sysusers]) - AT_KEYWORDS([install build sysusers]) - RPMDB_INIT - -+RPMTEST_CHECK([ - runroot rpmbuild -bb --quiet /data/SPECS/klang.spec -+], -+[0], -+[], -+[warning: ignoring unsupported sysuser type: m -+warning: ignoring unsupported sysuser type: r -+]) - - RPMTEST_CHECK([ - runroot rpm -U /build/RPMS/noarch/klang-client-1.0-1.noarch.rpm - -From c47f71a72e7f885615c677e88ce92810ed1f00c8 Mon Sep 17 00:00:00 2001 -From: Panu Matilainen -Date: Fri, 3 Nov 2023 12:15:58 +0200 -Subject: [PATCH 4/4] Fix comment line handling in sysusers.d(8) files - -sysusers.d(8) format permits empty lines and commits, and so must we. -Add some extra fluff to the test-case for this. - -This is the second half of -https://bugzilla.redhat.com/show_bug.cgi?id=2246236 - -Fixes: #2741 ---- - fileattrs/sysusers.attr | 4 ++++ - tests/data/SPECS/klang.spec | 5 +++++ - 2 files changed, 9 insertions(+) - -diff --git a/fileattrs/sysusers.attr b/fileattrs/sysusers.attr -index f7a3e838d1..48d4caede9 100644 ---- a/fileattrs/sysusers.attr -+++ b/fileattrs/sysusers.attr -@@ -6,6 +6,9 @@ - # For groups created as a side-effect, only provide the group. - %__sysusers_provides() %{lua: - for line in io.lines(macros["1"]) do -+ if line:sub(1, 1) == '#' then -+ goto continue -+ end - fields = {} - for w in line:gmatch("%S+") do - table.insert(fields, w) -@@ -14,5 +17,6 @@ - table.insert(fields, 1, '-b') - print(macros.add_sysuser(fields)) - end -+ ::continue:: - end - } -diff --git a/tests/data/SPECS/klang.spec b/tests/data/SPECS/klang.spec -index e7c03cd7f8..64bd90c104 100644 ---- a/tests/data/SPECS/klang.spec -+++ b/tests/data/SPECS/klang.spec -@@ -45,7 +45,12 @@ cat << EOF > ${RPM_BUILD_ROOT}/%{_sysusersdir}/klangd.conf - u klangd - "Klang server" /var/lib/klangd /sbin/nologin - EOF - cat << EOF > ${RPM_BUILD_ROOT}/%{_sysusersdir}/plong.conf -+ -+# Real life files have all sorts of anomalies - u plong - "Plong fu" /var/lib/plong /sbin/nologin -+#...such as empty lines -+ -+# and comments comments - g klong - - m ding dong - r - 123-321 diff --git a/rpm.spec b/rpm.spec index f17f918..37cde3a 100644 --- a/rpm.spec +++ b/rpm.spec @@ -25,9 +25,9 @@ %define rpmhome /usr/lib/rpm -%global rpmver 4.19.0 +%global rpmver 4.19.1 #global snapver rc1 -%global baserelease 3 +%global baserelease 1 %global sover 10 %global srcver %{rpmver}%{?snapver:-%{snapver}} @@ -140,9 +140,6 @@ rpm-4.18.90-weak-user-group.patch # Patches already upstream: # ... -rpm-4.19.0-sysusers-fixes.patch -0001-Fix-getncpus-proc-thread-potentially-returning-zero.patch -0002-Fix-integer-overflow-in-memory-calculations-on-32bit.patch # These are not yet upstream rpm-4.7.1-geode-i686.patch @@ -410,7 +407,7 @@ cd _build # init an empty database for %ghost'ing for all supported backends for be in %{?with_ndb:ndb} %{?with_sqlite:sqlite}; do mkdir ${be} - ./rpmdb --rcfile rpmrc --define "_db_backend ${be}" --dbpath=${PWD}/${be} --initdb + tools/rpmdb --rcfile rpmrc --define "_db_backend ${be}" --dbpath=${PWD}/${be} --initdb cp -va ${be}/. $RPM_BUILD_ROOT/usr/lib/sysimage/rpm/ done @@ -426,6 +423,9 @@ rm -f $RPM_BUILD_ROOT/%{rpmhome}/{perldeps.pl,perl.*,pythond*} rm -f $RPM_BUILD_ROOT/%{_fileattrsdir}/{perl*,python*} rm -rf $RPM_BUILD_ROOT/var/tmp +# workaround for https://github.com/rpm-software-management/rpm/issues/2811 +rm $RPM_BUILD_ROOT/%{_defaultdocdir}/rpm/README.md + %pre # Symlink all rpmdb files to the new location if we're still using /var/lib/rpm if [ -d /var/lib/rpm ]; then @@ -619,6 +619,9 @@ fi %doc %{_defaultdocdir}/rpm/API/ %changelog +* Tue Dec 12 2023 Michal Domonkos - 4.19.1-1 +- Update to 4.19.1 (https://rpm.org/wiki/Releases/4.19.1) + * Thu Nov 30 2023 Stephen Gallagher - 4.19.0-3 - Fix issues with %%getncpus sometimes returning 0 on i686 systems diff --git a/sources b/sources index 8c72ceb..8fc4f82 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rpm-4.19.0.tar.bz2) = 84801954eab8390af86388c96e0a446b0924bc3791dabcb8641dbaa53586ca852400c0b53c969c06e716949aa36ce337de7d6ba1ffc09eca31900af250f205cb +SHA512 (rpm-4.19.1.tar.bz2) = 12e6c7294a98032418ec9a0510a8183658483fe713d67e6890a9c0da44748371df45a26af6055d08470b85b5dec0cf94795d17c5b3e11db08b20ef07e8e06642