-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
winpty, winpty-git: Fix path conversion and build problem.
The program arguments should now be properly converted from unix to Windows format, like done for non-MSYS programs. An indirect dependency is now referenced by makedepends for avoiding build problems when using its default provider.
- Loading branch information
1 parent
37d9ff8
commit f6440fb
Showing
4 changed files
with
189 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff -aurN 0001/src/unix-adapter/main.cc 0002/src/unix-adapter/main.cc | ||
--- 0001/src/unix-adapter/main.cc | ||
+++ 0002/src/unix-adapter/main.cc | ||
@@ -47,6 +47,7 @@ | ||
#include "OutputHandler.h" | ||
#include "Util.h" | ||
#include "WakeupFd.h" | ||
+#include "path_conv.h" | ||
|
||
#define CSI "\x1b[" | ||
|
||
@@ -154,7 +155,12 @@ | ||
char *tmp; | ||
#if defined(CYGWIN_VERSION_CYGWIN_CONV) && \ | ||
CYGWIN_VERSION_API_MINOR >= CYGWIN_VERSION_CYGWIN_CONV | ||
- // MSYS2 and versions of Cygwin released after 2009 or so use this API. | ||
+#if defined(__MSYS__) | ||
+ size_t newSize = 256 * MAX_PATH; | ||
+ tmp = new char[newSize + 1]; | ||
+ convert(tmp, newSize, path.c_str()); | ||
+#else | ||
+ // Versions of Cygwin released after 2009 or so use this API. | ||
// The original MSYS still lacks this API. | ||
ssize_t newSize = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_RELATIVE, | ||
path.c_str(), NULL, 0); | ||
@@ -163,6 +169,7 @@ | ||
ssize_t success = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_RELATIVE, | ||
path.c_str(), tmp, newSize + 1); | ||
assert(success == 0); | ||
+#endif | ||
#else | ||
// In the current Cygwin header file, this API is documented as deprecated | ||
// because it's restricted to paths of MAX_PATH length. In the CVS version | ||
@@ -173,10 +180,6 @@ | ||
tmp = new char[MAX_PATH + path.size()]; | ||
cygwin_conv_to_win32_path(path.c_str(), tmp); | ||
#endif | ||
- for (int i = 0; tmp[i] != '\0'; ++i) { | ||
- if (tmp[i] == '/') | ||
- tmp[i] = '\\'; | ||
- } | ||
std::string ret(tmp); | ||
delete [] tmp; | ||
return ret; | ||
diff -aurN 0001/src/unix-adapter/path_conv.cc 0002/src/unix-adapter/path_conv.cc | ||
--- 0001/src/unix-adapter/path_conv.cc | ||
+++ 0002/src/unix-adapter/path_conv.cc | ||
@@ -633,7 +633,6 @@ | ||
one_path[to-from] = '\0'; | ||
char win32_path1[PATH_MAX + 1]; | ||
ssize_t result = cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_ABSOLUTE, one_path, win32_path1, PATH_MAX+1); | ||
- printf("called cygwin_conv_path(CCP_POSIX_TO_WIN_A,%s -> %s, in-size %d, result = %zd\n", one_path, win32_path1, PATH_MAX+1, result); | ||
if( result !=0 ) { | ||
copy_to_dst(one_path, NULL, dst, dstend); | ||
} else { | ||
diff -aurN 0001/src/unix-adapter/subdir.mk 0002/src/unix-adapter/subdir.mk | ||
--- 0001/src/unix-adapter/subdir.mk | ||
+++ 0002/src/unix-adapter/subdir.mk | ||
@@ -28,6 +28,7 @@ | ||
build/unix-adapter/unix-adapter/Util.o \ | ||
build/unix-adapter/unix-adapter/WakeupFd.o \ | ||
build/unix-adapter/unix-adapter/main.o \ | ||
+ build/unix-adapter/unix-adapter/path_conv.o \ | ||
build/unix-adapter/shared/DebugClient.o \ | ||
build/unix-adapter/shared/WinptyAssert.o \ | ||
build/unix-adapter/shared/WinptyVersion.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff -aurN 0001/src/unix-adapter/main.cc 0002/src/unix-adapter/main.cc | ||
--- 0001/src/unix-adapter/main.cc | ||
+++ 0002/src/unix-adapter/main.cc | ||
@@ -47,6 +47,7 @@ | ||
#include "OutputHandler.h" | ||
#include "Util.h" | ||
#include "WakeupFd.h" | ||
+#include "path_conv.h" | ||
|
||
#define CSI "\x1b[" | ||
|
||
@@ -154,7 +155,12 @@ | ||
char *tmp; | ||
#if defined(CYGWIN_VERSION_CYGWIN_CONV) && \ | ||
CYGWIN_VERSION_API_MINOR >= CYGWIN_VERSION_CYGWIN_CONV | ||
- // MSYS2 and versions of Cygwin released after 2009 or so use this API. | ||
+#if defined(__MSYS__) | ||
+ size_t newSize = 256 * MAX_PATH; | ||
+ tmp = new char[newSize + 1]; | ||
+ convert(tmp, newSize, path.c_str()); | ||
+#else | ||
+ // Versions of Cygwin released after 2009 or so use this API. | ||
// The original MSYS still lacks this API. | ||
ssize_t newSize = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_RELATIVE, | ||
path.c_str(), NULL, 0); | ||
@@ -163,6 +169,7 @@ | ||
ssize_t success = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_RELATIVE, | ||
path.c_str(), tmp, newSize + 1); | ||
assert(success == 0); | ||
+#endif | ||
#else | ||
// In the current Cygwin header file, this API is documented as deprecated | ||
// because it's restricted to paths of MAX_PATH length. In the CVS version | ||
@@ -173,10 +180,6 @@ | ||
tmp = new char[MAX_PATH + path.size()]; | ||
cygwin_conv_to_win32_path(path.c_str(), tmp); | ||
#endif | ||
- for (int i = 0; tmp[i] != '\0'; ++i) { | ||
- if (tmp[i] == '/') | ||
- tmp[i] = '\\'; | ||
- } | ||
std::string ret(tmp); | ||
delete [] tmp; | ||
return ret; | ||
diff -aurN 0001/src/unix-adapter/path_conv.cc 0002/src/unix-adapter/path_conv.cc | ||
--- 0001/src/unix-adapter/path_conv.cc | ||
+++ 0002/src/unix-adapter/path_conv.cc | ||
@@ -633,7 +633,6 @@ | ||
one_path[to-from] = '\0'; | ||
char win32_path1[PATH_MAX + 1]; | ||
ssize_t result = cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_ABSOLUTE, one_path, win32_path1, PATH_MAX+1); | ||
- printf("called cygwin_conv_path(CCP_POSIX_TO_WIN_A,%s -> %s, in-size %d, result = %zd\n", one_path, win32_path1, PATH_MAX+1, result); | ||
if( result !=0 ) { | ||
copy_to_dst(one_path, NULL, dst, dstend); | ||
} else { | ||
diff -aurN 0001/src/unix-adapter/subdir.mk 0002/src/unix-adapter/subdir.mk | ||
--- 0001/src/unix-adapter/subdir.mk | ||
+++ 0002/src/unix-adapter/subdir.mk | ||
@@ -26,6 +26,7 @@ | ||
build/unix/unix-adapter/Util.o \ | ||
build/unix/unix-adapter/WakeupFd.o \ | ||
build/unix/unix-adapter/main.o \ | ||
+ build/unix/unix-adapter/path_conv.o \ | ||
build/unix/shared/DebugClient.o \ | ||
build/unix/shared/WinptyVersion.o | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters