1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 00:39:46 +00:00

rpm: realpath is required before expanding _dbpath in chroot

A regression is introduced by commit 66573093:
[ rpm: Fix rpm relocation macro usage ]

_usr turned out to be a relative path to support dyanmic config after
that, but it's being used somewhere as a indicator to locate substrings,
so we must get the real path of it in advance.

(From OE-Core rev: 1247955a907f51aac7efd305d26856e263c11a65)

(From OE-Core rev: 4b9ae27e3ac9cf55bff5418fe884738b8ec5ab9b)

Signed-off-by: Ming Liu <ming.liu@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ming Liu
2014-10-21 19:10:54 +08:00
committed by Richard Purdie
parent 9b0df21b87
commit a4814ac1b0
3 changed files with 26 additions and 0 deletions
@@ -0,0 +1,24 @@
chroot: realpath is required before expanding _dbpath
_usr turned out to be a relative path to support dyanmic config, but it's
being used somewhere as a indicator to locate substrings, so we must get
the real path of it in advance.
Upstream-Status: Inapproriate (OpenEmbedded specific)
Signed-off-by: Ming Liu <ming.liu@windriver.com>
diff -urpN a/rpmio/rpmrpc.c b/rpmio/rpmrpc.c
--- a/rpmio/rpmrpc.c
+++ b/rpmio/rpmrpc.c
@@ -257,7 +257,9 @@ int Open(const char * path, int flags, m
/* XXX if the open(2) fails, try to strip a possible chroot(2) prefix. */
if (fdno < 0 && errno == ENOENT) {
const char *dbpath = rpmExpand("%{?_dbpath}/", NULL);
- const char * fn = strstr(path + 1, dbpath);
+ char resolved_dbpath[PATH_MAX];
+ realpath(dbpath, resolved_dbpath);
+ const char * fn = strstr(path + 1, resolved_dbpath);
if (fn)
fdno = open(fn, flags, mode);
dbpath = _free(dbpath);
+1
View File
@@ -109,6 +109,7 @@ SRC_URI = "cvs://anonymous@rpm5.org/cvs;tag=rpm-5_4;module=rpm \
file://rpm-db5-or-db6.patch \
file://rpm-rpmpgp-fix.patch \
file://rpm-disable-Wno-override-init.patch \
file://rpm-realpath.patch \
"
# Uncomment the following line to enable platform score debugging
+1
View File
@@ -93,6 +93,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.14-0.20131024.src.rpm;e
file://rpm-db5-or-db6.patch \
file://rpm-disable-Wno-override-init.patch \
file://rpmqv_cc_b_gone.patch \
file://rpm-realpath.patch \
"
# Uncomment the following line to enable platform score debugging