This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR target/6429 (take 2)
On May 7, 2002, Jakub Jelinek <jakub@redhat.com> wrote:
> +++ gcc/config/t-slibgcc-elf-ver Mon May 6 18:05:06 2002
> + rm -f $(SHLIB_SOLINK) && \
> + $(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK)
No `&&' after `rm -f' unless you're sure the file is there; use `;'
instead, or the even safer `{ rm -f foo || : ; } &&'. Some stupid `rm
-f's return non-zero exit status even though they don't otherwise
complain when the file to be removed does not exist. Yeah, it was
already broken before, but...
> +++ gcc/config/t-slibgcc-sld Mon May 6 18:37:54 2002
> + rm -f $(SHLIB_SOLINK) && \
> + $(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK)
Ditto.
> + base_ml_dir=`echo ${suffix_pair} | sed -e 's/:.*$//'`
> + if [ "$dir" = "$base_ml_dir" ]; then
> + shlib_so_name=libgcc_s
> + break
> + else
> + canon_dir=`echo $dir | sed -n -e "s:$base_ml_dir/::p"`
This sed command is dangerous should base_ml_dir ever contain
sed-active regexp characters.
If you can tell for sure that base_ml_dir is going to be a prefix of
$dir, I recommend using instead:
base_ml_dir_dots=`echo "x${base_ml_dir}" | sed -e '1s/^x//' -e 's,.,.,g'`
canon_dir=`echo "x$dir" | sed -n -e '1 s/^x//' -e "s:^$base_ml_dir/::p"`
the `x' in front of the `echo' arguments is to prevent echo from
treating ${base_ml_dir}s or ${dir}s beginning with dashes as
command-line switches to echo (such as -n), instead of as the text to
be echoed. If you think this is nightmarish, welcome aboard :-)
Now... If you have reasons to believe that these issues won't ever be
a problem for this script, it's fine to not use them, as long as the
dangers are documented somewhere.
Mark, I couldn't spot any portability issues in this patch.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer