- Fix reading a memory right after the end of an allocated area

- Resolves: 1260248
- Add support for various types of dependencies to rpmdeps tool
- Resolves: 1247092
- fix %%autopatch when patch do not exist
- Resolves: 1244172
This commit is contained in:
Lubos Kardos 2015-10-23 16:06:19 +02:00
parent b73ac86cf5
commit c235b191f3
4 changed files with 250 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From 73ea59e0d53503bb45d5eac9d9792127a6d04c23 Mon Sep 17 00:00:00 2001
From: Thierry Vignaud <thierry.vignaud@gmail.com>
Date: Thu, 17 Sep 2015 04:36:47 -0400
Subject: [PATCH] fix %autopatch when patch do not exist
unlike Mageia's %apply_patches which inspired it, %autopatch continues
when it fails to apply a patch because it doesn't exists. Eg:
+ /usr/bin/cat /home/tv/rpmbuild/SOURCES/test.patch2
+ /usr/bin/patch -p1 -s
/usr/bin/cat: /home/tv/rpmbuild/SOURCES/test.patch2: No such file or directory
+ /usr/bin/cat /home/tv/rpmbuild/SOURCES/test.patch
+ /usr/bin/patch -p1 -s
Let's catch that error
Signed-off-by: Lubos Kardos <lkardos@redhat.com>
---
macros.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/macros.in b/macros.in
index 5dddede..5e0d17b 100644
--- a/macros.in
+++ b/macros.in
@@ -1118,6 +1118,7 @@ done \
# Single patch application
%apply_patch(qp:m:)\
+test -f %{1} || exit 1 ; \
%{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}}
# Automatically apply all patches
--
1.9.3

View File

