bug#32455: cp gets confused by symlinks to parent directory

2018-08-16 Thread Mike Crowe
If cp is passed the -d option and told to copy a symlink to the directory containing the symlink then it ends up removing the target directory so it is unable to create the symlink. Reproduction script: --8<-- #!/bin/sh set -x rm -rf temp mkdir -p temp/src temp/dest ln -s . temp/src/self #

bug#25680: [PATCH] copy: Avoid race when creating hard link over recently-created file

2017-02-13 Thread Mike Crowe
On Saturday 11 February 2017 at 23:20:24 -0800, Paul Eggert wrote: > Mike Crowe wrote: > >Do you think that if I added such a limit and diagnostic then the patch > >would be acceptable? > > I'd rather fix the underlying problem more systematically. How about the > atta

bug#25680: [PATCH] copy: Avoid race when creating hard link over recently-created file

2017-02-10 Thread Mike Crowe
On Friday 10 February 2017 at 11:55:35 -0800, Paul Eggert wrote: > On 02/10/2017 11:18 AM, Mike Crowe wrote: > >- if (link_failed && replace && errno == EEXIST) > >+ while (link_failed && replace && errno == EEXIST) > > This could cause '

bug#25680: [PATCH] copy: Avoid race when creating hard link over recently-created file

2017-02-10 Thread Mike Crowe
Ensure that create_hard_link is permitted to overwrite the destination file if --force is passed to cp. It is possible for the file to appear between checking and creating the hard link. This may happen multiple times, so also loop inside create_hard_link each time it fails. The race is made