现象:
find: The relative path ‘Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_x64__79rhkp1fndgsc’ is included in the PATH environment variable, which is insecure in combination with the -execdir action of find. Please remove that entry from $PATH
package/Makefile:65: recipe for target ‘package/install’ failed
make[2]: *** [package/install] Error 1
分析:
环境变量PATH内,路径:
'Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_x64__79rhkp1fndgsc’存在风险,当find -execdir命令执行时。
- shell执行echo $PATH,确实存在路径:"/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_x64__79rhkp1fndgsc"
- 查看此目录下文件为ubuntu1804.exe等,推测应该是Ubuntu系统的虚拟程序。
- 个人觉得这个路径对Ubuntu系统无过多用,Ubuntu不支持exe的运行,当然wine除外,但是wine也无执行ubuntu1804.exe程序的必要。
- 不确定微软添加此路径的意图,个人选择从PATH内剔除这个路径。
解决:
网上临时修改环境变量的方法,不能根治。这里采取针对用户修改部署文件,从PATH内剔除这个路径。
-
测试变量替换命令
{string/old/new}
- 将string内old替换为new。
echo “${PATH/’/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_x64__79rhkp1fndgsc:’/}” -
修改用户部署文件。
vim ~/.profile
在最后一行添加如下语句,删除指定路径:
PATH="${PATH/'/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_x64__79rhkp1fndgsc:'/}"
注:不同电脑路径不一样,请依据现象中报错路径指定。