problem cloning large file (32MB) on Windows/Network Shares

Adrian Buehlmann adrian at cadifra.com
Thu Jan 13 19:40:52 CST 2011


On 2011-01-14 02:27, rollin wrote:
> When I modified my test program to use GENERIC_READ | GENERIC_WRITE, it
> worked on both the local drive and the shared drive.

If you manage to build mercurial, try this experimental patch:

diff --git a/mercurial/osutil.c b/mercurial/osutil.c
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -436,7 +436,7 @@ static PyObject *posixfile(PyObject *sel
        }
        else
                flags = _O_TEXT;
-       if (plus) {
+       if (plus || m0 != 'r') {
                flags |= _O_RDWR;
                access = GENERIC_READ | GENERIC_WRITE;
                fpmode[fppos++] = '+';
@@ -453,18 +453,10 @@ static PyObject *posixfile(PyObject *sel
                break;
        case 'w':
                creation = CREATE_ALWAYS;
-               if (!plus) {
-                       access = GENERIC_WRITE;
-                       flags |= _O_WRONLY;
-               }
                break;
        case 'a':
                creation = OPEN_ALWAYS;
                flags |= _O_APPEND;
-               if (!plus) {
-                       flags |= _O_WRONLY;
-                       access = GENERIC_WRITE;
-               }
                break;
        default:
                PyErr_Format(PyExc_ValueError,


More information about the Mercurial mailing list