Skip to content

tidy-up: align MSYS2/Cygwin codepaths, follow Cygwin MAX_PID bump - #16411

Closed
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:cygwin
Closed

vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:cygwin

Conversation

@vszakats

@vszakats vszakats commented Feb 20, 2025 •

Copy link
Copy Markdown
Member

MSYS/MSYS2 and Cygwin are the same platform. Adjust code where they were
treated differently.

Reported-by: Jeremy Drake
Bug: #16217 (comment)
Ref: https://www.msys2.org/news/#2025-02-14-moving-msys2-closer-to-cygwin


But, curl supports CMake older than 2021 (that seems like v3.21), and I wonder
if we should do something like this to not break MSYS support with older versions:

if(MSYS AND CMAKE_VERSION VERSION_LESS 3.21)
  set(CYGWIN 1)
endif()

https://cmake.org/cmake/help/latest/release/3.21.html

edit: I guess that's unnecessary, because CMake wouldn't recognize MSYS in those earlier versions anyway. It's also something that has been like this for a long time, without reported issues.

Comment thread acinclude.m4
curl_pflags="${curl_pflags} CYGWIN"
fi
case $host_os in
msys*) curl_pflags="${curl_pflags} MSYS";;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where exactly is host_os set? Don't we want to keep this for backward compatibility with older toolchains? Or, probably alter the line to say CYGWIN instead of MSYS.

@vszakats vszakats Feb 20, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autotools sets it automatically (via AC_CANONICAL_HOST) 1. This change only affects the displayed platform flags in buildinfo.txt; MSYS will no longer appear there (but that's only informational really). CYGWIN continues to appear if the host string contains either cygwin or msys (for backward compatibility):

curl/configure.ac

Lines 604 to 607 in d1fc1c4

curl_cv_cygwin='no'
case $host_os in
cygwin*|msys*) curl_cv_cygwin='yes';;
esac

Footnotes

  1. https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Canonicalizing.html ↩

@vszakats vszakats changed the title tidy-up: align MSYS2/CYGWIN use tidy-up: align MSYS2/CYGWIN use, bump for Cygwin MAX_PID Feb 20, 2025
@vszakats vszakats changed the title tidy-up: align MSYS2/CYGWIN use, bump for Cygwin MAX_PID tidy-up: align MSYS2/Cygwin codepaths, bump for Cygwin MAX_PID Feb 20, 2025
@vszakats vszakats changed the title tidy-up: align MSYS2/Cygwin codepaths, bump for Cygwin MAX_PID tidy-up: align MSYS2/Cygwin codepaths, follow Cygwin MAX_PID bump Feb 20, 2025
@testclutch

This comment was marked as outdated.

@jeremyd2019

Copy link
Copy Markdown
Contributor

Technically, both Cygwin and MSYS2 support double-quotes in filenames. Native Windows does not. (What Cygwin does behind the scenes is map characters that aren't allowed by Windows in filenames into the Unicode private use area: https://github.com/cygwin/cygwin/blob/main/winsup/cygwin/strfuncs.cc#L20. This is probably TMI)

@vszakats

Copy link
Copy Markdown
Member Author

Technically, both Cygwin and MSYS2 support double-quotes in filenames. Native Windows does not. (What Cygwin does behind the scenes is map characters that aren't allowed by Windows in filenames into the Unicode private use area: https://github.com/cygwin/cygwin/blob/main/winsup/cygwin/strfuncs.cc#L20. This is probably TMI)

Hm, according to the commit message, this was targeted for MSYS, where
it behaved (in 2018) differently from Cygwin:
41dabac #2796 #2854

Pushed a commit to let them run on MSYS and see if there is still
an issue today.

@jeremyd2019

Copy link
Copy Markdown
Contributor

That's because you are using MSYS to run native Windows binaries, and using the fact that it's MSYS to infer that. MSYS running MSYS binaries would work (and do: https://github.com/curl/curl/actions/runs/13447313327/job/37575384503?pr=16411)

@vszakats

Copy link
Copy Markdown
Member Author

That's because you are using MSYS to run native Windows binaries, and using the fact that it's MSYS to infer that. MSYS running MSYS binaries would work (and do: https://github.com/curl/curl/actions/runs/13447313327/job/37575384503?pr=16411)

Right! I'm updating the condition to exclude these tests for native Windows targets. That should be the same jobs as before this patch.

I'm guessing we can revisit this once MSYS2 is also doing the Unicode mapping as Cygwin does?

/cc @MarcelRaad

@jeremyd2019

Copy link
Copy Markdown
Contributor

MSYS2 already does. I think your change is the correct one, as long as cygwin or msys does not imply win32 (most build systems do not)

@vszakats vszakats closed this in 4842f22 Feb 21, 2025
@vszakats
vszakats deleted the cygwin branch February 21, 2025 10:59
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
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: curl#16217 (comment)
Ref: https://www.msys2.org/news/#2025-02-14-moving-msys2-closer-to-cygwin
Closes curl#16411
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants