|
From: | Paul Eggert |
Subject: | bug#47059: bug in cp removing destination file when it can't be replaced due to cross-volume linking |
Date: | Mon, 21 Feb 2022 01:18:43 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 |
When creating a link to a local file, I first create the link to a temporary name to ensure I have appropriate access (or that its not cross-linked in this case). Apparently 'cp' doesn't exercise the same caution.
Actually, cp -l is even more cautious than the procedure you describe. If the destination already exists, cp -l fails without altering the destination.
$ echo a >abc $ echo bb >/tmp/def $ cp -l abc /tmp/def cp: cannot create hard link '/tmp/def' to 'abc': File exists $ ls -l abc /tmp/def -rw-rw-r-- 1 eggert eggert 3 Feb 21 01:13 /tmp/def -rw-rw-r-- 1 eggert eggert 2 Feb 21 01:13 abcHence the symptoms you reported are mysterious; I don't see how they could have happened.
[Prev in Thread] | Current Thread | [Next in Thread] |