On Nov 28, 2007 11:42 AM, Zoran Vasiljevic
<[EMAIL PROTECTED]> wrote:
> Update of /cvsroot/naviserver/naviserver/nsd
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23874/nsd
>
> Modified Files:
> tclconf.c
> Log Message:
> * nsd/tclconf.c: Fixed NsTclConfigObjCmd() to correctly set the
> returned value of an default boolean param to 0/1 and not just
> blindly parrot what user has given (true/false for example) as
> this could (and it does!) break Tcl expressions.
>
>
>
> Index: tclconf.c
> ===================================================================
> RCS file: /cvsroot/naviserver/naviserver/nsd/tclconf.c,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -C2 -d -r1.5 -r1.6
> *** tclconf.c 21 Oct 2007 16:20:24 -0000 1.5
> --- tclconf.c 28 Nov 2007 11:42:38 -0000 1.6
> ***************
> *** 130,140 ****
>
> if (defObj != NULL) {
> ! if ((isbool && Tcl_GetBooleanFromObj(interp, defObj, &i) != TCL_OK)
> ! || (isint && Tcl_GetWideIntFromObj(interp, defObj, &v) !=
> TCL_OK)) {
> ! return TCL_ERROR;
> ! }
> ! if (isint && (v < min || v > max)) {
> ! Tcl_SetResult(interp, "value out of range", TCL_STATIC);
> ! return TCL_ERROR;
> }
> Tcl_SetObjResult(interp, defObj);
> --- 130,143 ----
>
> if (defObj != NULL) {
> ! if (isbool) {
> ! if (Tcl_GetBooleanFromObj(interp, defObj, &i) != TCL_OK) {
> ! return TCL_ERROR;
> ! }
> ! defObj = Tcl_NewIntObj(i);
> ! } else if (isint) {
> ! if (v < min || v > max) {
> ! Tcl_SetResult(interp, "value out of range", TCL_STATIC);
> ! return TCL_ERROR;
> ! }
> }
> Tcl_SetObjResult(interp, defObj);
Pre-change:
% expr !1
0
% expr !0
1
% expr !true
0
% expr !yes
0
% expr !y
0
% expr !yup
syntax error in expression "!yup": variable references require preceding $
% expr ![ns_config -bool a/b c yup]
expected boolean value but got "yup"
Post-change:
$ make test TCLTESTARGS="-file ns_config.test"
Only running test files that match: ns_config.test
Tests began at Wed Nov 28 06:18:18 PM GMT 2007
ns_config.test
==== ns_config-3.4 not an int FAILED
==== Contents of test case:
ns_config -int ns/testconfig missing huh?
---- Test completed normally; Return code was: 0
---- Return code should have been one of: 1
==== ns_config-3.4 FAILED
==== ns_config-4.6 int min def FAILED
==== Contents of test case:
ns_config -min 43 ns/testconfig intval 43
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: value out of range
while executing
"ns_config -min 43 ns/testconfig intval 43"
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: NONE
==== ns_config-4.6 FAILED
==== ns_config-4.7 int max def FAILED
==== Contents of test case:
ns_config -max 41 ns/testconfig intval 41
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: value out of range
while executing
"ns_config -max 41 ns/testconfig intval 41"
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: NONE
==== ns_config-4.7 FAILED
Tests ended at Wed Nov 28 06:18:18 PM GMT 2007
all.tcl: Total 31 Passed 28 Skipped 0 Failed 3
Sourced 1 Test Files.
Files with failing tests: ns_config.test
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
naviserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/naviserver-devel