setup-gcc.sh
eles
eles at eles.com
Fri Jun 7 05:26:21 PDT 2013
Hello,
What is the purpose of this code in setup-gcc.sh?
# 1. Remove d sources from d_gccsrc if already exist
test -h "$d_gccsrc/gcc/d" && rm "$d_gccsrc/gcc/d"
test -d "$d_gccsrc/libphobos" && rm -r "$d_gccsrc/libphobos"
if test -e "$d_gccsrc/gcc/d" -o -e "$d_gccsrc/libphobos"; then
echo "error: cannot update gcc source, please remove D
sources by hand."
exit 1
fi
For example, the line
test -h "$d_gccsrc/gcc/d" && rm "$d_gccsrc/gcc/d"
should return 0 if $d_gccsrc/gcc/d both exists and is a symlink.
The command fails if any of the two is not true, and the intended
purpose is to remove the original D sources from the gcc package
(that is, when the "d" folder exists, but is *not* a symlink).
However, if the "d" folder exists and is *not* a symlink, the
exit code of "test" will be 1, that is the command will *not*
succeed.
In that case, the "rm" part will not be executed, which destroys
the purpose of it.
Do I miss something?
More, why testing for symlink-ness in the first place? Existing
sources (or symlink towards them) should be deleted and, then,
newly-provided sources should be provided, that's all. What if an
existing symlink exists, but points to an outdated D source?
More information about the D.gnu
mailing list