DSpaceConfigurationService.replaceVariables() is able to catch
*direct* circularity ("foo = ${foo}"), but will hang on indirect
circularity ("foo = ${foo}\nbar = ${foo}/baz").  In the first case,
the value is left unchanged and the loop broken, *leaving the direct
circularity in place*.  In the second case, the key is not the same as
the value but replacement of the token will result in no change and
another trip 'round the loop.

I'm looking into how the circularity came about, but meanwhile, it
shouldn't hang.  Three circuit-breakers come to mind:

1. Replace direct circular references with a 0-length string.  This
   would eventually break *something*, and of course the problem will
   be logged as it is now.

2. Replacement limit:  break out of the loop if more than (say) 1024
   replacements have been made in this value, on the assumption that
   there is some kind of circularity.

3. Test for circularity at the bottom of the loop instead of the top.
   If the new value is equal to the old value, log it and break the loop.

(1) should call attention to itself later, and doesn't leave circular
references lying around.  (2) ought to catch *any* sort of
circularity, and is cheap, but could theoretically detect false
positives.  (3) is at least not arbitrary.

-- 
Mark H. Wood, Lead System Programmer   [email protected]
Asking whether markets are efficient is like asking whether people are smart.

Attachment: pgpDmFAFIpa4m.pgp
Description: PGP signature

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to