Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Incorrect ARGV1 when using linux-style paths

Apr
42
0
Running version 16.03.55. I have the the option "UNIX/Linux-style paths" turned on. The problem is: when I call a batch script using forward slashes, ARGV1 is setup incorrectly. This happens even in a directory with no spaces.

>projects/test/printargs.bat applepie
ARGV0: projects/test/printargs.bat
ARGV1: /test/printargs.bat
ARGV2: applepie


Is this a bug?

Normally, a workaround would be to put the script path in quotes, but in my case, the command is being constructed and executed by a third-party utility.

Thanks,
Mel
 
Not exactly a bug; more of a "nobody ever requested it" issue.

The UnixPaths directive was intended for external commands, not internals like batch files. So in the absence of a quoted argument, TCC is breaking the argument on the switch character.

I will add a check for this in the next version of TCC. However, I'm puzzled by your comment that "the command is being constructed and executed by a third-party utility" -- since CMD chokes on that command line (and can't even find the batch file, much less pass any arguments), what was the third-party utility trying to do? (And what was it trying to do it with?)
 
Thanks, Rex.

The utility I was referring to is CMake, or more accurately, CTest. I have a batch file that is a test driver for several hundred tests. CTest calls the batch file using the name of the executable to be run as the first argument. Even when I give CTest the full path to the test driver using windows-slashes, it converts the command to linux-slashes. I'm still researching, but I'm certain this is a bug and not a misconfiguration on my part. And, yes, it fails completely when run in CMD.EXE. When I have a bit more time, I'll research it further and report the bug to CMake. (Part of the issue, I'm sure, is that I need to use the Nightly builds of CMake due to bug fixes/enhancements that were made since their latest stable release. Very likely, some improvement broke it temporarily.)

Using TCMD has been the only way I've been able to get CTest to run these tests. I've worked around the problem of the batch file's ARGV1 by comparing ARG1 to ARG0 and shifting:

if "%0" = "C:%1" shift

Thanks for a wonderful product.
Mel
 
Last edited:

Similar threads

Back
Top