Forbid MOD file names that are too long.

And rename filenames in the testsuite that are too long.

Closes #626
(cherry picked from commit 9e332ef3059a7e83ced90a493d57ea21b6caff5e)