commit:     a9d04f80c3d5ec32168b1389a5db79cc780b05ef
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat May 23 07:37:53 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat May 23 07:37:53 2020 +0000
URL:        
https://gitweb.gentoo.org/proj/binutils-config.git/commit/?id=a9d04f80

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 <slyfox <AT> gentoo.org>

 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
 

Reply via email to