MSYS/MSYS2 and Cygwin are the same platform. Adjust code where they were
treated differently.
- drop separate `MSYS` from buildinfo flags. Our code is using the
`CYGWIN` variable and CMake (since v3.21) sets it also for `MSYS`.
- fix test1158 and test1186 to exclude them for all Win32 targets,
instead of just MSYS test envs. To align behavior between MSYS and
Cygwin envs. Required for recent MSYS2 releases which reports itself
as Cygwin, and no longer MSYS, which broke the previous exclusion
logic.
- follow Cygwin bumping its `MAX_PID` value, to avoid PID collisions.
https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=
363357c023ce01e936bdaedf0f479292a8fa4e0f
Reported-by: Jeremy Drake
Bug: https://github.com/curl/curl/pull/16217#issuecomment-
2672768233
Ref: https://www.msys2.org/news/#2025-02-14-moving-msys2-closer-to-cygwin
Closes #16411
if(CYGWIN)
string(APPEND _target_flags " CYGWIN")
endif()
-if(MSYS)
- string(APPEND _target_flags " MSYS")
-endif()
if(DOS)
string(APPEND _target_flags " DOS")
endif()
curl_pflags="${curl_pflags} CYGWIN"
fi
case $host_os in
- msys*) curl_pflags="${curl_pflags} MSYS";;
msdos*) curl_pflags="${curl_pflags} DOS";;
amiga*) curl_pflags="${curl_pflags} AMIGA";;
esac
<client>
<features>
Mime
+!win32
</features>
<server>
http
<command>
http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -F "file=@\"%LOGDIR/test%TESTNUMBER\\\".txt\";type=mo/foo;filename=\"test%TESTNUMBER\\\".txt\"" -F 'file2=@"%LOGDIR/test%TESTNUMBER\".txt"' -F 'file3=@"%LOGDIR/test%TESTNUMBER\".txt";type=m/f,"%LOGDIR/test%TESTNUMBER\".txt"'
</command>
-<precheck>
-%PERL -e "print 'Test requires a system supporting double quotes in file names' if ($^O eq 'msys');"
-</precheck>
# We create this file before the command is invoked!
<file name=%LOGDIR/test%TESTNUMBER".txt>
foo bar
<client>
<features>
Mime
+!win32
</features>
<server>
http
<command>
http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER --form-escape -F "file=@\"%LOGDIR/test%TESTNUMBER\\\".txt\";type=mo/foo;filename=\"test%TESTNUMBER\\\".txt\"" -F 'file2=@"%LOGDIR/test%TESTNUMBER\".txt"' -F 'file3=@"%LOGDIR/test%TESTNUMBER\".txt";type=m/f,"%LOGDIR/test%TESTNUMBER\".txt"'
</command>
-<precheck>
-%PERL -e "print 'Test requires a system supporting double quotes in file names' if ($^O eq 'msys');"
-</precheck>
# We create this file before the command is invoked!
<file name=%LOGDIR/test%TESTNUMBER".txt>
foo bar
pid = os.getpid()
# see tests/server/util.c function write_pidfile
if os.name == "nt":
- pid += 65536
+ pid += 4194304
with open(options.pidfile, "w") as f:
f.write(str(pid))
pid = os.getpid()
# see tests/server/util.c function write_pidfile
if os.name == "nt":
- pid += 65536
+ pid += 4194304
response_data = VERIFIED_RSP.format(pid=pid)
else:
log.debug("[DICT] Received normal request")
pid = os.getpid()
# see tests/server/util.c function write_pidfile
if os.name == "nt":
- pid += 65536
+ pid += 4194304
with open(options.pidfile, "w") as f:
f.write(str(pid))
pid = os.getpid()
# see tests/server/util.c function write_pidfile
if os.name == "nt":
- pid += 65536
+ pid += 4194304
response = VERIFIED_RSP.format(pid=pid)
response_data = response.encode('utf-8')
else:
#
sub winpid_to_pid {
my $vpid = $_[0];
- if(($^O eq 'cygwin' || $^O eq 'msys') && $vpid > 65536) {
- my $pid = Cygwin::winpid_to_pid($vpid - 65536);
+ if(($^O eq 'cygwin' || $^O eq 'msys') && $vpid > 4194304) {
+ my $pid = Cygwin::winpid_to_pid($vpid - 4194304);
if($pid) {
return $pid;
} else {
if($pid > 0) {
# verify if currently existing Windows process
$pid = winpid_to_pid($pid);
- if ($pid > 65536 && os_is_win()) {
- $pid -= 65536;
+ if ($pid > 4194304 && os_is_win()) {
+ $pid -= 4194304;
if($^O ne 'MSWin32') {
my $filter = "PID eq $pid";
# https://ss64.com/nt/tasklist.html
if($pid > 0) {
# request the process to quit
$pid = winpid_to_pid($pid);
- if ($pid > 65536 && os_is_win()) {
- $pid -= 65536;
+ if ($pid > 4194304 && os_is_win()) {
+ $pid -= 4194304;
if($^O ne 'MSWin32') {
# https://ss64.com/nt/taskkill.html
my $cmd = "taskkill -t -pid $pid >nul 2>&1";
if($pid > 0) {
# request the process to quit
$pid = winpid_to_pid($pid);
- if ($pid > 65536 && os_is_win()) {
- $pid -= 65536;
+ if ($pid > 4194304 && os_is_win()) {
+ $pid -= 4194304;
if($^O ne 'MSWin32') {
# https://ss64.com/nt/taskkill.html
my $cmd = "taskkill -f -t -pid $pid >nul 2>&1";
$pid = winpid_to_pid($pid);
# check if the process exists
- if ($pid > 65536 && os_is_win()) {
+ if ($pid > 4194304 && os_is_win()) {
if($flags == &WNOHANG) {
return pidexists($pid)?0:$pid;
}
pid = (curl_off_t)Curl_getpid();
#if defined(_WIN32)
- /* store pid + 65536 to avoid conflict with Cygwin/msys PIDs, see also:
- * - https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
- * h=b5e1003722cb14235c4f166be72c09acdffc62ea
- * - https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
- * h=448cf5aa4b429d5a9cebf92a0da4ab4b5b6d23fe
+ /* store pid + MAX_PID to avoid conflict with Cygwin/msys PIDs, see also:
+ * - 2019-01-31: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
+ * h=b5e1003722cb14235c4f166be72c09acdffc62ea
+ * - 2019-02-02: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
+ * h=448cf5aa4b429d5a9cebf92a0da4ab4b5b6d23fe
+ * - 2024-12-19: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
+ * h=363357c023ce01e936bdaedf0f479292a8fa4e0f
*/
- pid += 65536;
+ pid += 4194304;
#endif
return pid;
}
pid = os.getpid()
# see tests/server/util.c function write_pidfile
if os.name == "nt":
- pid += 65536
+ pid += 4194304
with open(options.pidfile, "w") as f:
f.write(str(pid))
pid = os.getpid()
# see tests/server/util.c function write_pidfile
if os.name == "nt":
- pid += 65536
+ pid += 4194304
contents = VERIFIED_RSP.format(pid=pid).encode('utf-8')
self.write_to_fid(fid, contents)