CPack/RPM: execute `stat` to get permissions instead of `ls -l` Ask `stat` to output only human-readable permissions and nothing else. Secondly, simplify parsing algorithm. Instead of multiple regex matches transform permissions into a list and split into groups.