Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 588862 Details for
Bug 693366
env-update: Canonicalize paths in generated files
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
portage-canonicalization.patch (text/plain), 4.50 KB, created by
Arfrever Frehtes Taifersar Arahesis
on 2019-09-03 02:09:25 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Arfrever Frehtes Taifersar Arahesis
Created:
2019-09-03 02:09:25 UTC
Size:
4.50 KB
patch
obsolete
>From 747768ac1015d3a244ed9267cd151c68ccb5e3cd Mon Sep 17 00:00:00 2001 >From: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> >Date: Tue, 3 Sep 2019 04:01:47 +0200 >Subject: [PATCH] env-update: Canonicalize paths in generated files. > >Canonicalization affects paths in: > /etc/profile.env > /etc/csh.env > /etc/ld.so.conf > /etc/prelink.conf.d/portage.conf > >CANONICALIZATION_EXEMPTED variable can be set in a /etc/env.d/* file to >exempt specific variables from canonicalization of paths. >CONFIG_PROTECT and CONFIG_PROTECT_MASK are exempted by default. > >Bug: https://bugs.gentoo.org/693366 >Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> >--- > lib/portage/util/env_update.py | 35 +++++++++++++++++++++++++--------- > 1 file changed, 26 insertions(+), 9 deletions(-) > >diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py >index 032101043..f0f80ce0e 100644 >--- a/lib/portage/util/env_update.py >+++ b/lib/portage/util/env_update.py >@@ -1,4 +1,4 @@ >-# Copyright 2010-2014 Gentoo Foundation >+# Copyright 2010-2019 Gentoo Authors > # Distributed under the terms of the GNU General Public License v2 > > __all__ = ['env_update'] >@@ -112,6 +112,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, > "CLASSPATH", "INFODIR", "INFOPATH", "KDEDIRS", "LDPATH", "MANPATH", > "PATH", "PKG_CONFIG_PATH", "PRELINK_PATH", "PRELINK_PATH_MASK", > "PYTHONPATH", "ROOTPATH"]) >+ canonicalization_exempted = set(["CONFIG_PROTECT", "CONFIG_PROTECT_MASK"]) > > config_list = [] > >@@ -135,6 +136,9 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, > if "COLON_SEPARATED" in myconfig: > colon_separated.update(myconfig["COLON_SEPARATED"].split()) > del myconfig["COLON_SEPARATED"] >+ if "CANONICALIZATION_EXEMPTED" in myconfig: >+ canonicalization_exempted.update(myconfig["CANONICALIZATION_EXEMPTED"].split()) >+ del myconfig["CANONICALIZATION_EXEMPTED"] > > env = {} > specials = {} >@@ -143,8 +147,12 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, > for myconfig in config_list: > if var in myconfig: > for item in myconfig[var].split(): >- if item and not item in mylist: >- mylist.append(item) >+ if item: >+ if var not in canonicalization_exempted and os.path.isabs(item): >+ # Canonicalize path >+ item = os.path.realpath(item) >+ if not item in mylist: >+ mylist.append(item) > del myconfig[var] # prepare for env.update(myconfig) > if mylist: > env[var] = " ".join(mylist) >@@ -155,16 +163,24 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, > for myconfig in config_list: > if var in myconfig: > for item in myconfig[var].split(":"): >- if item and not item in mylist: >- mylist.append(item) >+ if item: >+ if var not in canonicalization_exempted and os.path.isabs(item): >+ # Canonicalize path >+ item = os.path.realpath(item) >+ if not item in mylist: >+ mylist.append(item) > del myconfig[var] # prepare for env.update(myconfig) > if mylist: > env[var] = ":".join(mylist) > specials[var] = mylist > > for myconfig in config_list: >- """Cumulative variables have already been deleted from myconfig so that >- they won't be overwritten by this dict.update call.""" >+ for var in myconfig: >+ if var not in canonicalization_exempted and os.path.isabs(myconfig[var]): >+ # Canonicalize path >+ myconfig[var] = os.path.realpath(myconfig[var]) >+ # Cumulative variables have already been deleted from myconfig so that >+ # they won't be overwritten by this dict.update call. > env.update(myconfig) > > ldsoconf_path = os.path.join(eroot, "etc", "ld.so.conf") >@@ -206,7 +222,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, > except UnicodeDecodeError: > continue > if os.path.basename(y) != 'libexec': >- potential_lib_dirs.add(y[len(eroot):]) >+ potential_lib_dirs.add(os.path.realpath(y)[len(eroot):]) > > # Update prelink.conf if we are prelink-enabled > if prelink_capable: >@@ -216,7 +232,8 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, > newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n") > newprelink.write("# contents of /etc/env.d directory\n") > >- for x in sorted(potential_lib_dirs) + ['bin', 'sbin']: >+ for x in sorted(potential_lib_dirs) + \ >+ sorted(set(os.path.realpath(os.path.join(eroot, y))[len(eroot):] for y in ('bin', 'sbin'))): > newprelink.write('-l /%s\n' % (x,)); > prelink_paths = set() > prelink_paths |= set(specials.get('LDPATH', [])) >-- >2.23.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 693366
: 588862