Mail Archives: cygwin/2000/06/29/16:59:45
------=_NextPart_000_0004_01BFE1CE.0ADB73D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Dear rsync developers,
I've been testing rsync under cygwin on NT.
It works great, with one exception.
If a file that rsync is supposed to replace is open by other application,
rsync cannot replace the file even if it is opened in a shared mode. This
in particular happens when rsync is trying to replace a file that is being
served by IIS as a web content.
I was able to resolve the issue with a minor modification of rsync code.
When the described above situation happens (in rsync.c) I make a copy of
file instead of renaming it by calling function copy_file from util.c. I
also had to modify function copy_file not to delete file before opening it,
but to truncate file during the opening.
This seems to solve the problem.
The patch is attached.
Cygwin developers, could you please review the patch, and see if there is a
better solution.
I hope it will be taken into account on next rsync release.
I have preserved the code for all other platforms, but cigwin.
Thank you very much for your consideration,
Vlad
------=_NextPart_000_0004_01BFE1CE.0ADB73D0
Content-Type: application/octet-stream;
name="rsync-2.4.3.cygwin.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="rsync-2.4.3.cygwin.diff"
diff -ur rsync-2.4.3.orig/rsync.c rsync-2.4.3.cygwin/rsync.c=0A=
--- rsync-2.4.3.orig/rsync.c Sat Jan 29 03:35:03 2000=0A=
+++ rsync-2.4.3.cygwin/rsync.c Thu Jun 29 11:59:55 2000=0A=
@@ -240,9 +240,17 @@=0A=
=0A=
/* move tmp file over real file */=0A=
if (robust_rename(fnametmp,fname) !=3D 0) {=0A=
- if (errno =3D=3D EXDEV) {=0A=
- /* rename failed on cross-filesystem link. =0A=
- Copy the file instead. */=0A=
+#ifdef __CYGWIN__=0A=
+ if (errno =3D=3D EXDEV || errno =3D=3D EACCES)=0A=
+ /* rename failed on cross-filesystem link=0A=
+ or destination may be open in shared mode by other application.=0A=
+ Copy the file instead. */=0A=
+#else=0A=
+ if (errno =3D=3D EXDEV)=0A=
+ /* rename failed on cross-filesystem link=0A=
+ Copy the file instead. */=0A=
+#endif=0A=
+ {=0A=
if (copy_file(fnametmp,fname, file->mode & INITACCESSPERMS)) {=0A=
rprintf(FERROR,"copy %s -> %s : %s\n",=0A=
fnametmp,fname,strerror(errno));=0A=
diff -ur rsync-2.4.3.orig/util.c rsync-2.4.3.cygwin/util.c=0A=
--- rsync-2.4.3.orig/util.c Sat Apr 8 19:53:31 2000=0A=
+++ rsync-2.4.3.cygwin/util.c Thu Jun 29 12:11:01 2000=0A=
@@ -316,13 +316,17 @@=0A=
return -1;=0A=
}=0A=
=0A=
+#ifndef __CYGWIN__=0A=
if (robust_unlink(dest) && errno !=3D ENOENT) {=0A=
rprintf(FERROR,"unlink %s: %s\n",=0A=
dest,strerror(errno));=0A=
return -1;=0A=
}=0A=
-=0A=
ofd =3D do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode);=0A=
+#else=0A=
+ ofd =3D do_open(dest, O_WRONLY | O_CREAT | O_TRUNC, mode);=0A=
+#endif=0A=
+=0A=
if (ofd =3D=3D -1) {=0A=
rprintf(FERROR,"open %s: %s\n",=0A=
dest,strerror(errno));=0A=
------=_NextPart_000_0004_01BFE1CE.0ADB73D0
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
------=_NextPart_000_0004_01BFE1CE.0ADB73D0--
- Raw text -