branch: development
commit 1377b68b4aed0d6ee3c390131eb763d26e5b642d
Author: Ileana Dumitrescu <ileanadumitresc...@gmail.com>
AuthorDate: Wed Feb 19 18:58:16 2025 +0200

    ltmain.in: Fix hang with cmd.exe in MSYS
    
    Translating file paths from MSYS to W32 has been causing libtool to
    indefinitely hang when 'cmd.exe //c' is called. Instead, 'cygpath' is
    packaged on MSYS, so it will now handle the path conversion.
    
    * build-aux/ltmain.in: Replace 'cmd.exe //c' with 'cygpath' usage.
---
 build-aux/ltmain.in | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index d792be2b..bc1457ed 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -1029,9 +1029,14 @@ func_convert_core_msys_to_w32 ()
 {
   $debug_cmd
 
-  # awkward: cmd appends spaces to result
-  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
-    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
+  # Since MSYS is packaged with cygpath, call cygpath in $PATH; no need
+  # to use LT_CYGPATH in this case.
+  func_convert_core_msys_to_w32_result=`cygpath "$@" 2>/dev/null |
+       $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
+  if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_convert_core_msys_to_w32_result=
+  fi
 }
 #end: func_convert_core_msys_to_w32
 
@@ -1170,7 +1175,7 @@ func_convert_file_msys_to_w32 ()
 
   func_to_host_file_result=$1
   if test -n "$1"; then
-    func_convert_core_msys_to_w32 "$1"
+    func_convert_core_msys_to_w32 -w "$1"
     func_to_host_file_result=$func_convert_core_msys_to_w32_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
@@ -1222,7 +1227,7 @@ func_convert_file_msys_to_cygwin ()
 
   func_to_host_file_result=$1
   if test -n "$1"; then
-    func_convert_core_msys_to_w32 "$1"
+    func_convert_core_msys_to_w32 -w "$1"
     func_cygpath -u "$func_convert_core_msys_to_w32_result"
     func_to_host_file_result=$func_cygpath_result
   fi
@@ -1324,7 +1329,7 @@ func_convert_path_msys_to_w32 ()
     # and winepath ignores them completely.
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_convert_core_msys_to_w32 -w -p "$func_to_host_path_tmp1"
     func_to_host_path_result=$func_convert_core_msys_to_w32_result
     func_convert_path_check : ";" \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
@@ -1389,7 +1394,7 @@ func_convert_path_msys_to_cygwin ()
     # See func_convert_path_msys_to_w32:
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_convert_core_msys_to_w32 -w -p "$func_to_host_path_tmp1"
     func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
     func_to_host_path_result=$func_cygpath_result
     func_convert_path_check : : \

Reply via email to