You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
emcc doesn't work with filenames/paths with ! sign #14063
Trying to compile simple source file located in directory named "a!":
emcc.bat a!\a.cpp
emcc: error: a\a.cpp: No such file or directory ("a\a.cpp" was expected to be an input file, based on the commandline arguments provided)
Same with "!" in filename:
emcc.bat !!!a.cpp
emcc: error: a.cpp: No such file or directory ("a.cpp" was expected to be an input file, based on the commandline arguments provided)
Yes, we are using windows.
Notepad opens files with such names without problems (I mean a!.cpp for example)
If trying to escape chars, emcc shows the following result: emcc.bat a!.cpp
emcc: error: a.cpp: No such file or directory ("a.cpp" was expected to be an input file, based on the commandline arguments provided)
Following variants, that also used in windows, also doesn't work: emcc.bat "a!.cpp"
emcc: error: a.cpp: No such file or directory ("a.cpp" was expected to be an input file, based on the commandline arguments provided)
emcc.bat "a!.cpp"
emcc: error: a.cpp: No such file or directory ("a.cpp" was expected to be an input file, based on the commandline arguments provided)
But I mean does notepad open from the command promt you are in ? What escape method do you use when opening from the command line using notepad.exe a!.cpp?
This seems to be related to out .bat files that launch python. If I run emcc via python emcc.py it works but if I run it via emcc.bat it fails:
Works:
$ python emcc.py a!.cpp -c
Fails:
$ emcc a!.cpp -c
emcc a!.cpp -c
emcc: error: a.cpp: No such file or directory ("a.cpp" was expected to be an input file, based on the commandline arguments provided)
"
If DelayedExpansion is used in conjunction with a FOR command looping through a set of files, if any file in the set has an exclamation mark '!' in the filename, that will be interpreted like a !variable!.
Although this is not a common character used in filenames, it can cause scripts to fail. This happens because the parameter expansion (%%P) happens just before the delayed expansion phase tries to interpret my!filen!ame.txt
"
Activity
sbc100 commentedon May 2, 2021
Given the correct quoting this seems to work for. At least on linux:
It looks like maybe you are on windows.. maybe you need to escape the exclamation mark some how there too?
Maybe try to open the file using notepad.exe from the command line.. so you know you have the escaping right.
fgsgn-las commentedon May 3, 2021
Yes, we are using windows.
Notepad opens files with such names without problems (I mean a!.cpp for example)
If trying to escape chars, emcc shows the following result:
emcc.bat a!.cpp
emcc: error: a.cpp: No such file or directory ("a.cpp" was expected to be an input file, based on the commandline arguments provided)
Following variants, that also used in windows, also doesn't work:
emcc.bat "a!.cpp"
emcc: error: a.cpp: No such file or directory ("a.cpp" was expected to be an input file, based on the commandline arguments provided)
emcc.bat "a!.cpp"
emcc: error: a.cpp: No such file or directory ("a.cpp" was expected to be an input file, based on the commandline arguments provided)
sbc100 commentedon May 3, 2021
But I mean does notepad open from the command promt you are in ? What escape method do you use when opening from the command line using
notepad.exe a!.cpp?fgsgn-las commentedon May 5, 2021
Notepad open even following:
No escape needed.
I suppose emcc using their own filename handling.
sbc100 commentedon May 5, 2021
emcc is using python's standard file handling.
Can you trying running a trivial program like this?:
$ python -c "import sys; print(sys.argv[1]); print(open(sys.argv[1]))" a!.cppWhen I next get a chance use windows machine I can take a look myself.
fgsgn-las commentedon May 6, 2021
Looks strange, because it works:
> python -c "import sys; print(sys.argv[1]); print(open(sys.argv[1]))" a!.cpp
a!.cpp
<_io.TextIOWrapper name='a!.cpp' mode='r' encoding='cp1251'>
sbc100 commentedon May 12, 2021
This seems to be related to out
.batfiles that launch python. If I run emcc viapython emcc.pyit works but if I run it viaemcc.batit fails:Works:
Fails:
sbc100 commentedon May 12, 2021
It looks like #13723 is to blame.
emcc a!.cpp -cworks before that change an fails afterwards. @aheejin any ideas? This looks pretty nasty.sbc100 commentedon May 12, 2021
Looks like this is known issue with EnableDelayedExpansion:
From https://ss64.com/nt/delayedexpansion.html:
"
If DelayedExpansion is used in conjunction with a FOR command looping through a set of files, if any file in the set has an exclamation mark '!' in the filename, that will be interpreted like a !variable!.
Although this is not a common character used in filenames, it can cause scripts to fail. This happens because the parameter expansion (%%P) happens just before the delayed expansion phase tries to interpret my!filen!ame.txt
"
sbc100 commentedon May 12, 2021
Makes me want to look into maybe seeing if we can just assume powershell and run that from the .bat file.
Fix .bat launcher to allow special characters
Fix .bat launcher to allow special characters
Fix .bat launcher to allow special characters
Fix .bat launcher to allow special characters
Fix .bat launcher to allow special characters
Fix .bat launcher to allow special characters
Fix .bat launcher to allow special characters
Fix .bat launcher to allow special characters (#14260)