|laziness, impatience, and hubris|
Problems with unicode properties in regular expressions under chrootby sgifford (Prior)
|on May 10, 2013 at 06:10 UTC||Need Help??|
sgifford has asked for the
wisdom of the Perl Monks concerning the following question:
Recently I was working on moving a program of mine based on Net::DNS::Nameserver to a new machine, upgrading from Debian 5 (Lenny) to Debian 6 (Squeeze). This upgraded Perl a little (5.10.0 to 5.10.1), along with various core modules, and I also installed the latest Net::DNS::Nameserver (upgrading from 749 to 1096).
The program runs in a chroot environment, and provides a simple DNS service.
After upgrading and getting the system running, I started seeing mysterious failures. In particular, timestamps couldn't be parsed from the config file. The problems went away when I didn't run under chroot.
After some detective work, I found these system calls happening after the server had started up:
It looks like when it was running under chroot, Perl could not find these unicode files, and so without giving any kind of clear error, silently misinterpreted basic Perl regular expressions (in particular \D).
To work around this, I can try and force Perl to use all of the properties it may need later before it does chroot, since once they are loaded they will not be loaded again. I'm using some code like this:
That seems to work well enough for now, but my code depends on various modules, and it's hard to know whether they will eventually try to load a unicode property that would cause another mysterious failure. And of course it's very depressing.
So my question is, is there a way to preload all unicode properties so that I don't have to worry about this? Or maybe a way to turn off the dynamic properties and have it use the built-in defaults? Or at least a way to get a clean failure when it can't find one of these properties, instead of mysterious misbehavior? Or any other suggestion for dealing with this problem?