moovweb / gvm

Go Version Manager
http://github.com/moovweb/gvm
MIT License
9.91k stars 522 forks source link

A bug in file "scripts/install" #353

Closed featherL closed 11 months ago

featherL commented 3 years ago

line 104: echo "export LD_LIBRARY_PATH; LD_LIBRARY_PATH=\"\${GVM_OVERLAY_PREFIX}/lib:\${LD_LIBRARY_PATH}\"" >> "$new_env_file"

The variable "LD_LIBRARY_PATH" would be "xxxx:" if the variable is empty. There would be some problems.

On the right of separator ":" is empty and it is considered as current path.

Just like as follow: image

The command "ls"(or others program) would use the "libc.so.6" which is in current path instead of which should have been use.

I replace the line 104 with as follow:

echo "if [ \$LD_LIBRARY_PATH ]; then" >> "$new_env_file"
echo "    export LD_LIBRARY_PATH; LD_LIBRARY_PATH=\"\${GVM_OVERLAY_PREFIX}/lib:\${LD_LIBRARY_PATH}\"" >> "$new_env_file"
echo "else" >> "$new_env_file"
echo "    export LD_LIBRARY_PATH; LD_LIBRARY_PATH=\"\${GVM_OVERLAY_PREFIX}/lib\"" >> "$new_env_file"
echo "fi" >> "$new_env_file"