Hi, Thomas!

>
>Thank you for mc - I use it daily ! Sorry, but I probably found a bug.
>
>OS: Linux SuSE 7.2;  Kernel 2.4.4-4GB
>$ mc --version
>The Midnight Commander 4.5.51
>
. . .

>
>OS: Linux SuSE 6.1; Kernel 2.2.XX
>$ mc --version
>The Midnight Commander 4.5.25
>
. . .

It was indeed a bug in src/file.c. You can use attached patch.
Thanks a lot for quality bug report.

Regards,
Andrew.

Index: mc/src/ChangeLog
diff -u mc/src/ChangeLog:1.675 mc/src/ChangeLog:1.676
--- mc/src/ChangeLog:1.675      Wed Jan  9 05:54:13 2002
+++ mc/src/ChangeLog    Tue Jan 15 03:01:31 2002
@@ -1,7 +1,12 @@
+2002-01-15  Andrew V. Samoilov  <[EMAIL PROTECTED]>
+
+       * file.c (copy_dir_dir): Check the destination is a directory
+       if it exists. Reported by Thomas <[EMAIL PROTECTED]>.
+
 2002-01-09  Andrew V. Samoilov  <[EMAIL PROTECTED]>
 
        * util.c (string_perm) [S_IFDOOR]: Support Solaris doors.
-       screen.c (string_file_type) [S_IFDOOR]: Likewise.
+       * screen.c (string_file_type) [S_IFDOOR]: Likewise.
 
 2001-12-21  Pavel Roskin  <[EMAIL PROTECTED]>
 
Index: mc/src/file.c
diff -u mc/src/file.c:1.71 mc/src/file.c:1.72
--- mc/src/file.c:1.71  Wed Nov 14 18:20:38 2001
+++ mc/src/file.c       Tue Jan 15 03:01:29 2002
@@ -97,7 +97,7 @@
 
 /* }}} */
 
-/* rcsid [] = "$Id: file.c,v 1.71 2001/11/14 23:20:38 proskin Exp $" */
+/* rcsid [] = "$Id: file.c,v 1.72 2002/01/15 08:01:29 andrew Exp $" */
 
 int verbose = 1;
 
@@ -886,6 +886,7 @@
     lp->next = parent_dirs;
     parent_dirs = lp;
 
+ retry_dst_stat:
     /* Now, check if the dest dir exists, if not, create it. */
     if (mc_stat (d, &buf)){
        /* Here the dir doesn't exist : make it !*/
@@ -906,6 +907,13 @@
          * so, say /bla exists, if we copy /tmp/\* to /bla, we get /bla/tmp/\*
          * or ( /bla doesn't exist )       /tmp/\* to /bla     ->  /bla/\*
          */
+       if (!S_ISDIR (buf.st_mode)){
+           return_status = file_error (_(" Destination \"%s\" must be a directory \n 
+%s "), d);
+           if (return_status == FILE_RETRY)
+               goto retry_dst_stat;
+           g_free (parent_dirs);
+           return return_status;
+       }
 #if 1
 /* Again, I'm getting curious. Is not d already what we wanted, incl.
  *  masked source basename? Is not this just a relict of the past versions? 

Reply via email to