From 67ac583b5bfb5c72fd1cd88ee7c211979d6e190b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 25 Sep 2022 23:50:25 +0200 Subject: [PATCH] [CMD] COPY: Always remove the read-only attribute, for MS-DOS backwards-compatibility. Tested and compared with MS CMD.EXE when copying files within the same directory, across directories and across drives. This is not done for the MOVE, REN and REPLACE commands however. CORE-18090 --- base/shell/cmd/copy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/shell/cmd/copy.c b/base/shell/cmd/copy.c index 40bf43eda0d..73901d7cd91 100644 --- a/base/shell/cmd/copy.c +++ b/base/shell/cmd/copy.c @@ -258,7 +258,8 @@ copy(TCHAR source[MAX_PATH], CloseHandle (hFileSrc); TRACE ("setting mode\n"); - SetFileAttributes (dest, dwAttrib); + /* For MS-DOS backwards-compatibility, always remove the read-only attribute */ + SetFileAttributes (dest, dwAttribs & ~FILE_ATTRIBUTE_READONLY); /* Now finish off the copy if needed with CopyFileEx */ if (lpdwFlags & COPY_RESTART)