SHA256
3
0
forked from pool/rpm

Accepting request 787932 from Base:System

Follow one level of symlink indirection when converting the rpm database [bnc#1167537]

Note that this is IMPORTANT and should go into Factory fast: without
it, updates to Tumbleweed may end up with a broken rpm database.
See bugzilla 1167537 for the gory details.

OBS-URL: https://build.opensuse.org/request/show/787932
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpm?expand=0&rev=278
This commit is contained in:
Dominique Leuenberger 2020-03-24 22:07:22 +00:00 committed by Git OBS Bridge
commit b6a9e0632f
3 changed files with 51 additions and 14 deletions

View File

@ -1,5 +1,5 @@
--- ./lib/backend/bdb_ro.c.orig 2020-01-17 15:48:50.622349363 +0000 --- ./lib/backend/bdb_ro.c.orig 2020-03-24 20:45:19.121907476 +0000
+++ ./lib/backend/bdb_ro.c 2020-01-17 15:49:20.514287856 +0000 +++ ./lib/backend/bdb_ro.c 2020-03-24 20:46:17.141727988 +0000
@@ -795,6 +795,7 @@ static unsigned int bdbro_pkgdbKey(dbiIn @@ -795,6 +795,7 @@ static unsigned int bdbro_pkgdbKey(dbiIn
struct rpmdbOps_s bdbro_dbops = { struct rpmdbOps_s bdbro_dbops = {
.name = "bdb_ro", .name = "bdb_ro",
@ -8,8 +8,8 @@
.open = bdbro_Open, .open = bdbro_Open,
.close = bdbro_Close, .close = bdbro_Close,
--- ./lib/backend/dbi.c.orig 2020-01-17 15:48:50.622349363 +0000 --- ./lib/backend/dbi.c.orig 2020-03-24 20:45:19.121907476 +0000
+++ ./lib/backend/dbi.c 2020-01-17 15:49:20.514287856 +0000 +++ ./lib/backend/dbi.c 2020-03-24 20:46:17.141727988 +0000
@@ -105,11 +105,20 @@ dbDetectBackend(rpmdb rdb) @@ -105,11 +105,20 @@ dbDetectBackend(rpmdb rdb)
} }
@ -31,8 +31,8 @@
const char * dbiName(dbiIndex dbi) const char * dbiName(dbiIndex dbi)
{ {
return dbi->dbi_file; return dbi->dbi_file;
--- ./lib/backend/dbi.h.orig 2020-01-17 15:48:50.622349363 +0000 --- ./lib/backend/dbi.h.orig 2020-03-24 20:45:19.121907476 +0000
+++ ./lib/backend/dbi.h 2020-01-17 15:49:49.886227415 +0000 +++ ./lib/backend/dbi.h 2020-03-24 20:46:17.141727988 +0000
@@ -10,6 +10,7 @@ enum rpmdbFlags { @@ -10,6 +10,7 @@ enum rpmdbFlags {
RPMDB_FLAG_JUSTCHECK = (1 << 0), RPMDB_FLAG_JUSTCHECK = (1 << 0),
RPMDB_FLAG_REBUILD = (1 << 1), RPMDB_FLAG_REBUILD = (1 << 1),
@ -72,8 +72,8 @@
int (*open)(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags); int (*open)(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags);
int (*close)(dbiIndex dbi, unsigned int flags); int (*close)(dbiIndex dbi, unsigned int flags);
--- ./lib/rpmdb.c.orig 2020-01-17 15:48:50.622349363 +0000 --- ./lib/rpmdb.c.orig 2020-03-24 20:45:19.117907488 +0000
+++ ./lib/rpmdb.c 2020-01-17 15:53:52.241669094 +0000 +++ ./lib/rpmdb.c 2020-03-24 21:01:54.870821518 +0000
@@ -513,8 +513,16 @@ static int openDatabase(const char * pre @@ -513,8 +513,16 @@ static int openDatabase(const char * pre
rpmsqActivate(1); rpmsqActivate(1);
} }
@ -128,7 +128,31 @@
{ {
rpmdb olddb; rpmdb olddb;
char * dbpath = NULL; char * dbpath = NULL;
@@ -2536,7 +2555,7 @@ int rpmdbRebuild(const char * prefix, rp @@ -2512,7 +2531,22 @@ int rpmdbRebuild(const char * prefix, rp
}
rootdbpath = rpmGetPath(prefix, dbpath, NULL);
- newdbpath = rpmGetPath("%{?_dbpath_rebuild}", NULL);
+ if ((newdbflags & RPMDB_FLAG_CONVERT) != 0) {
+ char lbuf[PATH_MAX];
+ ssize_t s = readlink(rootdbpath, lbuf, PATH_MAX);
+ if (s > 0 && s < PATH_MAX) {
+ lbuf[s] = 0;
+ free(dbpath);
+ if (lbuf[0] == '/')
+ dbpath = strdup(lbuf);
+ else
+ dbpath = rpmGetPath("%{?_dbpath}", "/../", lbuf, NULL);
+ free(rootdbpath);
+ rootdbpath = rpmGetPath(prefix, dbpath, NULL);
+ }
+ newdbpath = strdup("");
+ } else
+ newdbpath = rpmGetPath("%{?_dbpath_rebuild}", NULL);
if (rstreq(newdbpath, "") || rstreq(newdbpath, dbpath)) {
newdbpath = _free(newdbpath);
rasprintf(&newdbpath, "%srebuilddb.%d", dbpath, (int) getpid());
@@ -2536,7 +2570,7 @@ int rpmdbRebuild(const char * prefix, rp
goto exit; goto exit;
} }
if (openDatabase(prefix, newdbpath, &newdb, if (openDatabase(prefix, newdbpath, &newdb,
@ -137,8 +161,8 @@
rc = 1; rc = 1;
goto exit; goto exit;
} }
--- ./lib/rpmdb_internal.h.orig 2020-01-17 15:51:16.134030103 +0000 --- ./lib/rpmdb_internal.h.orig 2019-06-26 14:17:31.412985694 +0000
+++ ./lib/rpmdb_internal.h 2020-01-17 15:50:27.050144956 +0000 +++ ./lib/rpmdb_internal.h 2020-03-24 20:46:17.141727988 +0000
@@ -63,11 +63,13 @@ int rpmdbClose (rpmdb db); @@ -63,11 +63,13 @@ int rpmdbClose (rpmdb db);
* @param prefix path to top of install tree * @param prefix path to top of install tree
* @param ts transaction set (or NULL) * @param ts transaction set (or NULL)
@ -154,8 +178,8 @@
/** \ingroup rpmdb /** \ingroup rpmdb
* Verify database components. * Verify database components.
--- ./lib/rpmts.c.orig 2020-01-17 15:51:37.813979967 +0000 --- ./lib/rpmts.c.orig 2020-03-24 20:45:19.105907526 +0000
+++ ./lib/rpmts.c 2020-01-17 15:51:48.925954269 +0000 +++ ./lib/rpmts.c 2020-03-24 20:46:17.145727976 +0000
@@ -143,9 +143,9 @@ int rpmtsRebuildDB(rpmts ts) @@ -143,9 +143,9 @@ int rpmtsRebuildDB(rpmts ts)
txn = rpmtxnBegin(ts, RPMTXN_WRITE); txn = rpmtxnBegin(ts, RPMTXN_WRITE);
if (txn) { if (txn) {

View File

@ -121,7 +121,7 @@
%_host_cpu @host_cpu@ %_host_cpu @host_cpu@
%_host_vendor @host_vendor@ %_host_vendor @host_vendor@
%_host_os @host_os@ %_host_os @host_os@
@@ -1119,7 +1139,9 @@ package or when debugging this package.\ @@ -1119,7 +1139,10 @@ package or when debugging this package.\
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# arch macro for all supported ARM processors # arch macro for all supported ARM processors
@ -129,6 +129,7 @@
+%arm armv3l armv4b armv4l armv4tl armv5b armv5l armv5teb armv5tel armv5tejl armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl +%arm armv3l armv4b armv4l armv4tl armv5b armv5l armv5teb armv5tel armv5tejl armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl
+%arml armv3l armv4l armv5l armv5tel armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl +%arml armv3l armv4l armv5l armv5tel armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl
+%armb armv4b armv5b armv5teb +%armb armv4b armv5b armv5teb
+%arm64 aarch64
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# arch macro for 32-bit MIPS processors # arch macro for 32-bit MIPS processors

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Tue Mar 24 22:16:22 CET 2020 - mls@suse.de
- Follow one level of symlink indirection when converting the rpm
database [bnc#1167537]
* modified patch: db_conversion.diff
-------------------------------------------------------------------
Mon Mar 23 16:11:34 UTC 2020 - Sergio Lindo Mansilla <slindomansilla@suse.com>
- Add macro for supported ARM 64bit processors
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jan 17 11:27:17 CET 2020 - mls@suse.de Fri Jan 17 11:27:17 CET 2020 - mls@suse.de