Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com Date: Tue, 10 Aug 1999 01:00:30 -0400 From: Chris Faylor To: Corinna Vinschen Cc: cygwin-developers AT sourceware DOT cygnus DOT com Subject: Re: B20: mv deletes files on error (NT) Message-ID: <19990810010030.B9899@cygnus.com> References: <3 DOT 0 DOT 5 DOT 32 DOT 19990329184811 DOT 00a1d360 AT pop DOT ma DOT ultranet DOT com> <3 DOT 0 DOT 5 DOT 32 DOT 19990329192524 DOT 00a1b9b0 AT pop DOT ma DOT ultranet DOT com> <37002186 DOT C647122A AT cityweb DOT de> <19990329222042 DOT A2607 AT cygnus DOT com> <37009A6E DOT AC992BE5 AT cityweb DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i In-Reply-To: <37009A6E.AC992BE5@cityweb.de>; from Corinna Vinschen on Tue, Mar 30, 1999 at 11:33:34AM +0200 Applied. I know it's almost five months later but I just realized that I was using your patches in my own local copies of the files and hadn't ever actually checked things in. Thanks, -chris On Tue, Mar 30, 1999 at 11:33:34AM +0200, Corinna Vinschen wrote: >Chris Faylor wrote: >> >> Actually, was it even your change, Corinna? I can't find it in the >> ChangeLog. > >It's in the ChangeLog, dated 12-Feb-99. > >> Has someone come up with a patch for `mv' yet? If so, please send it to >> me with a ChangeLog entry and I'll get it into Cygnus's sources and look >> into getting it into the FSF sources as well. > >I have a patch, made for me at home. It's not very clean, I fear, but >if you think that it's ok... >It handles the two cases, to rename a file with only changing the >case (first additional line) or changing `foo.exe' to 'foo', including >changing the case (next three lines). >I have patched earlier `ln' and `cp', to eliminate the boring `.exe' >problem with the three line patch. I have attached this patches, too. > >Regards, >Corinna > >ChangeLog: (Date is a lie) >========== > >Tue Mar 30 11:00:00 1999 Corinna Vinschen > > * fileutils/src/mv.c: Handles renaming files to another case. > * fileutils/src/mv.c: Handles renaming files to same name, but > without `.exe' suffix. > * fileutils/src/cp.c: Ditto for copying files. > * fileutils/src/ln.c: Ditto for linking files. > >======= snip ======= >--- mv.c.old Tue Mar 30 10:41:46 1999 >+++ mv.c Tue Mar 30 03:12:56 1999 >@@ -248,6 +248,12 @@ do_move (const char *source, const char > { > if (source_stats.st_dev == dest_stats.st_dev > && source_stats.st_ino == dest_stats.st_ino >+#if defined (__CYGWIN__) || defined (__CYGWIN32__) >+ && strcasecmp (source, dest) != 0 >+ && (strlen (source) < 5 >+ || strncasecmp (source, dest, strlen (dest)) != 0 >+ || strcasecmp (source + strlen (source) - 4, ".exe") != 0) >+#endif > ) > { > error (0, 0, _("`%s' and `%s' are the same file"), source, dest); > >--- cp.c.old Tue Mar 30 10:56:45 1999 >+++ cp.c Fri Nov 13 00:44:32 1998 >@@ -659,6 +659,11 @@ copy (const char *src_path, const char * > > if (src_sb.st_ino == dst_sb.st_ino > && src_sb.st_dev == dst_sb.st_dev >+#if defined (__CYGWIN__) || defined (__CYGWIN32__) >+ && (strlen (src_path) < 5 >+ || strncasecmp (src_path, dst_path, strlen (dst_path)) != 0 >+ || strcasecmp (src_path + strlen (src_path) - 4, ".exe") != 0) >+#endif > ) > { > if (flag_hard_link) >--- ln.c.old Tue Mar 30 10:56:36 1999 >+++ ln.c Fri Nov 13 00:52:48 1998 >@@ -204,6 +204,11 @@ do_link (const char *source, const char > && (!symlink || stat (source, &source_stats) == 0) > && source_stats.st_dev == dest_stats.st_dev > && source_stats.st_ino == dest_stats.st_ino >+#if defined (__CYGWIN__) || defined (__CYGWIN32__) >+ && (strlen (source) < 5 >+ || strncasecmp (source, dest, strlen (dest)) != 0 >+ || strcasecmp (source + strlen (source) - 4, ".exe") != 0) >+#endif > /* The following detects whether removing DEST will also remove > SOURCE. If the file has only one link then both are surely > the same link. Otherwise check whether they point to the same >@@ -250,6 +255,11 @@ do_link (const char *source, const char > return 0; > } > else if (!remove_existing_files >+#if defined (__CYGWIN__) || defined (__CYGWIN32__) >+ && (strlen (source) < 5 >+ || strncasecmp (source, dest, strlen (dest)) != 0 >+ || strcasecmp (source + strlen (source) - 4, ".exe") != 0) >+#endif > ) > { > error (0, 0, _("%s: File exists"), dest); > -- cgf AT cygnus DOT com http://www.cygnus.com/