delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/03/30/05:03:29

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Message-ID: <37009A6E.AC992BE5@cityweb.de>
Date: Tue, 30 Mar 1999 11:33:34 +0200
From: Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>
X-Mailer: Mozilla 4.51 [en] (WinNT; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: Chris Faylor <cgf AT cygnus DOT com>, cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: B20: mv deletes files on error (NT)
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>

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  <corinna DOT vinschen AT cityweb DOT de>

	* 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);

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019