aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm/rpm/rpm-realpath.patch
blob: a810123ba89c589e7f087edc293203d1b8727d19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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: Inappropriate (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);