Simple implementation of chmod(path, mode)

currently only integer modes, can do string modes like +x later
fixes #7574