On 30/06/2024 04:38, Alexander Necheff wrote:
I discovered that when chown is executed as follows: `chown --no-dereference --reference=/some/file /another/file` chown will still dereference /some/file if it is a symlink and source ownership from the referenced file instead of the named symlink. The man page did not mention this behavior though the info page does make it clear this is an intentional design decision.
The man page omission was fixed with https://bugs.gnu.org/61720
I was curious if: 1. There was a technical reason for this? 2. There were any thoughts on having chown be able to source ownership from a symlink, perhaps through a different argument so as to preserve existing behavior?
The main reason it's not supported is that it's not usually required, and to provide this functionality would need another option, as -h controls the _destination_ rather than the source. How about instead using: chown -h $(stat -c '%u:%g' /some/file) /another/file cheers, Pádraig.