From a9d04f80c3d5ec32168b1389a5db79cc780b05ef Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 23 May 2020 08:37:53 +0100 Subject: binutils-config: fix native link removal by cross-compilers, bug #724454 commit 36eba05752348258a7 ("binutils-config: add build-time and runtime switches to disable native symlinks"). Added symlink deletion for USE_NATIVE_LINKS=no mode. It had a bug: it unconditionally deleted native symlinks if binutils-config is called on a cross-binutils installation. I missed the case because I assumed that tool names in binutils' private directory match gcc' private directory. The change is not to perform symlink cleanup for unprefixed binaries for cross-binutils. Reported-by: Ionen Wolkens Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich --- src/binutils-config | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/binutils-config b/src/binutils-config index cb7b905..da99021 100755 --- a/src/binutils-config +++ b/src/binutils-config @@ -143,17 +143,19 @@ switch_profile() { for x in * ; do atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}" atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${TARGET}-${x}" - if [[ ${TARGET} == ${HOST} && ${USE_NATIVE_LINKS} == yes ]] ; then - atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}" - else - # Remove native links if exist from previous - # installations or set by user manually. binutils-config - # owns these symlinks. - # - # TODO: cleanup symlinks not just known to this - # release/configuration of binutils, but also list - # all possible ones. - rm -f "${EROOT}/usr/bin/${x}" + if [[ ${TARGET} == ${HOST} ]] ; then + if [[ ${USE_NATIVE_LINKS} == yes ]]; then + atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}" + else + # Remove native links if exist from previous + # installations or set by user manually. binutils-config + # owns these symlinks. + # + # TODO: cleanup symlinks not just known to this + # release/configuration of binutils, but also list + # all possible ones. + rm -f "${EROOT}/usr/bin/${x}" + fi fi done -- cgit v1.2.3-65-gdbad