saltstack/salt — pull request #6855 by philipforget (2013-08-22 19:33:46+00:00)
Title: Functions get_gid, get_uid and chown in modules/file.py do not work for broken symlinks

Addresses issue #6826

This issue can arise when you are recursively managing the group and user of a directory which contains a broken symlink -- symlink exists on disk, but file it's pointing to does not. This causes the state to fail, when in reality the symlink itself should have it's owner and group changed.

This requires changes to get_uid and get_gid as they too try to `stat` the file but since it is a symlink pointing to nothing, we need to not follow the link, so we use `lstat`. I'll try to put in some tests for this, but I figured I'd open the pull request now.