Subject: bug#73620: libtool-2.5.3 broken on CentOS and Alma Linux

From: Ileana Dumitrescu <[email-masked]>
Date: Wed, 9 Oct 2024 19:01:32 +0300

On 09/10/2024 17:32, Sam James wrote:
> Bruno Haible <[email-masked]> writes:
> 
>> Hi,
>>
>> I wrote:
>>> This week, I upgraded to libtool-2.5.3, and what I see is that most
>>> unit tests fail on CentOS 7 and Alma Linux 9, i.e. both RHEL compatible
>>> distros.
>>
>> When I revert the ltmain.in change from commit
>> 0e1b33332429cd578367bd0ad420c065d5caf0ac,
>> things work again.
>>
> 
> CCing Sergey.
> 
>> Bruno
> 

I have been looking into this, but I am sure Sergey will be faster than
me at diagnosing and solving the issue.

The relink command is most likely not working due to omissions of
appending absdir to compile_rpath:

BEFORE commit:
"""
       case "$compile_rpath " in
       *" $absdir "*) ;;
       *) func_append compile_rpath " $absdir" ;;
       esac

"""
AFTER commit:
"""
       case "$compile_rpath " in
       *" $absdir "*) ;;
       *) case $absdir in
          "$progdir/"*) func_append compile_rpath " $absdir" ;;
	 esac
       esac
"""

The relink command seems to be set by fast_install=yes:

"""
       case $hardcode_action,$fast_install in
         relink,*)
	  # Fast installation is not supported
	  link_command=$compile_var$compile_command$compile_rpath
	  relink_command=$finalize_var$finalize_command$finalize_rpath

	  func_warning "this platform does not like uninstalled shared libraries"
	  func_warning "'$output' will be relinked during installation"
	  ;;
         *,yes)
	  link_command=$finalize_var$compile_command$finalize_rpath
	  relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | 
$SED 's%@OUTPUT@%\$progdir/\$file%g'`
           ;;
	*,no)
	  link_command=$compile_var$compile_command$compile_rpath
	  relink_command=$finalize_var$finalize_command$finalize_rpath
           ;;
	*,needless)
	  link_command=$finalize_var$compile_command$finalize_rpath
	  relink_command=
           ;;
       esac
"""

The relevant code generating part of the xgettext wrapper script for 
Alma Linux 9:

"""
if test yes = "$fast_install"; then
	  $ECHO "\
   program=lt-'$outputname'$exeext
   progdir=\"\$thisdir/$objdir\"

   if test ! -f \"\$progdir/\$program\" ||
      { file=\`ls -1dt \"\$progdir/\$program\" 
\"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
        test \"X\$file\" != \"X\$progdir/\$program\"; }; then

     file=\"\$\$-\$program\"

     if test ! -d \"\$progdir\"; then
       $MKDIR \"\$progdir\"
     else
       $RM \"\$progdir/\$file\"
     fi"

	  $ECHO "\

     # relink executable if necessary
     if test -n \"\$relink_command\"; then
       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
       else
	\$ECHO \"\$relink_command_output\" >&2
	$RM \"\$progdir/\$file\"
	exit 1
       fi
     fi

     $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
     { $RM \"\$progdir/\$program\";
       $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
     $RM \"\$progdir/\$file\"
   fi"
	else
	  $ECHO "\
   program='$outputname'
   progdir=\"\$thisdir/$objdir\"
"
	fi
"""

I may be wrong, but this is what I think is happening. I would be happy 
to have other opinions though.

-- 
Ileana Dumitrescu

GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354