[v9_16] Fix "kasp test broken on freebsd"
7249bad7 introduced the -c option to stat(1) command, but BSD systems do not know about it. Replace the stat(1) command with a PERL script that achieves the same.
Why PERL? For consistency purposes, there are more places in the system test where we use the same method.
(cherry picked from commit fe601c59)
Closes #3352 (closed)