@ -0,0 +1,29 @@
From 54f24ec5486bdacde9419466a2c27defaddf508e Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Mon, 21 Sep 2015 11:02:45 +0200
Subject: [PATCH] Fix reading a memory right after the end of an allocated
area.
The problem evinced itself when somebody tried to use the macro
expansion on the string "%!". The problem was revealed by compiling
with "--fsanitize=memory" (rhbz:#1260248).
---
rpmio/macro.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rpmio/macro.c b/rpmio/macro.c
index 46e6b87..4b3c41b 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -993,7 +993,7 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
chkexist = 0;
switch ((c = *s)) {
default: /* %name substitution */
- while (strchr("!?", *s) != NULL) {
+ while (*s != '\0' && strchr("!?", *s) != NULL) {
switch(*s++) {
case '!':
negate = ((negate + 1) % 2);
--
1.9.3

View File

@ -0,0 +1,176 @@
From 7a84b45c62cd25c4c68ad295ac5f360b1daebf6a Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Mon, 21 Sep 2015 14:13:22 +0200
Subject: [PATCH] Add support for various types of dependencies to rpmdeps tool
Options added to rpmdeps tool:
--recommends
--suggests
--supplements
--enhances
--conflicts
--obsoletes
---
build/rpmfc.c | 30 ++++++++++++++++++++++++++++++
build/rpmfc.h | 42 ++++++++++++++++++++++++++++++++++++++++++
tools/rpmdeps.c | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 108 insertions(+)
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 7565b18..3637f5c 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -789,6 +789,36 @@ rpmds rpmfcRequires(rpmfc fc)
return rpmfcDependencies(fc, RPMTAG_REQUIRENAME);
}
+rpmds rpmfcRecommends(rpmfc fc)
+{
+ return rpmfcDependencies(fc, RPMTAG_RECOMMENDNAME);
+}
+
+rpmds rpmfcSuggests(rpmfc fc)
+{
+ return rpmfcDependencies(fc, RPMTAG_SUGGESTNAME);
+}
+
+rpmds rpmfcSupplements(rpmfc fc)
+{
+ return rpmfcDependencies(fc, RPMTAG_SUPPLEMENTNAME);
+}
+
+rpmds rpmfcEnhances(rpmfc fc)
+{
+ return rpmfcDependencies(fc, RPMTAG_ENHANCENAME);
+}
+
+rpmds rpmfcConflicts(rpmfc fc)
+{
+ return rpmfcDependencies(fc, RPMTAG_CONFLICTNAME);
+}
+
+rpmds rpmfcObsoletes(rpmfc fc)
+{
+ return rpmfcDependencies(fc, RPMTAG_OBSOLETENAME);
+}
+
static rpmRC rpmfcApplyInternal(rpmfc fc)
{
const char * s;
diff --git a/build/rpmfc.h b/build/rpmfc.h
index bd1c660..dae8ea5 100644
--- a/build/rpmfc.h
+++ b/build/rpmfc.h
@@ -107,6 +107,48 @@ rpmds rpmfcProvides(rpmfc fc);
rpmds rpmfcRequires(rpmfc fc);
/** \ingroup rpmfc
+ * Retrieve file classification recommends
+ * @param fc file classifier
+ * @return rpmds dependency set of fc recommends
+ */
+rpmds rpmfcRecommends(rpmfc fc);
+
+/** \ingroup rpmfc
+ * Retrieve file classification suggests
+ * @param fc file classifier
+ * @return rpmds dependency set of fc suggests
+ */
+rpmds rpmfcSuggests(rpmfc fc);
+
+/** \ingroup rpmfc
+ * Retrieve file classification supplements
+ * @param fc file classifier
+ * @return rpmds dependency set of fc supplements
+ */
+rpmds rpmfcSupplements(rpmfc fc);
+
+/** \ingroup rpmfc
+ * Retrieve file classification enhances
+ * @param fc file classifier
+ * @return rpmds dependency set of fc enhances
+ */
+rpmds rpmfcEnhances(rpmfc fc);
+
+/** \ingroup rpmfc
+ * Retrieve file classification conflicts
+ * @param fc file classifier
+ * @return rpmds dependency set of fc conflicts
+ */
+rpmds rpmfcConflicts(rpmfc fc);
+
+/** \ingroup rpmfc
+ * Retrieve file classification obsoletes
+ * @param fc file classifier
+ * @return rpmds dependency set of fc obsoletes
+ */
+rpmds rpmfcObsoletes(rpmfc fc);
+
+/** \ingroup rpmfc
* Retrieve file classification dependencies
* @param fc file classifier
* @param tagN name tag of the wanted dependency
diff --git a/tools/rpmdeps.c b/tools/rpmdeps.c
index c3112eb..ff785f0 100644
--- a/tools/rpmdeps.c
+++ b/tools/rpmdeps.c
@@ -14,6 +14,18 @@ static int print_provides;
static int print_requires;
+static int print_recommends;
+
+static int print_suggests;
+
+static int print_supplements;
+
+static int print_enhances;
+
+static int print_conflicts;
+
+static int print_obsoletes;
+
static void rpmdsPrint(const char * msg, rpmds ds, FILE * fp)
{
if (fp == NULL) fp = stderr;
@@ -36,6 +48,18 @@ static struct poptOption optionsTable[] = {
NULL, NULL },
{ "requires", 'R', POPT_ARG_VAL, &print_requires, -1,
NULL, NULL },
+ { "recommends", '\0', POPT_ARG_VAL, &print_recommends, -1,
+ NULL, NULL },
+ { "suggests", '\0', POPT_ARG_VAL, &print_suggests, -1,
+ NULL, NULL },
+ { "supplements", '\0', POPT_ARG_VAL, &print_supplements, -1,
+ NULL, NULL },
+ { "enhances", '\0', POPT_ARG_VAL, &print_enhances, -1,
+ NULL, NULL },
+ { "conflicts", '\0', POPT_ARG_VAL, &print_conflicts, -1,
+ NULL, NULL },
+ { "obsoletes", '\0', POPT_ARG_VAL, &print_obsoletes, -1,
+ NULL, NULL },
POPT_AUTOALIAS
POPT_AUTOHELP
@@ -89,6 +113,18 @@ main(int argc, char *argv[])
rpmdsPrint(NULL, rpmfcProvides(fc), stdout);
if (print_requires)
rpmdsPrint(NULL, rpmfcRequires(fc), stdout);
+ if (print_recommends)
+ rpmdsPrint(NULL, rpmfcRecommends(fc), stdout);
+ if (print_suggests)
+ rpmdsPrint(NULL, rpmfcSuggests(fc), stdout);
+ if (print_supplements)
+ rpmdsPrint(NULL, rpmfcSupplements(fc), stdout);
+ if (print_enhances)
+ rpmdsPrint(NULL, rpmfcEnhances(fc), stdout);
+ if (print_conflicts)
+ rpmdsPrint(NULL, rpmfcConflicts(fc), stdout);
+ if (print_obsoletes)
+ rpmdsPrint(NULL, rpmfcObsoletes(fc), stdout);
ec = 0;
--
1.9.3

View File

@ -29,7 +29,7 @@
Summary: The RPM package management system Summary: The RPM package management system
Name: rpm Name: rpm
Version: %{rpmver} Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}6%{?dist} Release: %{?snapver:0.%{snapver}.}7%{?dist}
Group: System Environment/Base Group: System Environment/Base
Url: http://www.rpm.org/ Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2 Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@ -56,6 +56,9 @@ Patch100: rpm-4.13.0-rc1-Fix-new-richdep-syntax.patch
Patch101: rpm-4.13.0-selinux--permissive-scriptlets.patch Patch101: rpm-4.13.0-selinux--permissive-scriptlets.patch
Patch102: rpm-4.13.0-non-numeric-epoch.patch Patch102: rpm-4.13.0-non-numeric-epoch.patch
Patch103: rpm-4.13.0-wrong-version-macro.patch Patch103: rpm-4.13.0-wrong-version-macro.patch
Patch104: rpm-4.13.0-memory-error.patch
Patch105: rpm-4.13.0-rpmdeps-weakdep-support.patch
Patch106: rpm-4.13.0-autopatch-fix.patch
# These are not yet upstream # These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch Patch302: rpm-4.7.1-geode-i686.patch
@ -558,6 +561,11 @@ exit 0
%doc doc/librpm/html/* %doc doc/librpm/html/*
%changelog %changelog
* Fri Oct 23 2015 Lubos Kardos <lkardos@redhat.com> - 4.13-0.rc1.7
- Fix reading a memory right after the end of an allocated area (#1260248)
- Add support for various types of dependencies to rpmdeps tool (#1247092)
- fix %%autopatch when patch do not exist (#1244172)
* Fri Oct 23 2015 Lubos Kardos <lkardos@redhat.com> - 4.13-0.rc1.6 * Fri Oct 23 2015 Lubos Kardos <lkardos@redhat.com> - 4.13-0.rc1.6
- If %%_wrong_version_format_terminate_build is 1 then terminate build in case - If %%_wrong_version_format_terminate_build is 1 then terminate build in case
that version format is wrong i. e. epoch is not unsigned integer or version that version format is wrong i. e. epoch is not unsigned integer or version