[PATCH] cmd: copy: "Path not found" error

Dmitry Potapov dpotapov at gmail.com
Fri Oct 12 17:37:06 CDT 2007


When I tried to copy an old file to a new non-existing file, the copy
command failed with the "Path not found" error:

Z:\tmp\> copy oldfile newfile
Path not found

It turns out that the copy command erroneously interpreted a not existing
destination file as an existing directory and failed when tried to copy
into it.

The bug was introduced in commit a766ba057061e669f8a8bbad19287f46d6391bae
> Author: Jason Edmeades <jason.edmeades at googlemail.com>
> Date:   Fri Jul 27 21:43:37 2007 +0100
>
>     cmd: Add support for wildcards in copy.

Affected Wine releases are 0.9.43 and up to 0.9.46

Signed-off-by: Dmitry Potapov <dpotapov at gmail.com>
---
 programs/cmd/builtins.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 496ec86..43f63f6 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -171,7 +171,7 @@ void WCMD_copy (void) {
   if (outpath[strlenW(outpath) - 1] == '\\')
       outpath[strlenW(outpath) - 1] = '\0';
   attribs = GetFileAttributes(outpath);
-  if (attribs & FILE_ATTRIBUTE_DIRECTORY) {
+  if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY)) {
     strcatW (outpath, slashW);
     copyToDir = TRUE;
   }
-- 
1.5.3.4




More information about the wine-bugs mailing list