Forum OpenACS Development: Re: Towards OpenACS 5.8

Collapse
5: Re: Towards OpenACS 5.8 (response to 1)
Posted by Jeff Rogers on
I just upgraded one of my installations to HEAD, and I ran into a problem.

acs-templating/tcl/parse-procs.tcl r1.48 changed @variable@ expansion from using ad_quotehtml to ns_quotehtml, which is a very reasonable change.

However, AOLserver has a bug (that I just discovered) in ns_quotehtml that mishandles "", which results in [ns_quotehtml ""] ne ""; so a construct like

<if @error_msg@ eq "">
display error
</if>

will be handled incorrectly.    Naviserver's implementation of ns_quotehtml doesn't have this bug.

For a 5.8 release, AOLserver users should be advised to migrate to naviserver (especially in light of your very attractive recent performance numbers), or to a new, as-yet-unreleased aolserver 4.5.3 , or patch acs-templating if they are affected by this problem.

-J

Collapse
6: Re: Towards OpenACS 5.8 (response to 5)
Posted by Gustaf Neumann on
jeff, thanks a lot. Interesting the bug does not happen with some older versions of aolserver, that i tested with. The bug in the newer aolserver is not easy to spot, since
  set x a[ns_quotehtml ""]b
returns something that looks like "ab". This is now fixed in the oacs-5-8 branch. As always, the fixes of the oacs-5-8 branch will be moved to HEAD after the release.
Collapse
7: Re: Towards OpenACS 5.8 (response to 6)
Posted by Jim Lynch on
running some tests in openacs shell...

ns_quotehtml <foo> --> &lt;foo&gt;

set foo "" --> (looks like nothing)

ns_quotehtml "" --> (looks like nothing)

list [ns_quotehtml ""] --> (looks like nothing)

set foo "|[list [ns_quotehtml ""]]|" --> ||

(hmm, let's give it another item)

set foo "|[list [ns_quotehtml ""] anotheritem]|" --> | anotheritem|

(hmm, that's interesting... why not |"" anotheritem|?)

Collapse
8: Re: Towards OpenACS 5.8 (response to 7)
Posted by Gustaf Neumann on
Jim, the tcl "list" command does not quote the result of the broken ns_quotehtml, because it thinks, it does not have to. The result is somewhat weird: in the shell, one can see by the empty line that tcl the value of x is not the empty string. The length of the resulting string is 1, but even Tcl's "scan" refuses to return something from that value.
% set x [ns_quotehtml ""]

% string length $x
1
% scan $x %c 
% set y \u0000; # same with "set y [format %c 0]"

% scan $y %c
0
% expr {$x eq $y}
0
$x is an "invalid character", which looks like only producible from C.

The fix in oacs-5-8 simply checks for the broken ns_quotehtml and uses in that case the slower version. For older versions of the aolserver (e.g. my test installation on alice.wu.ac.at:8000 with aolserver 4.5.0p1) or the latest (with the fix of jeff) OpenACS 5.8 will use the faster C implemented version.

Collapse
10: Re: Towards OpenACS 5.8 (response to 8)
Posted by Jim Lynch on
Gustaf,

when I saw your "string length $x --> 1", I went "whoa!!"

No wonder they didn't compare, and seeing "" isn't enough to assume a zero-length string.

Thanks! Very good debigging tool. (smalling? no, I meant deBUGging)

-Jim

Collapse
11: Re: Towards OpenACS 5.8 (response to 8)
Posted by Jim Lynch on
curious about a few different things...

First, is build of naviserv similar to aolserver in that you would build a tcl against which the naviserv is linked?

and, what about the tcl version? are folks testing tcl-8.6, and is tcl-8.6 vs tcl-8.5 influential on ns_quotehtml?

-Jim

Collapse
12: Re: Towards OpenACS 5.8 (response to 11)
Posted by Gustaf Neumann on
NaviServer is parent and son of aolserver (aolserver was at some time in the past called NaviServer); of course, both are dependent on Tcl (and link-in Tcl).

NaviServer builds against Tcl 8.6, although i would not recommend it right now for production sites. i am already quite happy that openacs 5.8 can use Tcl 8.5 features to remove some obscure constructs from the past.

Concerning ns_quotehtml: the bug is clearly in some recent aolserver versions; tcl8.6 has the same troubles with C-injected invalid chars.

Collapse
9: Re: Towards OpenACS 5.8 (response to 5)
Posted by Gustaf Neumann on
Jeff,

recommending NaviServer is one thing, but requiring it is not an option now (it would require a TIP). Right now, we we have packaged versions (win, Debian) for aolserver, but not for naviserver. Although naviserver is in many respects better (https://bitbucket.org/naviserver/naviserver/src/deab33e7b903f8d62fc439f06612a3dfb1af60aa/NEWS), many aolserver installations are traditionally change averse, although i know of serveral sites that did that change (lms.at, phigita.net)

The case shows, that we still need more aolserver testing. Every test report is welcome.