Tcl Source Code

View Ticket
Login
Ticket UUID: 2141271
Title: Tcl_ParseCommand doesn't set errorInfo for a wrong command
Type: Bug Version: obsolete: 8.4.19
Submitter: yurivict Created on: 2008-10-01 22:43:45
Subsystem: 45. Parsing and Eval Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2008-10-02 23:55:48
Resolution: Invalid Closed By: dgp
    Closed on: 2008-10-02 16:55:48
Description:
Please compile and run an attached .c file.

When run it prints an empty errorInfo obtained after a particular wrong command.

errorInfo should *always* be set if Tcl_ParseCommand returns and error.
User Comments: yurivict added on 2008-10-02 23:47:28:
This is quite confusing that there are so many error message variables.

yurivict added on 2008-10-02 23:35:45:
I see this problem in both tcl-8.4.19 and tcl-8.5.4 with a minor difference.
In tcl-8.4.19 errorInfo is returned as an empty string and in tcl-8.5.4 -- as a null string.

dgp added on 2008-10-02 23:31:33:
Use 

const char *msg = Tcl_GetStringResult(interp);

to fix your code.

If you also want ::errorInfo set, you can
achieve that by adding

Tcl_AddErrorInfo(interp,"")

in the branch that handles the TCL_ERROR
return values.

dgp added on 2008-10-02 23:29:59:
See the docs for Tcl_ParseCommand:

"If an error  occurred  in  parsing the
command then TCL_ERROR is returned, an
error message is left in interp’s result,
and no information is left at *parsePtr."

You will find the error message in the
interp result, not in the ::errorInfo
variable.

dgp added on 2008-10-02 22:57:19:
Please report the version of Tcl
in which you see the problem.

yurivict added on 2008-10-02 05:43:45:

File Added - 295702: parse-error.c

Attachments: