AreverSummer / luaforwindows

Automatically exported from code.google.com/p/luaforwindows
0 stars 0 forks source link

lua.exe parses arguments as though typed-in literal Lua strings #47

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Pass arguments to a Lua script with quotation marks, or anything that could 
be considered an escape character.
e.g.:
example.lua "C:\Projects\example\"

2. Lua will remove the opening quotation mark, and remove the trailing 
backslash. If you have it reconstruct its original arguments and print that, it 
will give:
C:\Projects\example"
(Note: I refer to "reconstructing its original arguments" by concatenating all 
of the positive-index arg[] entries and adding a space between them. This is 
because simply passing a normal quoted directory with spaces in it will be 
counted as 1 argument, but all examples given below will count as multiple 
arguments for any quoted directories with spaces)

3. Experiment with other characters...for example:
Passed:   \"C:\Projects\example\"
Received: "C:\Projects\example

Passed:   \"C:\Projects\example\\"
Received: "C:\Projects\example\

Passed:   [["C:\Projects\example\"]]
Received: [[C:\Projects\example"]]

What is the expected output? What do you see instead?
 Well I would *expect* that Lua wouldn't do some rather nonsensical parsing of its cmdline arguments and pass them to me exactly as I gave them...and if it *were* to remove any quotation marks that it would at least not also try to interpret nonsensical escape sequences.
 As it is, Lua is for some reason acting as though it's setting its arg[] entries by someone typing in arg[1]="C:\Projects\examples\" (and then I guess adding an additional double-quote at the end)

What version of the product are you using? On what operating system?
 I am using the LuaForWindows distribution 5.1.4-45 on Windows Vista 64-bit Ultimate.

Please provide any additional information below.
 I performed most of my testing in Batch files but I did ensure that the problems also exist when manually typing things in on the cmdline. I performed all testing on directories both with and without spaces. I only tested it on quoted-directories containing a single space, not two or more. I only ever tested it in passing a single argument to the Lua script. I called the Lua script directly and passed arguments directly to it, rather than calling Lua.exe

Original issue reported on code.google.com by mbritts...@hotmail.com on 17 Sep 2011 at 10:47