Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test 1299 fails on MinGW-w64 #1751

Closed
MarcelRaad opened this issue Aug 9, 2017 · 9 comments
Closed

Test 1299 fails on MinGW-w64 #1751

MarcelRaad opened this issue Aug 9, 2017 · 9 comments

Comments

@MarcelRaad
Copy link
Member

The test was added with b778ae4.
Also visible in the autobuilds:

--- log/check-expected  2017-08-09 16:18:42.205790900 +0200
+++ log/check-generated 2017-08-09 16:18:42.203773900 +0200
@@ -1,4 +1,4 @@
-OPTIONS * HTTP/1.1[CR][LF]
+OPTIONS .http_ipv6_server.pid HTTP/1.1[CR][LF]

curl/libcurl version

curl 7.54.0 (x86_64-pc-msys) libcurl/7.54.0 OpenSSL/1.0.2k zlib/1.2.11 libssh2/1.7.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: Debug IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy Metalink

operating system

MinGW-w64 on Windows 10

@bagder
Copy link
Member

bagder commented Aug 9, 2017

Curious, it expands the asterisk? Does it work single quotes instead?

@MarcelRaad
Copy link
Member Author

MarcelRaad commented Aug 9, 2017

Changing "*" to '*' does work when running curl from the native Windows shell, but not when running it from the MSYS2 shell, which is required to run the tests. Haven't found out how to make it work yet :-(

@bagder
Copy link
Member

bagder commented Aug 9, 2017

I consider that a bug in the msys2 shell, as that's not how shells typically work. Not that it helps much...

@bagder
Copy link
Member

bagder commented Aug 10, 2017

GodEater just commented this on IRC:

I can't reproduce that expansion of "*" on the command line.
I've just run "make test" on my copy of the curl code checked out just after you mentioned it this morning, and it passed under Msys2.

@MarcelRaad
Copy link
Member Author

That's strange. All MinGW autobuilds also show this problem.

It seems to be not a problem of the shell only, but also of the C runtime used.
Windows shell, compiled with MSVC, double quotes: works
Windows shell, compiled with MSVC, single quotes: works
Windows shell, compiled with MinGW, double quotes: doesn't work
Windows shell, compiled with MinGW, single quotes: works
MSYS shell, compiled with MSVC, double quotes: works
MSYS shell, compiled with MSVC, single quotes: works
MSYS shell, compiled with MinGW, single quotes: doesn't work
MSYS shell, compiled with MinGW, double quotes: doesn't work

Using single quotes AND adding int _CRT_glob = 0; to tool_main.c always works with all compilers and shells. (Source: https://sourceforge.net/p/mingw/mingw-org-wsl/ci/5.0-active/tree/mingwrt/CRTglob.c)

@bagder
Copy link
Member

bagder commented Aug 15, 2017

Using single quotes AND adding int _CRT_glob = 0; to tool_main.c always works

So is that the proper solution you think?

@MarcelRaad
Copy link
Member Author

Using single quotes definitely, as that fixes at least the non-MSYS case without breaking other stuff.

I'm not 100% sure about changing the globbing behavior as there might be users of the curl tool who rely on it?

Also, according to the mingw-w64 source on SourceForge, globbing should be off by default for MinGW-w64 (unlike original MinGW). So I wanted to find out why it's on for my MinGW-w64 curl build, but wasn't successful yet.

@jay
Copy link
Member

jay commented Aug 21, 2017

I can't think of any use case for mingw's type of globbing in curl arguments.

@MarcelRaad
Copy link
Member Author

Yes, it's really very broken. The MSYS2 shell does its globbing and then MinGW's CRT does globbing again because the shell removes the quotes. With original MinGW from mingw.org, globbing can be controlled by additional options: __CRT_GLOB_USE_MINGW__ (default, can be combined with __CRT_GLOB_USE_SINGLE_QUOTE__) and __CRT_GLOB_USE_MSVCRT__, but neither of the three combinations doesn't break the MSYS shell. So I think it would be best to turn command-line argument globbing completely off for MinGW as well as MinGW-w64 as there's no way to get a single * without quotes into an argument otherwise.

MarcelRaad added a commit to MarcelRaad/curl that referenced this issue Aug 21, 2017
By default, the MinGW CRT globs command-line arguments. This prevents
getting a single asterisk into an argument as test 1299 does. Turn off
globbing by setting the global variable _CRT_glob to 0 for MinGW.

Fixes curl#1751
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants