- Follow one level of symlink indirection when converting the rpm

database [bnc#1167537]

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=536
This commit is contained in:
Michael Schröder 2020-03-24 21:18:19 +00:00 committed by Git OBS Bridge
parent 0943bab7a8
commit b3d28e93f5
4 changed files with 48 additions and 17 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 2020-01-17 15:49:20.514287856 +0000
--- ./lib/backend/bdb_ro.c.orig 2020-03-24 20:45:19.121907476 +0000
+++ ./lib/backend/bdb_ro.c 2020-03-24 20:46:17.141727988 +0000
@@ -795,6 +795,7 @@ static unsigned int bdbro_pkgdbKey(dbiIn
struct rpmdbOps_s bdbro_dbops = {
.name = "bdb_ro",
@ -8,8 +8,8 @@
.open = bdbro_Open,
.close = bdbro_Close,
--- ./lib/backend/dbi.c.orig 2020-01-17 15:48:50.622349363 +0000
+++ ./lib/backend/dbi.c 2020-01-17 15:49:20.514287856 +0000
--- ./lib/backend/dbi.c.orig 2020-03-24 20:45:19.121907476 +0000
+++ ./lib/backend/dbi.c 2020-03-24 20:46:17.141727988 +0000
@@ -105,11 +105,20 @@ dbDetectBackend(rpmdb rdb)
}
@ -31,8 +31,8 @@
const char * dbiName(dbiIndex dbi)
{
return dbi->dbi_file;
--- ./lib/backend/dbi.h.orig 2020-01-17 15:48:50.622349363 +0000
+++ ./lib/backend/dbi.h 2020-01-17 15:49:49.886227415 +0000
--- ./lib/backend/dbi.h.orig 2020-03-24 20:45:19.121907476 +0000
+++ ./lib/backend/dbi.h 2020-03-24 20:46:17.141727988 +0000
@@ -10,6 +10,7 @@ enum rpmdbFlags {
RPMDB_FLAG_JUSTCHECK = (1 << 0),
RPMDB_FLAG_REBUILD = (1 << 1),
@ -72,8 +72,8 @@
int (*open)(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags);
int (*close)(dbiIndex dbi, unsigned int flags);
--- ./lib/rpmdb.c.orig 2020-01-17 15:48:50.622349363 +0000
+++ ./lib/rpmdb.c 2020-01-17 15:53:52.241669094 +0000
--- ./lib/rpmdb.c.orig 2020-03-24 20:45:19.117907488 +0000
+++ ./lib/rpmdb.c 2020-03-24 21:01:54.870821518 +0000
@@ -513,8 +513,16 @@ static int openDatabase(const char * pre
rpmsqActivate(1);
}
@ -128,7 +128,31 @@
{
rpmdb olddb;
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;
}
if (openDatabase(prefix, newdbpath, &newdb,
@ -137,8 +161,8 @@
rc = 1;
goto exit;
}
--- ./lib/rpmdb_internal.h.orig 2020-01-17 15:51:16.134030103 +0000
+++ ./lib/rpmdb_internal.h 2020-01-17 15:50:27.050144956 +0000
--- ./lib/rpmdb_internal.h.orig 2019-06-26 14:17:31.412985694 +0000
+++ ./lib/rpmdb_internal.h 2020-03-24 20:46:17.141727988 +0000
@@ -63,11 +63,13 @@ int rpmdbClose (rpmdb db);
* @param prefix path to top of install tree
* @param ts transaction set (or NULL)
@ -154,8 +178,8 @@
/** \ingroup rpmdb
* Verify database components.
--- ./lib/rpmts.c.orig 2020-01-17 15:51:37.813979967 +0000
+++ ./lib/rpmts.c 2020-01-17 15:51:48.925954269 +0000
--- ./lib/rpmts.c.orig 2020-03-24 20:45:19.105907526 +0000
+++ ./lib/rpmts.c 2020-03-24 20:46:17.145727976 +0000
@@ -143,9 +143,9 @@ int rpmtsRebuildDB(rpmts ts)
txn = rpmtxnBegin(ts, RPMTXN_WRITE);
if (txn) {

View File

@ -1,7 +1,7 @@
#
# spec file for package python-rpm
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 Neal Gompa <ngompa13@gmail.com>.
#
# All modifications and additions to the file contributed by third parties
@ -13,7 +13,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
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>

View File

@ -1,7 +1,7 @@
#
# spec file for package rpm
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#