Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

cb_console_runner argument bug

(1/2) > >>

Code::Blocks_bug:
Hello,
I just uncovered a bug in the cb_console_runner program, which prevents certain arguments from being passed, even if the arguments are supported by your program.  :lol: Or more accurately, it allows the arguments to be passed, but it *ucks them up first and they never get passed to your (my) program correctly.  :shock:

Read more on this issue here, a thread which I started on the Ubuntu forums after originally thinking the issue was with xterm, but according to user "gmargo", it is a problem in cb_console_runner.

Jenna:
As far as I see, it's not as easy as gmargo writes.

execvp would work, but we do not get the return value of the running program, only the return value of execvp.
At least I did not find an easy way to get them.

As Workaround you can try to put single-quotes (here in red) around your doublequoted strings in the programs arguments:

--- Quote ---/home/gorilla/Documents/C_html4_elements.h '"[string;desc]"' '"[C_html_element;element]"'
--- End quote ---

Code::Blocks_bug:
Hmm...awesome. :D That worked.
Thanks.

Just to wrap this issue up, any plans to fix the bug?

Jenna:

--- Quote from: Code::Blocks_bug on February 23, 2011, 03:10:03 am ---Hmm...awesome. :D That worked.
Thanks.

Just to wrap this issue up, any plans to fix the bug?

--- End quote ---


--- Quote from: jens on February 22, 2011, 12:11:40 pm ---execvp would work, but we do not get the return value of the running program, only the return value of execvp.
At least I did not find an easy way to get them.

--- End quote ---

As said it's not as easy and it has not the highest preference at the moment, but I try to keep it in mind.
Patches are welcome of course.

pirx67:
Hi Jens,

I've read this thread and was interested in the internals of cb_console_runner. I've had a look at the source code and now I'd like to contribute some code.


--- Quote ---Patches are welcome of course.
--- End quote ---

Have a look at the attached file which is a rewritten version of ConsoleRunner/main.cpp. :)

My main goal was to avoid the call of system() to avoid that the command line will be evaluated by the system's standard shell a second time. To achieve this under Linux the exec*() functions family provides some means.

For *nix I give the <argv> array directly to execv() to avoid the need to fiddle around with quoting for the arguments again.

Therefore the code to glue together a new command line from the <argv> contents is now only present in the Windows branch of the code. The code still worked so far (tested under WinXP).

:idea: But I have an idea to get around this, too. (Not implemented nor tested so far). I would get the whole Windows command line with GetCommandLine() and then cut off the contents of argv[0] from the result (if needed including quotes). But the rest of the command line is then like it has been given to cb_console_runner and could be given to the CreateProcess() call as is. This avoids
to introduce any quoting issues through cb_console_runner.

Any comments are appreciated. Perhaps somebody of the more Windows aware developers may comment on my idea for the Windows branch?

pirx67

PS.: If PRINT_ARGS is defined then for debugging purposes the currently given arguments are
printed. This part of code should be removed for a release version.

Navigation

[0] Message Index

[#] Next page

Go to full version