From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 20691138334 for ; Fri, 27 Dec 2019 19:17:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6A438E0BA4; Fri, 27 Dec 2019 19:17:00 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4F898E0BA3 for ; Fri, 27 Dec 2019 19:17:00 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0DF1934DBDD for ; Fri, 27 Dec 2019 19:16:59 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id BFA0736 for ; Fri, 27 Dec 2019 19:16:57 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1577467528.5e5cba1176c8bfa39405b5cf29dcf50c08f8fc66.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: main.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 5e5cba1176c8bfa39405b5cf29dcf50c08f8fc66 X-VCS-Branch: master Date: Fri, 27 Dec 2019 19:16:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ea13054b-c38e-4d9f-939a-34405bc8e189 X-Archives-Hash: 0216a08c3b4b978e08e95976ca87eba5 commit: 5e5cba1176c8bfa39405b5cf29dcf50c08f8fc66 Author: Fabian Groffen gentoo org> AuthorDate: Fri Dec 27 17:25:28 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Dec 27 17:25:28 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5e5cba11 main: use cannonical repo paths for repos.conf and PORTDIR Make sure we compare the same locations by using realpath() Signed-off-by: Fabian Groffen gentoo.org> main.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index b5404cb..f0a8841 100644 --- a/main.c +++ b/main.c @@ -639,7 +639,10 @@ read_one_repos_conf(const char *repos_conf, char **primary) { int nsec; char *conf; - const char *main_repo, *repo, *path; + char rrepo[_Q_PATH_MAX]; + const char *main_repo; + const char *repo; + const char *path; dictionary *dict; if (getenv("DEBUG")) @@ -662,6 +665,10 @@ read_one_repos_conf(const char *repos_conf, char **primary) size_t n; char *overlay; + /* try not to get confused by symlinks etc. */ + if (realpath(path, rrepo) != NULL) + path = rrepo; + array_for_each(overlay_names, n, overlay) { if (strcmp(overlay, repo) == 0) break; @@ -906,12 +913,18 @@ initialize_portage_env(void) var = &vars_to_read[11]; /* PORTDIR */ if (strcmp(var->src, STR_DEFAULT) != 0 || array_cnt(overlays) == 0) { + char roverlay[_Q_PATH_MAX]; + /* get cannonical path, we do so for repos.conf too */ + if (realpath(main_overlay, roverlay) == NULL) + snprintf(roverlay, sizeof(roverlay), "%s", main_overlay); array_for_each(overlays, i, overlay) { - if (strcmp(overlay, main_overlay) == 0) + if (strcmp(overlay, roverlay) == 0) break; overlay = NULL; } if (overlay == NULL) { /* add PORTDIR to overlays */ + free(main_overlay); + main_overlay = xstrdup(roverlay); xarraypush_ptr(overlays, main_overlay); xarraypush_str(overlay_names, ""); xarraypush_str(overlay_src, var->src);