- Re-enable SHA256 header digest generation (see #1480407)
This commit is contained in:
Panu Matilainen 2017-09-06 18:41:01 +03:00
parent fefe4f03a3
commit 1dda23dab1
7 changed files with 9 additions and 382 deletions

1
.gitignore vendored
View File

@ -24,3 +24,4 @@
/rpm-4.13.0.tar.bz2
/rpm-4.13.0.1.tar.bz2
/rpm-4.13.90-git14002.tar.bz2
/rpm-4.14.0-rc1.tar.bz2

View File

@ -1,97 +0,0 @@
From 70a1efa52b2c442308fd1ddfd706770b6515a2c5 Mon Sep 17 00:00:00 2001
Message-Id: <70a1efa52b2c442308fd1ddfd706770b6515a2c5.1503938132.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 28 Aug 2017 18:56:04 +0300
Subject: [PATCH 1/3] Limit automatic fallback to DB_PRIVATE to read-only
operations
Only permit automatic fallback to the essentially lockless operation
of DB_PRIVATE when read-only database is requested. This isn't exactly
correct, as readers need locks for correct operation just like writers do,
but at least in the readonly case the database wont be damaged.
The exception to the rule is systems which don't support the shared mapping
at all so we don't have much choice. Explicitly configured
I-know-what-I'm-doing DB_PRIVATE is not affected either.
---
lib/backend/db3.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 26013bfa0..89d14a878 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -407,6 +407,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
int rc, xx;
int retry_open = 2;
int lockfd = -1;
+ int rdonly = ((rdb->db_mode & O_ACCMODE) == O_RDONLY);
struct dbConfig_s * cfg = &rdb->cfg;
/* This is our setup, thou shall not have other setups before us */
uint32_t eflags = (DB_CREATE|DB_INIT_MPOOL|DB_INIT_CDB);
@@ -476,7 +477,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
*/
if (!(eflags & DB_PRIVATE)) {
lockfd = serialize_env(dbhome);
- if (lockfd < 0) {
+ if (lockfd < 0 && rdonly) {
eflags |= DB_PRIVATE;
retry_open--;
rpmlog(RPMLOG_DEBUG, "serialize failed, using private dbenv\n");
@@ -494,7 +495,10 @@ static int db_init(rpmdb rdb, const char * dbhome)
free(fstr);
rc = (dbenv->open)(dbenv, dbhome, eflags, rdb->db_perms);
- if ((rc == EACCES || rc == EROFS) || (rc == EINVAL && errno == rc)) {
+ if (rc == EINVAL && errno == rc) {
+ eflags |= DB_PRIVATE;
+ retry_open--;
+ } else if (rdonly && (rc == EACCES || rc == EROFS)) {
eflags |= DB_PRIVATE;
retry_open--;
} else {
--
2.13.5
From 2822ccbcdf3e898b960fafb23c4d571e26cef0a4 Mon Sep 17 00:00:00 2001
Message-Id: <2822ccbcdf3e898b960fafb23c4d571e26cef0a4.1503938132.git.pmatilai@redhat.com>
In-Reply-To: <70a1efa52b2c442308fd1ddfd706770b6515a2c5.1503938132.git.pmatilai@redhat.com>
References: <70a1efa52b2c442308fd1ddfd706770b6515a2c5.1503938132.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 28 Aug 2017 19:17:24 +0300
Subject: [PATCH 2/3] Fallback to DB_PRIVATE on readonly DB_VERSION_MISMATCH
too (RhBug:1465809)
All these years BDB has been relying on undefined behavior by storing
POSIX thread objects in its persistent environment files (for the long
story, see RhBug:1394862). As a side-effect of fixing it in BDB,
all sorts of creatures from dark corners are getting dragged into
the daylight: rawhide glibc gets updated a lot and we're getting
DB_VERSION_MISMATCH hits from rpm queries from package scriptlets
(told you so...), other tools not closing their database handles
when they should etc etc. This lets those cases continue "working"
to the extent they always did (ie unreliably) for now.
We should log some diagnostic message in this case, but coming up
with an understandable and reasonably short message for this mess
isn't that easy :)
---
lib/backend/db3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 89d14a878..da50dfda4 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -498,7 +498,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
if (rc == EINVAL && errno == rc) {
eflags |= DB_PRIVATE;
retry_open--;
- } else if (rdonly && (rc == EACCES || rc == EROFS)) {
+ } else if (rdonly && (rc == EACCES || rc == EROFS || rc == DB_VERSION_MISMATCH)) {
eflags |= DB_PRIVATE;
retry_open--;
} else {
--
2.13.5

View File

@ -1,147 +0,0 @@
diff -up rpm-4.13.90-git14002/rpmio/macro.c.noquote rpm-4.13.90-git14002/rpmio/macro.c
--- rpm-4.13.90-git14002/rpmio/macro.c.noquote 2017-08-14 11:43:41.160400779 +0300
+++ rpm-4.13.90-git14002/rpmio/macro.c 2017-08-14 11:43:58.924398809 +0300
@@ -649,61 +649,6 @@ freeArgs(MacroBuf mb, int delete)
mb->level--;
}
-/* XXX: belongs to argv.c but figure a sensible API before making public */
-static ARGV_t argvSplitShell(const char * str, const char * seps)
-{
- char *dest = NULL;
- ARGV_t argv;
- int argc = 1;
- const char * s;
- char * t;
- int c;
- int quote;
-
- if (str == NULL || seps == NULL)
- return NULL;
-
- dest = xmalloc(strlen(str) + 1);
- t = dest;
- s = str;
- argc = 1;
-
- while ((c = *s)) {
- if (strchr(seps, c)) {
- s++;
- } else {
- if (!strchr("\"\'",c)) {
- /* read argument not in "" or ''*/
- for (; (c = *s); s++, t++) {
- if (strchr(seps, c) || strchr("\"\'",c))
- break;
- *t = c;
- }
- } else {
- /* read argument in "" or '' */
- quote = *s;
- s++;
- for (; (c = *s) && (c != quote); t++,s++)
- *t = c;
- s++;
- }
- *t = '\0';
- t++;
- argc++;
- }
- }
- *t = '\0';
-
- argv = xmalloc((argc + 1) * sizeof(*argv));
- for (c = 0, s = dest; s < t; s+= strlen(s) + 1) {
- argv[c] = xstrdup(s);
- c++;
- }
- argv[c] = NULL;
- free(dest);
- return argv;
-}
-
/**
* Parse arguments (to next new line) for parameterized macro.
* @todo Use popt rather than getopt to parse args.
@@ -740,7 +685,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntr
expandThis(mb, se, lastc-se, &s);
mb->escape = oescape;
- av = argvSplitShell(s, " \t");
+ av = argvSplitString(s, " \t", ARGV_SKIPEMPTY);
argvAppend(&argv, av);
argvFree(av);
free(s);
diff -up rpm-4.13.90-git14002/tests/rpmmacro.at.noquote rpm-4.13.90-git14002/tests/rpmmacro.at
--- rpm-4.13.90-git14002/tests/rpmmacro.at.noquote 2017-08-14 11:39:38.512426695 +0300
+++ rpm-4.13.90-git14002/tests/rpmmacro.at 2017-08-14 11:40:18.807422527 +0300
@@ -268,69 +268,6 @@ runroot rpm \
)
AT_CLEANUP
-AT_SETUP([macro arguments in double quotes])
-AT_KEYWORDS([macros arguments])
-AT_CHECK([
-runroot rpm --define "%foo() 1:%1 2:%2" --eval '%foo "argument 1" argument_2'
-
-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \
- --eval '%foo "argument 1" argument_2 """"""'
-
-runroot rpm \
- --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \
- --eval '%foo "arg. number 1""arg. number 2" "arg number 3" "" normal'
-
-runroot rpm \
- --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \
- --eval '%foo "arg. number 1"normal"arg. number 2" '
-
-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \
- --eval '%foo """jjj"""aa"" '
-
-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" --eval '%foo xx"yy""zz""""bb" '
-],
-[0],
-[1:argument 1 2:argument_2
-1:argument 1 2:argument_2 3: 4: 5:
-1:arg. number 1 2:arg. number 2 3:arg number 3 4: 5:normal
-1:arg. number 1 2:normal 3:arg. number 2 4:%4 5:%5
-1: 2:jjj 3: 4:aa 5:
-1:xx 2:yy 3:zz 4: 5:bb
-])
-AT_CLEANUP
-
-AT_SETUP([macro arguments in single + double quotes])
-AT_KEYWORDS([macros arguments])
-AT_CHECK([
-
-runroot rpm \
- --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \
- --eval "%foo 'arg. number 1''arg. number 2' 'arg number 3' '' normal"
-
-runroot rpm \
- --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \
- --eval "%foo 'arg. number 1'normal'arg. number 2'''normal "
-
-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \
- --eval "%foo '''jjj'''aa'' "
-
-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \
- --eval "%foo ''\"jjj\"''aa\"\" "
-
-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" --eval "%foo xx'yy''zz''''bb' "
-
-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" --eval "%foo xx'yy'\"zz\"\"\"'bb' "
-],
-[0],
-[1:arg. number 1 2:arg. number 2 3:arg number 3 4: 5:normal
-1:arg. number 1 2:normal 3:arg. number 2 4: 5:normal
-1: 2:jjj 3: 4:aa 5:
-1: 2:jjj 3: 4:aa 5:
-1:xx 2:yy 3:zz 4: 5:bb
-1:xx 2:yy 3:zz 4: 5:bb
-])
-AT_CLEANUP
-
AT_SETUP([%undefine from different scopes])
AT_KEYWORDS([macros %undefine])
AT_CHECK([

View File

@ -1,94 +0,0 @@
From 4afe09cbcfbc43c1385b8626e69bea216600ee59 Mon Sep 17 00:00:00 2001
Message-Id: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 18 Aug 2017 12:43:27 +0300
Subject: [PATCH 1/2] Add a flag to allow quiet test for package existence with
lookupPackage()
Turning "flag" into an actual bitfield requires testing for
PART_NAME/PART_SUBNAME differently, no actual changes here though.
---
build/rpmbuild_internal.h | 1 +
build/spec.c | 16 +++++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
index c294d5ee2..439b7d3b5 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
@@ -138,6 +138,7 @@ struct Package_s {
#define PART_SUBNAME 0
#define PART_NAME 1
+#define PART_QUIET 2
/** \ingroup rpmbuild
* rpmSpec file parser states.
diff --git a/build/spec.c b/build/spec.c
index 17a9b7c5a..39599e284 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -73,7 +73,7 @@ rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg)
}
/* Construct partial package name */
- if (flag == PART_SUBNAME) {
+ if (!(flag & PART_NAME)) {
rasprintf(&fullName, "%s-%s",
headerGetString(spec->packages->header, RPMTAG_NAME), name);
name = fullName;
@@ -87,12 +87,14 @@ rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg)
}
}
- if (p == NULL && pkg != NULL) {
- rpmlog(RPMLOG_ERR, _("line %d: %s: package %s does not exist\n"),
- spec->lineNum, spec->line, name);
- } else if (p != NULL && pkg == NULL) {
- rpmlog(RPMLOG_ERR, _("line %d: %s: package %s already exists\n"),
- spec->lineNum, spec->line, name);
+ if (!(flag & PART_QUIET)) {
+ if (p == NULL && pkg != NULL) {
+ rpmlog(RPMLOG_ERR, _("line %d: %s: package %s does not exist\n"),
+ spec->lineNum, spec->line, name);
+ } else if (p != NULL && pkg == NULL) {
+ rpmlog(RPMLOG_ERR, _("line %d: %s: package %s already exists\n"),
+ spec->lineNum, spec->line, name);
+ }
}
if (fullName == name)
--
2.13.5
From 054de0f50fc1c8aacb6c45fa4a0fcd8d9ce5b2d1 Mon Sep 17 00:00:00 2001
Message-Id: <054de0f50fc1c8aacb6c45fa4a0fcd8d9ce5b2d1.1503051023.git.pmatilai@redhat.com>
In-Reply-To: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com>
References: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 18 Aug 2017 12:46:59 +0300
Subject: [PATCH 2/2] Use silent lookup for debuginfo packages (#1482144)
Noarch packages do not have debuginfo, this was causing harmless
but bogus error messages via lookupPackage(). Depends on commit
4afe09cbcfbc43c1385b8626e69bea216600ee59.
---
build/files.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build/files.c b/build/files.c
index c7fe2485c..5e84532f1 100644
--- a/build/files.c
+++ b/build/files.c
@@ -2981,7 +2981,7 @@ static int addDebugSrc(Package pkg, char *buildroot)
static Package findDebuginfoPackage(rpmSpec spec)
{
Package pkg = NULL;
- if (lookupPackage(spec, "debuginfo", PART_SUBNAME, &pkg))
+ if (lookupPackage(spec, "debuginfo", PART_SUBNAME|PART_QUIET, &pkg))
return NULL;
return pkg && pkg->fileList ? pkg : NULL;
}
--
2.13.5

View File

@ -1,32 +0,0 @@
diff --git a/lib/signature.c b/lib/signature.c
index b91baf628..ddfa969c9 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -120,6 +120,7 @@ rpmRC rpmGenerateSignature(char *SHA256, char *SHA1, uint8_t *MD5,
int gpgSize = rpmExpandNumeric("%{__gpg_reserved_space}");
/* Prepare signature */
+#if 0 /* rpm 4.13.x signature checking trips up on this, disable temporarily */
if (SHA256) {
rpmtdReset(&td);
td.tag = RPMSIGTAG_SHA256;
@@ -128,6 +129,7 @@ rpmRC rpmGenerateSignature(char *SHA256, char *SHA1, uint8_t *MD5,
td.data = SHA256;
headerPut(sig, &td, HEADERPUT_DEFAULT);
}
+#endif
if (SHA1) {
rpmtdReset(&td);
diff --git a/tests/rpmsigdig.at b/tests/rpmsigdig.at
index bf6bfd01a..75b9bc110 100644
--- a/tests/rpmsigdig.at
+++ b/tests/rpmsigdig.at
@@ -123,7 +123,6 @@ runroot rpmkeys -Kv /build/RPMS/noarch/attrtest-1.0-1.noarch.rpm
[0],
[/build/RPMS/noarch/attrtest-1.0-1.noarch.rpm:
Header SHA1 digest: OK
- Header SHA256 digest: OK
Payload SHA256 digest: OK
MD5 digest: OK
],

View File

@ -25,8 +25,8 @@
%define rpmhome /usr/lib/rpm
%global rpmver 4.13.90
%global snapver git14002
%global rpmver 4.14.0
%global snapver rc1
%global srcver %{version}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@ -37,7 +37,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}8%{?dist}
Release: %{?snapver:0.%{snapver}.}1%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2
@ -58,16 +58,8 @@ Patch3: rpm-4.9.90-no-man-dirs.patch
Patch4: rpm-4.8.1-use-gpg2.patch
# Temporary band-aid for rpm2cpio whining on payload size mismatch (#1142949)
Patch5: rpm-4.12.0-rpm2cpio-hack.patch
# rpm 4.13 rpmkeys -K is buggy and chokes on the new sha256 header digest,
# disable its generation until fixed in other fedora versions (#1480407)
Patch6: rpm-4.14-disable-sha256hdr.patch
# Macro argument quoting breaks too much stuff, disable until a better
# solution is found upstream (#1481025)
Patch7: rpm-4.13.90-macro-noquote.patch
# Patches already upstream:
Patch100: rpm-4.13.90-silent-lookup.patch
Patch101: rpm-4.13.90-db-version-mismatch.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@ -634,6 +626,10 @@ make check
%doc doc/librpm/html/*
%changelog
* Wed Sep 06 2017 Panu Matilainen <pmatilai@redhat.com> - 4.14.0-0.rc1.1
- Rebase to rpm 4.14.0-rc1 (http://rpm.org/wiki/Releases/4.14.0)
- Re-enable SHA256 header digest generation (see #1480407)
* Mon Aug 28 2017 Panu Matilainen <pmatilai@redhat.com> - 4.13.90-0.git14000.8
- Band-aid for DB_VERSION_MISMATCH errors on glibc updates (#1465809)

View File

@ -1 +1 @@
SHA512 (rpm-4.13.90-git14002.tar.bz2) = ac3c7bda592e2de77692050549992b2d822aa26eb49ba5f490686705fd4714299453cf71e8f21b01ece56908f5061bfff11233da4be8b6302e4dc5dd293ede41
SHA512 (rpm-4.14.0-rc1.tar.bz2) = f08c948c566e695083daeca2b9bac0e542821e12503c0d6fca4b1fd0584f74505ed24b48544147ec98290c65ee50807d9c2a9e7e35ef30ee77122bd1037a8375