Fix a couple of <= 4.18 regressions

This commit is contained in:
Panu Matilainen 2023-06-28 09:55:16 +03:00
parent 75bce87293
commit e62cb28543
3 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 911a4f253c7213a8570028a7dc2a20b045de8e9e Mon Sep 17 00:00:00 2001
Message-ID: <911a4f253c7213a8570028a7dc2a20b045de8e9e.1687934951.git.pmatilai@redhat.com>
From: Fabian Vogt <fvogt@suse.de>
Date: Mon, 26 Jun 2023 16:28:07 +0200
Subject: [PATCH] Actually return an error in parseScript if parsing fails
The return value is stored in the "res" variable which is set to the return
value of parseLines early in the function. Past that point, any "goto exit;"
caused the function to return success. This was introduced by 52ce88851abb
("Port parseScript() to use parseLines(), no functional changes"). To fix it,
reintroduce the nextPart variable.
---
build/parseScript.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/build/parseScript.c b/build/parseScript.c
index f8b693ac6..6f3dc2fe8 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -95,7 +95,7 @@ int parseScript(rpmSpec spec, int parsePart)
int index;
char * reqargs = NULL;
- int res = PART_ERROR; /* assume failure */
+ int nextPart, res = PART_ERROR; /* assume failure */
int rc, argc;
int arg;
const char **argv = NULL;
@@ -367,7 +367,7 @@ int parseScript(rpmSpec spec, int parsePart)
goto exit;
}
- if ((res = parseLines(spec, STRIP_NOTHING, NULL, &sb)) == PART_ERROR)
+ if ((nextPart = parseLines(spec, STRIP_NOTHING, NULL, &sb)) == PART_ERROR)
goto exit;
if (sb) {
@@ -479,6 +479,8 @@ int parseScript(rpmSpec spec, int parsePart)
}
}
+ res = nextPart;
+
exit:
free(reqargs);
freeStringBuf(sb);
--
2.41.0

View File

@ -0,0 +1,33 @@
From 7072b2d2b92e4d2731451bdcca8d83ab6b945016 Mon Sep 17 00:00:00 2001
Message-ID: <7072b2d2b92e4d2731451bdcca8d83ab6b945016.1687934969.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 20 Jun 2023 10:11:20 +0300
Subject: [PATCH] Fix per-file plugin hook regression introduced in 4.18
Commit 6dd62720fe84f7e2ad902c915b952fc0b29e3dcd neglected to update
rpmpluginsCallFsmFilePost() to pass the absolute path in the case
of unowned directories. Because in that case there's no rpmfi to
pass to the plugin in that case, there's simply no way for the plugin
to know what path is being manipulated. Oops.
Fixes: #2543
---
lib/fsm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/fsm.c b/lib/fsm.c
index 747ed2b09..c44f6313c 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -360,7 +360,7 @@ static int fsmDoMkDir(rpmPlugins plugins, int dirfd, const char *dn,
}
/* Run fsm file post hook for all plugins */
- rpmpluginsCallFsmFilePost(plugins, NULL, dn, mode, op, rc);
+ rpmpluginsCallFsmFilePost(plugins, NULL, apath, mode, op, rc);
if (!rc) {
rpmlog(RPMLOG_DEBUG,
--
2.41.0

View File

@ -32,7 +32,7 @@
%global rpmver 4.18.91 %global rpmver 4.18.91
#global snapver rc1 #global snapver rc1
%global baserelease 5 %global baserelease 6
%global sover 10 %global sover 10
%global srcver %{rpmver}%{?snapver:-%{snapver}} %global srcver %{rpmver}%{?snapver:-%{snapver}}
@ -150,6 +150,8 @@ rpm-4.18.90-weak-user-group.patch
# Patches already upstream: # Patches already upstream:
0001-Don-t-muck-with-per-process-global-sqlite-configurat.patch 0001-Don-t-muck-with-per-process-global-sqlite-configurat.patch
0001-Actually-return-an-error-in-parseScript-if-parsing-f.patch
0001-Fix-per-file-plugin-hook-regression-introduced-in-4..patch
# ... # ...
# These are not yet upstream # These are not yet upstream
@ -622,6 +624,10 @@ fi
%doc %{_defaultdocdir}/rpm/API/ %doc %{_defaultdocdir}/rpm/API/
%changelog %changelog
* Wed Jun 28 2023 Panu Matilainen <pmatilai@redhat.com> - 4.18.91-6
- Fix a spec parsing error handling regression
- Fix a per-file plugin hook regression
* Tue Jun 27 2023 Panu Matilainen <pmatilai@redhat.com> - 4.18.91-5 * Tue Jun 27 2023 Panu Matilainen <pmatilai@redhat.com> - 4.18.91-5
- Fix potential crash with multiple in-process sqlite uses - Fix potential crash with multiple in-process sqlite uses