SystemTools: Adapt test to MSYS
Cygwin/MSYS uses umask on stat when noacl is set on the filesystem (which MSYS sets by default), so the returned permissions don't necessarily reflect what was actually set.
Solve by delaying umask to where it is actually needed.
Edited by Brad King