]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
ltmain.in: Fix hang with cmd.exe in MSYS
authorIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Wed, 19 Feb 2025 16:58:16 +0000 (18:58 +0200)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Mon, 26 May 2025 14:18:51 +0000 (17:18 +0300)
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

index d792be2baf04276f3d6b966a341e02cbfed7cd2b..bc1457edf97c6d2eda9ac152c0106fcba79e1c19 100644 (file)
@@ -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 : : \