[OPEN-ILS-DEV] messagecatalog -- linefeeds and other escaped characters

Scott McKellar mck9 at swbell.net
Sat Aug 18 13:57:36 EDT 2007


--- Mike Rylander <mrylander at gmail.com> wrote:

> On 8/18/07, Scott McKellar <mck9 at swbell.net> wrote:

> > To do the job correctly, there's no way to avoid traversing the
> string
> > character by character, responding to backslashes as you find them
> > (unless of course such a function is already available).
> 
> Well, that's not entirely true.  The only real problem with doing
> this
> via regexp in JS is that there is no zero-width negative look-behind
> assertion in the JS regexp engine.  I've been looking at different
> ways to mimic that, but they all fall down in some areas.  I haven't
> yet concluded if those failures are of any consequence to us, though.
>
> Of course, now, after a couple cups of coffee and a few hours of
> sleep, it seems like it may be easiest just to port the portion of
> the
> C function that does this for JSON parsing ...

Not being a JS maven, I assumed that replace() looked for literal
matches.  If it uses regular expressions then you might be able to 
come up with something sufficiently clever.  However sometimes it's 
easiest to do something the hard way.

> Thanks for the perspective, Scott.  And I haven't forgotten your
> patch, I just haven't had a chance to test it yet!

I imagine that setting up a test would take a fair amount of work, 
using a full opensrf rather than a stripped-down test harness like 
I'm using.

Don't throw away your test job too soon.  I've got another patch 
coming along, which will report not only the PID but also the 
application name of the defunct child.  That way a troubleshooting
admin won't have to search through all the preceding messages in
order to figure out which app died.

In order to report the app name I maintain a list of the apps
launched, so that I can search it by PID.  I also store the libfile
name, although at present I'm not reporting it.

I considered using an osrfList for this purpose, but finally decided
to implement my own doubly-linked list.  I can switch to an osrfList
if you prefer, but in this case it looked more cumbersome, with no
obvious benefit.

With some more tweaking, this list of child apps could be used to
re-launch failed apps.  Judging from a comment in the original code,
there was an intent to re-launch apps but it was never implemented.

Scott McKellar
http://home.swbell.net/mck9/ct/



More information about the Open-ils-dev mailing list