Hello,

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:

open("/usr/share/perl/5.10/unicore/lib/gc_sc/SpacePer.pl", O_RDONLY) = + 5 open("/usr/share/perl/5.10/unicore/lib/gc_sc/Digit.pl", O_RDONLY) = 5

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:

# Bootstrap some dynamically loaded utf8 stuff. { my $str="8 foo"; utf8::upgrade($str); $str =~ /\p{Digit}/; $str =~ /\s/; $str = lc $str; }

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?

Thanks!


In reply to Problems with unicode properties in regular expressions under chroot by sgifford

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.