|
From: | GNU bug Tracking System |
Subject: | [debbugs-tracker] bug#31364: closed (cp -rfs: Fails to overwrite a symlink when it is on a different device) |
Date: | Tue, 15 May 2018 17:02:02 +0000 |
Your message dated Tue, 15 May 2018 10:01:20 -0700 with message-id <address@hidden> and subject line Re: bug#31364: cp -rfs: Fails to overwrite a symlink when it is on a different device has caused the debbugs.gnu.org bug report #31364, regarding cp -rfs: Fails to overwrite a symlink when it is on a different device to be marked as done. (If you believe you have received this mail in error, please contact address@hidden) -- 31364: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31364 GNU Bug Tracking System Contact address@hidden with problems
--- Begin Message ---Subject: cp -rfs: Fails to overwrite a symlink when it is on a different device Date: Fri, 04 May 2018 23:37:55 +0000 Hello,I have found a bug in "cp -rfs".Steps to reproduce:1. Given "path1" and "path2" are on different devices.2. $ touch "path1/file"3. $ cd path2/; ln -s path1/file4. $ cp --symbolic-link --force --recursive path1/file .Expected:The link is overwritten with an exact copy.Actual result:cp shows an error:cp: 'path1/file' and './file' are the same fileThis bug was introduced inSpecifically this hunk:@@ -46,6 +46,7 @@#include "file-set.h"#include "filemode.h"#include "filenamecat.h"+#include "force-link.h"#include "full-write.h"#include "hash.h"#include "hash-triple.h"@@ -1623,11 +1624,13 @@ same_file_ok (char const *src_name, struct stat const *src_sb,}}- /* It's ok to remove a destination symlink. But that works only when we- unlink before opening the destination and when the source and destination- files are on the same partition. */- if (x->unlink_dest_before_opening- && S_ISLNK (dst_sb_link->st_mode))+ /* It's ok to remove a destination symlink. But that works only+ when creating symbolic links, or when the source and destination+ are on the same file system and when creating hard links or when+ unlinking before opening the destination. */+ if (x->symbolic_link+ || ((x->hard_link || x->unlink_dest_before_opening)+ && S_ISLNK (dst_sb_link->st_mode)))return dst_sb_link->st_dev == src_sb_link->st_dev;if (x->dereference == DEREF_NEVER)Two patches that fix the issue are attached.They are against the current master in https://github.com/coreutils/coreutilsThe changes are also here:Thank you, Illia Bobyr0002-cp-Overwrite-symlinks-on-another-device.patch
Description: Text Data0001-cp-No-dup-check-for-unlink_dest_after_failed_open.patch
Description: Text Data
--- End Message ---
--- Begin Message ---Subject: Re: bug#31364: cp -rfs: Fails to overwrite a symlink when it is on a different device Date: Tue, 15 May 2018 10:01:20 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Pushed at https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.29-36-gd3daa95 marking this as done cheers, Pádraig.
--- End Message ---
[Prev in Thread] | Current Thread | [Next in Thread] |