Cherry picked `salt.states.file` changes