{"thread":{"id":"4531","subject":"Cygwin git and windows network shares","startedAt":"2006-06-16T12:58:34Z","lastAt":"2006-06-17T01:23:38Z","messageCount":6,"participants":["Niklas Frykholm","Juergen Ruehle","Christopher Faylor"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"21880","messageId":"4492AAFA.20807@grin.se","threadId":"4531","inReplyTo":null,"subject":"Cygwin git and windows network shares","fromName":"Niklas Frykholm","fromEmail":"niklas@grin.se","sentAt":"2006-06-16T12:58:34Z","receivedAt":"2006-06-16T12:58:34Z","isPatch":false,"sender":{"key":"niklas@grin.se","avatar":null},"body":"I'm trying to use cygwin git (compiled from the 1.4.0 tarball) to create \nrepository on a windows network share, but I get an error message.\n\n    $ cd //computer/git/project\n    $ git init-db\n    defaulting to local storage area\n    Could not rename the lock file?\n\nThe repository seems to be left in an inconsistent state after this:\n\n    $ git clone //computer/git/project/\n    fatal: no matching remote head\n    fetch-pack from '//computer/git/project/.git' failed.\n\nWhen working only with local files, I do not get these errors. Does \nanyone know the cause of this error/any way around it?\n\n// Niklas\n"},{"id":"21881","messageId":"17554.48926.852000.679014@lapjr.intranet.kiel.bmiag.de","threadId":"4531","inReplyTo":"4492AAFA.20807@grin.se","subject":"Re: Cygwin git and windows network shares","fromName":"Juergen Ruehle","fromEmail":"j.ruehle@bmiag.de","sentAt":"2006-06-16T14:24:30Z","receivedAt":"2006-06-16T14:24:30Z","isPatch":false,"sender":{"key":"j.ruehle@bmiag.de","avatar":null},"body":"Niklas Frykholm writes:\n > I'm trying to use cygwin git (compiled from the 1.4.0 tarball) to create \n > repository on a windows network share, but I get an error message.\n > \n >     $ cd //computer/git/project\n >     $ git init-db\n >     defaulting to local storage area\n >     Could not rename the lock file?\n\ncygwin's rename seems to be capable of overwriting an existing target\nonly on NTFS. The following hack is a workaround, but is probably not\nsafe.\n\ndiff --git a/lockfile.c b/lockfile.c\nindex 2346e0e..5e78211 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -48,6 +48,7 @@ int commit_lock_file(struct lock_file *l\n \tstrcpy(result_file, lk->filename);\n \ti = strlen(result_file) - 5; /* .lock */\n \tresult_file[i] = 0;\n+\tunlink(result_file);\n \ti = rename(lk->filename, result_file);\n \tlk->filename[0] = 0;\n \treturn i;\n"},{"id":"21917","messageId":"20060616221014.GA22181@trixie.casa.cgf.cx","threadId":"4531","inReplyTo":"17554.48926.852000.679014@lapjr.intranet.kiel.bmiag.de","subject":"Re: Cygwin git and windows network shares","fromName":"Christopher Faylor","fromEmail":"me@cgf.cx","sentAt":"2006-06-16T22:10:14Z","receivedAt":"2006-06-16T22:10:14Z","isPatch":false,"sender":{"key":"me@cgf.cx","avatar":null},"body":"On Fri, Jun 16, 2006 at 04:24:30PM +0200, Juergen Ruehle wrote:\n>Niklas Frykholm writes:\n> > I'm trying to use cygwin git (compiled from the 1.4.0 tarball) to create \n> > repository on a windows network share, but I get an error message.\n> > \n> >     $ cd //computer/git/project\n> >     $ git init-db\n> >     defaulting to local storage area\n> >     Could not rename the lock file?\n>\n>cygwin's rename seems to be capable of overwriting an existing target\n>only on NTFS. The following hack is a workaround, but is probably not\n>safe.\n\nActually, Cygwin's rename has a specific check to make sure that the\nfile is deleted.  It tries very hard to do things the right way but if\nyour samba server doesn't return the correct error code then it is\npossible that it could be confused.\n\ncgf\n"},{"id":"21920","messageId":"20060616223006.GA23737@trixie.casa.cgf.cx","threadId":"4531","inReplyTo":"20060616221014.GA22181@trixie.casa.cgf.cx","subject":"Re: Cygwin git and windows network shares","fromName":"Christopher Faylor","fromEmail":"me@cgf.cx","sentAt":"2006-06-16T22:30:06Z","receivedAt":"2006-06-16T22:30:06Z","isPatch":false,"sender":{"key":"me@cgf.cx","avatar":null},"body":"On Fri, Jun 16, 2006 at 06:10:14PM -0400, Christopher Faylor wrote:\n>On Fri, Jun 16, 2006 at 04:24:30PM +0200, Juergen Ruehle wrote:\n>>Niklas Frykholm writes:\n>> > I'm trying to use cygwin git (compiled from the 1.4.0 tarball) to create \n>> > repository on a windows network share, but I get an error message.\n>> > \n>> >     $ cd //computer/git/project\n>> >     $ git init-db\n>> >     defaulting to local storage area\n>> >     Could not rename the lock file?\n>>\n>>cygwin's rename seems to be capable of overwriting an existing target\n>>only on NTFS. The following hack is a workaround, but is probably not\n>>safe.\n>\n>Actually, Cygwin's rename has a specific check to make sure that the\n>file is deleted.  It tries very hard to do things the right way but if\n>your samba server doesn't return the correct error code then it is\n>possible that it could be confused.\n\n>diff --git a/lockfile.c b/lockfile.c\n>index 2346e0e..5e78211 100644\n>--- a/lockfile.c\n>+++ b/lockfile.c\n>@@ -48,6 +48,7 @@ int commit_lock_file(struct lock_file *l\n>       strcpy(result_file, lk->filename);\n>       i = strlen(result_file) - 5; /* .lock */\n>       result_file[i] = 0;\n>+      unlink(result_file);\n>       i = rename(lk->filename, result_file);\n>       lk->filename[0] = 0;\n>       return i;\n\nI also meant to ask if there was an i is nonzero after the call to the\nrename() above?  If so, what was the errno?  If not, it is a huge\nproblem if rename is reporting that it is able to rename a file but is\nnot actually doing it.\n\ncgf\n(cygwin maintainer)\n"},{"id":"21930","messageId":"17555.21646.398000.619804@lapjr.intranet.kiel.bmiag.de","threadId":"4531","inReplyTo":"17554.48926.852000.679014@lapjr.intranet.kiel.bmiag.de","subject":"Re: Cygwin git and windows network shares","fromName":"Juergen Ruehle","fromEmail":"j.ruehle@bmiag.de","sentAt":"2006-06-17T01:02:06Z","receivedAt":"2006-06-17T01:02:06Z","isPatch":false,"sender":{"key":"j.ruehle@bmiag.de","avatar":null},"body":"Juergen Ruehle writes:\n > The following hack is a workaround, but is probably not safe.\n\nPlease just ignore it, it only helps on FAT32 partitions. Sorry for\nthe confusion.\n\n  jr\n"},{"id":"21931","messageId":"20060617012338.GB23924@trixie.casa.cgf.cx","threadId":"4531","inReplyTo":"17555.21858.292000.494454@lapjr.intranet.kiel.bmiag.de","subject":"Re: Cygwin git and windows network shares","fromName":"Christopher Faylor","fromEmail":"me@cgf.cx","sentAt":"2006-06-17T01:23:38Z","receivedAt":"2006-06-17T01:23:38Z","isPatch":false,"sender":{"key":"me@cgf.cx","avatar":null},"body":"On Sat, Jun 17, 2006 at 03:05:38AM +0200, Juergen Ruehle wrote:\n>Christopher Faylor writes:\n> > I also meant to ask if there was an i is nonzero after the call to the\n> > rename() above?  If so, what was the errno?  If not, it is a huge\n> > problem if rename is reporting that it is able to rename a file but is\n> > not actually doing it.\n>\n>After some testing the conclusion is that it's not lying, but only\n>failing in interesting ways on my (and seemingly also Niklas') system:\n>\n> - rename on NTFS succeeds (and returns 0)\n>\n> - rename on FAT32 succeeds if target does not exist (and returns 0)\n>\n>   rename on FAT32 fails if target exists with EACCESS\n>\n>   (manual mv on commandline works)\n>\n> - rename on a network share always hangs for a while and then fails\n>   with EBUSY (even if target does not exist)\n>\n>   (share served by XP, tested both NTFS and FAT32)\n>\n>   (manual mv still works)\n>\n>Various combinations of server, ntsec, and smbntsec didn't seem to\n>make a difference; /etc/{passwd,group} have been freshly created.\n\nThanks.  I really appreciate the details.  I've passed them on to the\nlast person to touch the rename code.\n\ncgf\n"}]}