Fix for acceptance tests.

It turns out that using printf and stat is not such a good idea, since
their behavior change from platform to platform.
This commit changes the mode test to a little perl script.