[rpm] - fix crash if prep or changelog section in spec is empty (#706959) - fix crash on macro which undef
Panu Matilainen
pmatilai at fedoraproject.org
Fri Jun 10 09:39:13 UTC 2011
commit 23ac61a41fadaeef992bb7ec362e5f8037501e6f
Author: Panu Matilainen <pmatilai at redhat.com>
Date: Fri Jun 10 12:32:12 2011 +0300
- fix crash if prep or changelog section in spec is empty (#706959)
- fix crash on macro which undefines itself
- fix script dependency generation with file 5.07 string changes (#712251)
rpm-4.9.0-empty-changelog-crash.patch | 21 +++++++++++++++++
rpm-4.9.0-empty-prep-crash.patch | 21 +++++++++++++++++
rpm-4.9.0-file-compat.patch | 39 +++++++++++++++++++++++++++++++++
rpm-4.9.0-macro-self-undefine.patch | 35 +++++++++++++++++++++++++++++
rpm.spec | 19 +++++++++++++++-
5 files changed, 134 insertions(+), 1 deletions(-)
---
diff --git a/rpm-4.9.0-empty-changelog-crash.patch b/rpm-4.9.0-empty-changelog-crash.patch
new file mode 100644
index 0000000..f592cc8
--- /dev/null
+++ b/rpm-4.9.0-empty-changelog-crash.patch
@@ -0,0 +1,21 @@
+commit 78a6cf6fbf047c5bf0066df21792e4c9925d04a0
+Author: Michael Schroeder <mls at suse.de>
+Date: Tue May 24 08:51:56 2011 +0300
+
+ Do not die on empty changelog section
+
+ Signed-off-by: Panu Matilainen <pmatilai at redhat.com>
+
+diff --git a/build/parseChangelog.c b/build/parseChangelog.c
+index 36a19c3..d4681cb 100644
+--- a/build/parseChangelog.c
++++ b/build/parseChangelog.c
+@@ -233,7 +233,7 @@ int parseChangelog(rpmSpec spec)
+ }
+ }
+
+- if (addChangelog(spec->packages->header, sb)) {
++ if (sb && addChangelog(spec->packages->header, sb)) {
+ goto exit;
+ }
+ res = nextPart;
diff --git a/rpm-4.9.0-empty-prep-crash.patch b/rpm-4.9.0-empty-prep-crash.patch
new file mode 100644
index 0000000..40c5a98
--- /dev/null
+++ b/rpm-4.9.0-empty-prep-crash.patch
@@ -0,0 +1,21 @@
+commit 39800e901e2258685d1fc34e1e9a7b8a058e11ce
+Author: Michael Schroeder <mls at suse.de>
+Date: Mon May 16 11:57:44 2011 +0300
+
+ Fix segfault on build with empty %prep section
+
+ Signed-off-by: Panu Matilainen <pmatilai at redhat.com>
+
+diff --git a/build/parsePrep.c b/build/parsePrep.c
+index c0508ec..9e61dde 100644
+--- a/build/parsePrep.c
++++ b/build/parsePrep.c
+@@ -504,7 +504,7 @@ int parsePrep(rpmSpec spec)
+ }
+ }
+
+- for (ARGV_const_t lines = saveLines; *lines; lines++) {
++ for (ARGV_const_t lines = saveLines; lines && *lines; lines++) {
+ res = 0;
+ if (rstreqn(*lines, "%setup", sizeof("%setup")-1)) {
+ res = doSetupMacro(spec, *lines);
diff --git a/rpm-4.9.0-file-compat.patch b/rpm-4.9.0-file-compat.patch
new file mode 100644
index 0000000..9a2624e
--- /dev/null
+++ b/rpm-4.9.0-file-compat.patch
@@ -0,0 +1,39 @@
+commit db4905f51eb80b55c408e3a659bab6b4ec5d9e3b
+Author: Panu Matilainen <pmatilai at redhat.com>
+Date: Fri Jun 10 12:08:45 2011 +0300
+
+ Adjust script detection rules to work with file >= 5.07 too (RhBug:712251)
+ - Somewhere between file 5.05 and 5.07 it started adding encoding
+ to script descriptions, eg "<mumble> script text executable" became
+ "<mumble> script, <encoding> text executable" breaking what had
+ been working for 10+ years in the case of old find-requires.
+ - Permit either comma or space after "script", this works for both
+ old and new file.
+
+diff --git a/autodeps/linux.req b/autodeps/linux.req
+index cf60bd9..b9a8f99 100644
+--- a/autodeps/linux.req
++++ b/autodeps/linux.req
+@@ -20,10 +20,11 @@ fi
+ # --- Grab the file manifest and classify files.
+ #filelist=`sed "s/['\"]/\\\&/g"`
+ filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
+-exelist=`echo $filelist | xargs -r file | grep -Ev ":.* (commands|script) " | \
++exelist=`echo $filelist | xargs -r file | \
++ grep -Ev ":.* (commands|script)[, ]" | \
+ grep ":.*executable" | cut -d: -f1`
+ scriptlist=`echo $filelist | xargs -r file | \
+- grep -E ":.* (commands|script) " | cut -d: -f1`
++ grep -E ":.* (commands|script)[, ]" | cut -d: -f1`
+ liblist=`echo $filelist | xargs -r file | \
+ grep ":.*shared object" | cut -d : -f1`
+
+diff --git a/fileattrs/script.attr b/fileattrs/script.attr
+index 13b8ba0..79f4d73 100644
+--- a/fileattrs/script.attr
++++ b/fileattrs/script.attr
+@@ -1,3 +1,3 @@
+ %__script_requires %{_rpmconfigdir}/script.req
+-%__script_magic ^.* script text.*$
++%__script_magic ^.* script[, ].*$
+ %__script_flags exeonly
diff --git a/rpm-4.9.0-macro-self-undefine.patch b/rpm-4.9.0-macro-self-undefine.patch
new file mode 100644
index 0000000..0d998c3
--- /dev/null
+++ b/rpm-4.9.0-macro-self-undefine.patch
@@ -0,0 +1,35 @@
+commit f4c79584d01c6394544c86c122d2f32f77a1d02d
+Author: Michael Schroeder <mls at suse.de>
+Date: Wed May 18 09:04:40 2011 +0300
+
+ Always copy macro source when expanding it
+ - A macro can undefine itself, and unless we grab a copy of it we'll
+ end up accessing already freed memory. Fixes a regression from
+ commit ebc4ceaaeb8bb59019f4635471b28eb5f3eaaaa6 which assumed
+ a copy is not always needed.
+
+ Signed-off-by: Panu Matilainen <pmatilai at redhat.com>
+
+diff --git a/rpmio/macro.c b/rpmio/macro.c
+index 8ea4819..d79ef18 100644
+--- a/rpmio/macro.c
++++ b/rpmio/macro.c
+@@ -1022,12 +1022,12 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
+ char *source = NULL;
+
+ /* Handle non-terminated substrings by creating a terminated copy */
+- if (slen > 0) {
+- source = xmalloc(slen + 1);
+- strncpy(source, src, slen);
+- source[slen] = '\0';
+- s = source;
+- }
++ if (!slen)
++ slen = strlen(src);
++ source = xmalloc(slen + 1);
++ strncpy(source, src, slen);
++ source[slen] = '\0';
++ s = source;
+
+ if (mb->buf == NULL) {
+ size_t blen = MACROBUFSIZ + strlen(s);
diff --git a/rpm.spec b/rpm.spec
index b33e46c..14dc357 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -21,7 +21,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}8%{?dist}
+Release: %{?snapver:0.%{snapver}.}9%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.9.x/%{name}-%{srcver}.tar.bz2
@@ -54,6 +54,14 @@ Patch104: rpm-4.9.0-fstate-verify.patch
Patch105: rpm-4.9.0-fstate-deps.patch
# Preferred color pkgs should be erased last
Patch106: rpm-4.9.0-prefcolor-erase.patch
+# Fix crash on empty prep-section
+Patch107: rpm-4.9.0-empty-prep-crash.patch
+# Fix crash on empty changelog-section
+Patch108: rpm-4.9.0-empty-changelog-crash.patch
+# Fix crash on macro undefining itself
+Patch109: rpm-4.9.0-macro-self-undefine.patch
+# Fix breakage caused by file 5.07 string changes
+Patch110: rpm-4.9.0-file-compat.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
@@ -230,6 +238,10 @@ packages on a system.
%patch104 -p1 -b .fstate-verify
%patch105 -p1 -b .fstate-deps
%patch106 -p1 -b .prefcolor-erase
+%patch107 -p1 -b .empty-prep-crash
+%patch108 -p1 -b .empty-changelog-crash
+%patch109 -p1 -b .macro-self-undefine
+%patch110 -p1 -b .file-compat
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
@@ -448,6 +460,11 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
+* Fri Jun 10 2011 Panu Matilainen <pmatilai at redhat.com> - 4.9.0-9
+- fix crash if prep or changelog section in spec is empty (#706959)
+- fix crash on macro which undefines itself
+- fix script dependency generation with file 5.07 string changes (#712251)
+
* Thu May 26 2011 Panu Matilainen <pmatilai at redhat.com> - 4.9.0-8
- add dwarf-4 support to debugedit (#707677)
- generate build-id symlinks for all filenames sharing a build-id (#641377)
More information about the scm-commits
mailing list