-
Notifications
You must be signed in to change notification settings - Fork 517
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
Windows: ZeroBrane built-in lua interpreters perform unavoidable command line file globbing #1166
Comments
@tmcdaniel-aspyr, thank you for the interesting report. You sent me on a wild goose chase to find what's happening here. I can confirm that this is definitely happening, but I can't figure out which of the components is responsible for it. First of all, I thought it was something that wxwidgets does, but this doesn't seem to be the case, as I can't find any relevant code in wxExecute that would do this. Then I found some old discussions about mingw being responsible, and indeed there is a long comment in _mingw.h describing the globbing logic: /* _dowildcard is an int that controls the globbing of the command line.
* The MinGW32 (mingw.org) runtime calls it _CRT_glob, so we are adding
* a compatibility definition here: you can use either of _CRT_glob or
* _dowildcard .
* If _dowildcard is non-zero, the command line will be globbed: *.*
* will be expanded to be all files in the startup directory.
* In the mingw-w64 library a _dowildcard variable is defined as being
* 0, therefore command line globbing is DISABLED by default. To turn it
* on and to leave wildcard command line processing MS's globbing code,
* include a line in one of your source modules defining _dowildcard and
* setting it to -1, like so:
* int _dowildcard = -1;
*/
#undef _CRT_glob
#define _CRT_glob _dowildcard Even with this description I don't see _dowildcard being set anywhere. I also checked a plain Lua interpreter and it does show the same behavior (outside of the IDE), so it doesn't seem to be IDE related. The IDE itself does not expand wildcards, but it does its own command line processing (build/win32_starter.c), so I still suspect it may be something to do with mingw processing, but can't find where. The only workaround I found so far is to do what you did: wrap your argument into single quotes and then remove the quotes before processing those parameters; you can probably apply it at the top of your script to all |
I think it's mingw; I found this in the source of libcrt:
If this works, it will require re-compilation of lua executables for all supported versions. I'll give it a try in a bit. |
@pkulchenko Thanks for investigating! |
@tmcdaniel-aspyr, thank you for the update; it definitely looks to be toolkit/configuration specific. BTW, you can replace the version that ships with the IDE and use your own (if you can compile it for x86 instead of x64). Or you can configure it to run as an external interpreter; see https://studio.zerobrane.com/doc-general-preferences#interpreter-path |
On Windows, the lua interpreters built into ZeroBrane perform command line file globbing. At least they do within the IDE debugger, setting the command line parameters through Project > Command Line Parameters. I haven't tried them outside the IDE. This is rather unusual behavior for a Windows executable. Further, I can't find a way to avoid the globbing. The typical method of quoting a command line arg doesn't work, the globbing still occurs. e.g.
D:\some\path\*
"D:\some\path\*"
""D:\some\path\*""
"""D:\some\path\*"""
The first 3 perform globbing, the 4th passes
"D:\some\path\*"
(with the quotes) into the script. There's no way to passD:\some\path\*
through to the script.The text was updated successfully, but these errors were encountered: