Paul Eggert <eggert@cs.ucla.edu> writes:
I fixed this in the attached patch by using linkat with AT_SYMLINK_FOLLOW, as this is immune to the problem of resolving symlinks and is the intended meaning here anyway. On older systems lacking linkat, the code checks whether the source is a symlink and refuses to hard-link to it; this should be good enough.
hmmm ...
Thanks again for the diagnosis and suggestions. Please try the attached patch, which I've installed into the development repository.
Running with this code on a Linux box, with a modification to force staysymlink true, I get a lot of symlinks that seem to be misdirected. For example the toplevel Cuba link looks like lrwxrwxrwx. 1 postgres postgres 17 Nov 3 20:39 Cuba -> ../America/Havana when it should be just America/Havana. regards, tom lane