aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2019-06-10 12:01:35 +0200
committerFabian Groffen <grobian@gentoo.org>2019-06-10 12:01:35 +0200
commit18886e6e1c037ea95a05ff200a8a5097df80d9fe (patch)
tree1c2756e2671c29a35da8f216b8b667e75466adf2
parentmain: CONFIG_PROTECT should not be prefixed (diff)
downloadportage-utils-18886e6e1c037ea95a05ff200a8a5097df80d9fe.tar.gz
portage-utils-18886e6e1c037ea95a05ff200a8a5097df80d9fe.tar.bz2
portage-utils-18886e6e1c037ea95a05ff200a8a5097df80d9fe.zip
qmerge: fix some issues regarding EPREFIX usage
- EROOT and ED don't have EPREFIX prefixed, but postfixed - config_protect should expect the checked paths not to have EPREFIX Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--qmerge.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/qmerge.c b/qmerge.c
index c11856bb..31a96484 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -358,6 +358,10 @@ config_protected(const char *buf, int cp_argc, char **cp_argv,
char dest[_Q_PATH_MAX];
snprintf(dest, sizeof(dest), "%s%s", portroot, buf);
+ /* config protect paths don't carry EPREFIX */
+ if (strncmp(buf, CONFIG_EPREFIX, strlen(CONFIG_EPREFIX) - 1) == 0)
+ buf += strlen(CONFIG_EPREFIX) - 1;
+
/* Check CONFIG_PROTECT_MASK */
for (i = 1; i < cpm_argc; ++i)
if (strncmp(cpm_argv[i], buf, strlen(cpm_argv[i])) == 0)
@@ -370,7 +374,7 @@ config_protected(const char *buf, int cp_argc, char **cp_argv,
return 1;
/* this would probably be bad */
- if (strcmp("/bin/sh", buf) == 0)
+ if (strcmp(CONFIG_EPREFIX "bin/sh", buf) == 0)
return 1;
return 0;
@@ -750,9 +754,9 @@ pkg_run_func_at(int dirfd, const char *vdb_path, const char *phases, const char
"FILESDIR=/.does/not/exist/anywhere\n"
"MERGE_TYPE=binary\n"
"ROOT='%4$s'\n"
- "EROOT=\"${EPREFIX%%/}/${ROOT#/}/\"\n"
+ "EROOT=\"/${ROOT#/}/${EPREFIX%%/}/\"\n"
"D=\"%5$s\"\n"
- "ED=\"${EPREFIX%%/}/${D#/}/\"\n"
+ "ED=\"${D%%/}/${EPREFIX%%/}/\"\n"
"T=\"%6$s\"\n"
/* Finally run the func */
"%7$s%2$s\n"