{"thread":{"id":"35697","subject":"Re: Consecutive git gc fails on Windows network share","startedAt":"2014-01-20T17:16:16Z","lastAt":"2014-01-21T17:03:30Z","messageCount":6,"participants":["Torsten Bögershausen","Stefan Beller","Johannes Schindelin","Erik Faye-Lund"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"233407","messageId":"52DD59E0.4090301@web.de","threadId":"35697","inReplyTo":"11936e14-7442-4601-8e97-b2062894975b@googlegroups.com","subject":"Re: Consecutive git gc fails on Windows network share","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-01-20T17:16:16Z","receivedAt":"2014-01-20T17:16:16Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"(No top-posting, please see my comments below)\nOn 2014-01-20 15.02, Jochen wrote:\n>On 01/16/2014 10:55 AM, Jochen Haag wrote:\n> Hello,\n>\n> we want to report the following issue, because it seems to be not an\n> intended behaviour. Maybe someone can have a look at it at some point.\n> It is not urgent for us.\n>\n> After upgrading from Git version 1.8.1.msysgit.1 to 1.8.5.2.msysgit.0 we\n> observed that a consecutive git gc fails, in case the Git repo is\n> located on a Windows network share. Operating system used is Windows 7\n> 64 bit SP1.\n>\n> In case git gc fails temporary packs and index remain in .git/objects/pack/.\n>\n> \"Consecutive\" means, that git gc is called on an already packed\n> repository (e.g. git gc is called more than once).\n>\n> This is the output given in case of error:\n>\n> U:\\GitEnv>git gc\n> Counting objects: 139, done.\n> Delta compression using up to 8 threads.\n> Compressing objects: 100% (71/71), done.\n> Writing objects: 100% (139/139), done.\n> Total 139 (delta 65), reused 139 (delta 65)\n> fatal: renaming\n> '.git/objects/pack/.tmp-7920-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack'\n> failed: Permission denied\n> error: failed to run repack\n>\n> And here the output with GIT_TRACE = 1:\n>\n> U:\\GitEnv>git gc\n> trace: built-in: git 'gc'\n> trace: run_command: 'pack-refs' '--all' '--prune'\n> trace: built-in: git 'pack-refs' '--all' '--prune'\n> trace: run_command: 'reflog' 'expire' '--all'\n> trace: built-in: git 'reflog' 'expire' '--all'\n> trace: run_command: 'repack' '-d' '-l' '-A'\n> '--unpack-unreachable=2.weeks.ago'\n> trace: built-in: git 'repack' '-d' '-l' '-A'\n> '--unpack-unreachable=2.weeks.ago'\n> trace: run_command: 'pack-objects' '--keep-true-parents'\n> '--honor-pack-keep' '--non-empty' '--all' '--reflog'\n> '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset'\n> '.git/objects/pack/.tmp-7612-pack'\n> trace: built-in: git 'pack-objects' '--keep-true-parents'\n> '--honor-pack-keep' '--non-empty' '--all' '--reflog'\n> '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset'\n> '.git/objects/pack/.tmp-7612-pack'\n> Counting objects: 139, done.\n> Delta compression using up to 8 threads.\n> Compressing objects: 100% (71/71), done.\n> Writing objects: 100% (139/139), done.\n> Total 139 (delta 65), reused 139 (delta 65)\n> fatal: renaming\n> '.git/objects/pack/.tmp-7612-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack'\n> failed: Permission denied\n> error: failed to run repack\n>\n> After running git gc twice, this is what is left in .git/objects/pack/:\n>\n> U:\\GitEnv\\.git\\objects\\pack>ls -al\n> total 53676\n> drwxr-xr-x    1 hgj2fe   Administ        0 Jan 16 10:43 .\n> drwxr-xr-x    1 hgj2fe   Administ        0 Jan 14 12:52 ..\n> -r--r--r--    1 hgj2fe   Administ     4964 Jan 16 10:43\n> .tmp-7612-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.idx\n> -r--r--r--    1 hgj2fe   Administ 18315618 Jan 16 10:43\n> .tmp-7612-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack\n> -r--r--r--    1 hgj2fe   Administ     4964 Jan 16 10:40\n> .tmp-7920-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.idx\n> -r--r--r--    1 hgj2fe   Administ 18315618 Jan 16 10:40\n> .tmp-7920-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack\n> -r--r--r--    1 hgj2fe   Administ     4964 Jan 14 12:52\n> pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.idx\n> -r--r--r--    1 hgj2fe   Administ 18315618 Jan 14 12:52\n> pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack\n>\n> In case we remove the read-only flag of the pack and index manually\n> before running git gc again, no problem occurs:\n>\n> U:\\GitEnv\\.git\\objects\\pack>git gc\n> trace: built-in: git 'gc'\n> trace: run_command: 'pack-refs' '--all' '--prune'\n> trace: built-in: git 'pack-refs' '--all' '--prune'\n> trace: run_command: 'reflog' 'expire' '--all'\n> trace: built-in: git 'reflog' 'expire' '--all'\n> trace: run_command: 'repack' '-d' '-l' '-A'\n> '--unpack-unreachable=2.weeks.ago'\n> trace: built-in: git 'repack' '-d' '-l' '-A'\n> '--unpack-unreachable=2.weeks.ago'\n> trace: run_command: 'pack-objects' '--keep-true-parents'\n> '--honor-pack-keep' '--non-empty' '--all' '--reflog'\n> '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset'\n> 'U:/GitEnv/.git/objects/pack/.tmp-3736-pack'\n> trace: built-in: git 'pack-objects' '--keep-true-parents'\n> '--honor-pack-keep' '--non-empty' '--all' '--reflog'\n> '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset'\n> 'U:/GitEnv/.git/objects/pack/.tmp-3736-pack'\n> Counting objects: 139, done.\n> Delta compression using up to 8 threads.\n> Compressing objects: 100% (71/71), done.\n> Writing objects: 100% (139/139), done.\n> Total 139 (delta 65), reused 139 (delta 65)\n> trace: run_command: 'prune-packed'\n> trace: built-in: git 'prune-packed'\n> trace: run_command: 'update-server-info'\n> trace: built-in: git 'update-server-info'\n> trace: run_command: 'prune' '--expire' '2.weeks.ago'\n> trace: built-in: git 'prune' '--expire' '2.weeks.ago'\n> trace: run_command: 'rerere' 'gc'\n> trace: built-in: git 'rerere' 'gc'\n>\n> The problem might be related to this commit:\n> https://github.com/msysgit/git/commit/a1bbc6c0176f1fa2d4aa571cc0183a1f0ff9b285\n>\n>\n> Best regards,\n>\n> Jochen\n------\n> \n> \n> Am Freitag, 17. Januar 2014 19:02:07 UTC+1 schrieb Torsten Bögershausen:\n> \n> \n>     So, please, what happens if you revert that commit?\n>     It could be good if you can test it and share the results with the list\n>     /Torsten\n> \n> \n> Instead of reverting we did some more analysis.\n> \n> In repack.c we found the following code:\n> \n>         /* Now the ones with the same name are out of the way... */\n>         for_each_string_list_item(item, &names) {\n>                 for (ext = 0; ext < 2; ext++) {\n>                         char *fname, *fname_old;\n>                         struct stat statbuffer;\n>                         fname = mkpathdup(\"%s/pack-%s%s\",\n>                                         packdir, item->string, exts[ext]);\n>                         fname_old = mkpathdup(\"%s-%s%s\",\n>                                         packtmp, item->string, exts[ext]);\n>                         if (!stat(fname_old, &statbuffer)) {\n>                                 statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);\n>                                 chmod(fname_old, statbuffer.st_mode);\n>                         }\n>                         if (rename(fname_old, fname))\n>                                 die_errno(_(\"renaming '%s' failed\"), fname_old);\n>                         free(fname);\n>                         free(fname_old);\n>                 }\n>         }\n> \n> The rename command replaces a mv -f command of the original shell script. Obviously the -f option can also override a read-only file but rename can not on a network share.\n> \n> We changed the code as followed:\n> \n>         /* Now the ones with the same name are out of the way... */\n>         for_each_string_list_item(item, &names) {\n>                 for (ext = 0; ext < 2; ext++) {\n>                         char *fname, *fname_old;\n>                         struct stat statbuffer;\n>                         fname = mkpathdup(\"%s/pack-%s%s\",\n>                                         packdir, item->string, exts[ext]);\n>                         fname_old = mkpathdup(\"%s-%s%s\",\n>                                         packtmp, item->string, exts[ext]);\n>                         if (!stat(fname_old, &statbuffer)) {\n>                                 statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);\n>                                 chmod(fname_old, statbuffer.st_mode);\n>                         }\n>+++                         if (!stat(fname, &statbuffer)) {\n>+++                                 statbuffer.st_mode |= (S_IWUSR | S_IWGRP | S_IWOTH);\n>+++                                 chmod(fname, statbuffer.st_mode);\n>+++                         }\n>                         if (rename(fname_old, fname))\n>                                 die_errno(_(\"renaming '%s' failed\"), fname_old);\n>                         free(fname);\n>                         free(fname_old);\n>                 }\n>         }\n> \n> Before rename is called the destination file is made writeable. This worked for us. We are not sure if this is a good implementation.\n\nJochen,\nthanks for sharing the code changes with us.\n\nI allowed me to \na) reconstruct the original mail,\nb) add \"+++\" at the places where you added the stat() and chmod(),\nc) and to send the question \"is this a good implementation ?\" to upstream git.\n\nI think your implementation makes sense.\n/Torsten\n \n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"},{"id":"233417","messageId":"52DD9A9B.5070400@googlemail.com","threadId":"35697","inReplyTo":"52DD59E0.4090301@web.de","subject":"Re: Consecutive git gc fails on Windows network share","fromName":"Stefan Beller","fromEmail":"stefanbeller@googlemail.com","sentAt":"2014-01-20T21:52:27Z","receivedAt":"2014-01-20T21:52:27Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On 20.01.2014 18:16, Torsten Bögershausen wrote:\n> (No top-posting, please see my comments below)\n> On 2014-01-20 15.02, Jochen wrote:\n>> On 01/16/2014 10:55 AM, Jochen Haag wrote:\n>> Hello,\n>>\n>> we want to report the following issue, because it seems to be not an\n>> intended behaviour. Maybe someone can have a look at it at some point.\n>> It is not urgent for us.\n>>\n>> After upgrading from Git version 1.8.1.msysgit.1 to 1.8.5.2.msysgit.0 we\n>> observed that a consecutive git gc fails, in case the Git repo is\n>> located on a Windows network share. Operating system used is Windows 7\n>> 64 bit SP1.\n>>\n>> In case git gc fails temporary packs and index remain in .git/objects/pack/.\n>>\n>> \"Consecutive\" means, that git gc is called on an already packed\n>> repository (e.g. git gc is called more than once).\n>>\n>> This is the output given in case of error:\n>>\n>> U:\\GitEnv>git gc\n>> Counting objects: 139, done.\n>> Delta compression using up to 8 threads.\n>> Compressing objects: 100% (71/71), done.\n>> Writing objects: 100% (139/139), done.\n>> Total 139 (delta 65), reused 139 (delta 65)\n>> fatal: renaming\n>> '.git/objects/pack/.tmp-7920-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack'\n>> failed: Permission denied\n>> error: failed to run repack\n>>\n>> And here the output with GIT_TRACE = 1:\n>>\n>> U:\\GitEnv>git gc\n>> trace: built-in: git 'gc'\n>> trace: run_command: 'pack-refs' '--all' '--prune'\n>> trace: built-in: git 'pack-refs' '--all' '--prune'\n>> trace: run_command: 'reflog' 'expire' '--all'\n>> trace: built-in: git 'reflog' 'expire' '--all'\n>> trace: run_command: 'repack' '-d' '-l' '-A'\n>> '--unpack-unreachable=2.weeks.ago'\n>> trace: built-in: git 'repack' '-d' '-l' '-A'\n>> '--unpack-unreachable=2.weeks.ago'\n>> trace: run_command: 'pack-objects' '--keep-true-parents'\n>> '--honor-pack-keep' '--non-empty' '--all' '--reflog'\n>> '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset'\n>> '.git/objects/pack/.tmp-7612-pack'\n>> trace: built-in: git 'pack-objects' '--keep-true-parents'\n>> '--honor-pack-keep' '--non-empty' '--all' '--reflog'\n>> '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset'\n>> '.git/objects/pack/.tmp-7612-pack'\n>> Counting objects: 139, done.\n>> Delta compression using up to 8 threads.\n>> Compressing objects: 100% (71/71), done.\n>> Writing objects: 100% (139/139), done.\n>> Total 139 (delta 65), reused 139 (delta 65)\n>> fatal: renaming\n>> '.git/objects/pack/.tmp-7612-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack'\n>> failed: Permission denied\n>> error: failed to run repack\n>>\n>> After running git gc twice, this is what is left in .git/objects/pack/:\n>>\n>> U:\\GitEnv\\.git\\objects\\pack>ls -al\n>> total 53676\n>> drwxr-xr-x    1 hgj2fe   Administ        0 Jan 16 10:43 .\n>> drwxr-xr-x    1 hgj2fe   Administ        0 Jan 14 12:52 ..\n>> -r--r--r--    1 hgj2fe   Administ     4964 Jan 16 10:43\n>> .tmp-7612-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.idx\n>> -r--r--r--    1 hgj2fe   Administ 18315618 Jan 16 10:43\n>> .tmp-7612-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack\n>> -r--r--r--    1 hgj2fe   Administ     4964 Jan 16 10:40\n>> .tmp-7920-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.idx\n>> -r--r--r--    1 hgj2fe   Administ 18315618 Jan 16 10:40\n>> .tmp-7920-pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack\n>> -r--r--r--    1 hgj2fe   Administ     4964 Jan 14 12:52\n>> pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.idx\n>> -r--r--r--    1 hgj2fe   Administ 18315618 Jan 14 12:52\n>> pack-ad9d069e7c27ce19cc5b6cde82b4a38bedbf5884.pack\n>>\n>> In case we remove the read-only flag of the pack and index manually\n>> before running git gc again, no problem occurs:\n>>\n>> U:\\GitEnv\\.git\\objects\\pack>git gc\n>> trace: built-in: git 'gc'\n>> trace: run_command: 'pack-refs' '--all' '--prune'\n>> trace: built-in: git 'pack-refs' '--all' '--prune'\n>> trace: run_command: 'reflog' 'expire' '--all'\n>> trace: built-in: git 'reflog' 'expire' '--all'\n>> trace: run_command: 'repack' '-d' '-l' '-A'\n>> '--unpack-unreachable=2.weeks.ago'\n>> trace: built-in: git 'repack' '-d' '-l' '-A'\n>> '--unpack-unreachable=2.weeks.ago'\n>> trace: run_command: 'pack-objects' '--keep-true-parents'\n>> '--honor-pack-keep' '--non-empty' '--all' '--reflog'\n>> '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset'\n>> 'U:/GitEnv/.git/objects/pack/.tmp-3736-pack'\n>> trace: built-in: git 'pack-objects' '--keep-true-parents'\n>> '--honor-pack-keep' '--non-empty' '--all' '--reflog'\n>> '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset'\n>> 'U:/GitEnv/.git/objects/pack/.tmp-3736-pack'\n>> Counting objects: 139, done.\n>> Delta compression using up to 8 threads.\n>> Compressing objects: 100% (71/71), done.\n>> Writing objects: 100% (139/139), done.\n>> Total 139 (delta 65), reused 139 (delta 65)\n>> trace: run_command: 'prune-packed'\n>> trace: built-in: git 'prune-packed'\n>> trace: run_command: 'update-server-info'\n>> trace: built-in: git 'update-server-info'\n>> trace: run_command: 'prune' '--expire' '2.weeks.ago'\n>> trace: built-in: git 'prune' '--expire' '2.weeks.ago'\n>> trace: run_command: 'rerere' 'gc'\n>> trace: built-in: git 'rerere' 'gc'\n>>\n>> The problem might be related to this commit:\n>> https://github.com/msysgit/git/commit/a1bbc6c0176f1fa2d4aa571cc0183a1f0ff9b285\n>>\n>>\n>> Best regards,\n>>\n>> Jochen\n> ------\n>>\n>>\n>> Am Freitag, 17. Januar 2014 19:02:07 UTC+1 schrieb Torsten Bögershausen:\n>>\n>>\n>>     So, please, what happens if you revert that commit?\n>>     It could be good if you can test it and share the results with the list\n>>     /Torsten\n>>\n>>\n>> Instead of reverting we did some more analysis.\n>>\n>> In repack.c we found the following code:\n>>\n>>         /* Now the ones with the same name are out of the way... */\n>>         for_each_string_list_item(item, &names) {\n>>                 for (ext = 0; ext < 2; ext++) {\n>>                         char *fname, *fname_old;\n>>                         struct stat statbuffer;\n>>                         fname = mkpathdup(\"%s/pack-%s%s\",\n>>                                         packdir, item->string, exts[ext]);\n>>                         fname_old = mkpathdup(\"%s-%s%s\",\n>>                                         packtmp, item->string, exts[ext]);\n>>                         if (!stat(fname_old, &statbuffer)) {\n>>                                 statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);\n>>                                 chmod(fname_old, statbuffer.st_mode);\n>>                         }\n>>                         if (rename(fname_old, fname))\n>>                                 die_errno(_(\"renaming '%s' failed\"), fname_old);\n>>                         free(fname);\n>>                         free(fname_old);\n>>                 }\n>>         }\n>>\n>> The rename command replaces a mv -f command of the original shell script. Obviously the -f option can also override a read-only file but rename can not on a network share.\n>>\n>> We changed the code as followed:\n>>\n>>         /* Now the ones with the same name are out of the way... */\n>>         for_each_string_list_item(item, &names) {\n>>                 for (ext = 0; ext < 2; ext++) {\n>>                         char *fname, *fname_old;\n>>                         struct stat statbuffer;\n>>                         fname = mkpathdup(\"%s/pack-%s%s\",\n>>                                         packdir, item->string, exts[ext]);\n>>                         fname_old = mkpathdup(\"%s-%s%s\",\n>>                                         packtmp, item->string, exts[ext]);\n>>                         if (!stat(fname_old, &statbuffer)) {\n>>                                 statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);\n>>                                 chmod(fname_old, statbuffer.st_mode);\n>>                         }\n>> +++                         if (!stat(fname, &statbuffer)) {\n>> +++                                 statbuffer.st_mode |= (S_IWUSR | S_IWGRP | S_IWOTH);\n>> +++                                 chmod(fname, statbuffer.st_mode);\n>> +++                         }\n>>                         if (rename(fname_old, fname))\n>>                                 die_errno(_(\"renaming '%s' failed\"), fname_old);\n>>                         free(fname);\n>>                         free(fname_old);\n>>                 }\n>>         }\n>>\n>> Before rename is called the destination file is made writeable. This worked for us. We are not sure if this is a good implementation.\n> \n> Jochen,\n> thanks for sharing the code changes with us.\n> \n> I allowed me to \n> a) reconstruct the original mail,\n> b) add \"+++\" at the places where you added the stat() and chmod(),\n> c) and to send the question \"is this a good implementation ?\" to upstream git.\n> \n> I think your implementation makes sense.\n> /Torsten\n>  \n> \n\nI'm sorry for breaking repack there. The implementation sounds\nreasonably to me.\n\nThanks for reporting.\nDo you want to prepare an upstream patch?\n\nThanks,\nStefan\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"},{"id":"233422","messageId":"alpine.DEB.1.00.1401210002080.14982@s15462909.onlinehome-server.info","threadId":"35697","inReplyTo":"52DD59E0.4090301@web.de","subject":"Re: [msysGit] Consecutive git gc fails on Windows network share","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2014-01-20T23:25:22Z","receivedAt":"2014-01-20T23:25:22Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Torsten,\n\nOn Mon, 20 Jan 2014, Torsten Bögershausen wrote:\n\n> (No top-posting, please see my comments below)\n\nalready very good! For extra brownie points, just edit the quoted part to\nreflect the abridged version needed to understand the context.\n\n> On 2014-01-20 15.02, Jochen wrote:\n> >On 01/16/2014 10:55 AM, Jochen Haag wrote:\n> > The rename command replaces a mv -f command of the original shell script. Obviously the -f option can also override a read-only file but rename can not on a network share.\n> \n> I allowed me to \n> a) reconstruct the original mail,\n\nPlease note that together with an exceedingly flakey internet connection,\nnot only having to scroll through the mail (most of which was actually not\nrelevant to your reply) and having to delete most parts again ate up my\ncomplete Git time budget for today. Just something you might want to keep\nin mind.\n\n> b) add \"+++\" at the places where you added the stat() and chmod(),\n> c) and to send the question \"is this a good implementation ?\" to upstream git.\n>\n> I think your implementation makes sense.\n\nAs I said in my other reply, I think that the problem would be addressed\nmore generally in compat/mingw.c. It is to be doubted highly that upstream\nwants to handle cases such as \"rename() cannot overwrite read-only files\non Windows\" everywhere they call rename() because the platforms upstream\ncares about do not have that problem.\n\nSo we probably need just the same _wchmod we have in mingw_unlink also in\nmingw_rename.\n\nCiao,\nJohannes"},{"id":"233423","messageId":"CABPQNSafcpACtWGBenE8vAe_XEvJ=5_sxLw8PztrnWp1xJAcjw@mail.gmail.com","threadId":"35697","inReplyTo":"alpine.DEB.1.00.1401210002080.14982@s15462909.onlinehome-server.info","subject":"Re: Consecutive git gc fails on Windows network share","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-01-20T23:53:29Z","receivedAt":"2014-01-20T23:53:29Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, Jan 21, 2014 at 12:25 AM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>\n> On Mon, 20 Jan 2014, Torsten Bögershausen wrote:\n>\n>> b) add \"+++\" at the places where you added the stat() and chmod(),\n>> c) and to send the question \"is this a good implementation ?\" to upstream git.\n>>\n>> I think your implementation makes sense.\n>\n> As I said in my other reply, I think that the problem would be addressed\n> more generally in compat/mingw.c. It is to be doubted highly that upstream\n> wants to handle cases such as \"rename() cannot overwrite read-only files\n> on Windows\" everywhere they call rename() because the platforms upstream\n> cares about do not have that problem.\n\nI'm not so sure. A quick test shows me that this is not the case for\nNTFS. Since this is over a network-share, the problem is probably\nserver-side, and can affect other systems as well.\n\nSo a work-around might be appropriate for all systems, no?\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"},{"id":"233442","messageId":"alpine.DEB.1.00.1401211755330.14982@s15462909.onlinehome-server.info","threadId":"35697","inReplyTo":"CABPQNSafcpACtWGBenE8vAe_XEvJ=5_sxLw8PztrnWp1xJAcjw@mail.gmail.com","subject":"Re: Consecutive git gc fails on Windows network share","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2014-01-21T16:57:59Z","receivedAt":"2014-01-21T16:57:59Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi kusma,\n\nOn Tue, 21 Jan 2014, Erik Faye-Lund wrote:\n\n> On Tue, Jan 21, 2014 at 12:25 AM, Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n> >\n> > On Mon, 20 Jan 2014, Torsten Bögershausen wrote:\n> >\n> >> b) add \"+++\" at the places where you added the stat() and chmod(),\n> >> c) and to send the question \"is this a good implementation ?\" to upstream git.\n> >>\n> >> I think your implementation makes sense.\n> >\n> > As I said in my other reply, I think that the problem would be\n> > addressed more generally in compat/mingw.c. It is to be doubted highly\n> > that upstream wants to handle cases such as \"rename() cannot overwrite\n> > read-only files on Windows\" everywhere they call rename() because the\n> > platforms upstream cares about do not have that problem.\n> \n> I'm not so sure. A quick test shows me that this is not the case for\n> NTFS. Since this is over a network-share, the problem is probably\n> server-side, and can affect other systems as well.\n> \n> So a work-around might be appropriate for all systems, no?\n\nI do not think that the problem occurs if you run the same commands on\nLinux, on a mounted Samba share. So I guess that upstream Git can enjoy\ntheir luxury of not having to care.\n\nIn any case, if we would need this also for Linux, doing it for only one\nuser of rename() would probably not be good enough, either... so something\nsimilar to mingw_rename() would be needed (interfering with mingw_rename\nitself, of course).\n\nCiao,\nDscho\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"},{"id":"233443","messageId":"CABPQNSZ5F5osOJzBbA7Q1Rbr2fcoJ7E_ZQwbQeVJwAd_3s1vvg@mail.gmail.com","threadId":"35697","inReplyTo":"alpine.DEB.1.00.1401211755330.14982@s15462909.onlinehome-server.info","subject":"Re: Consecutive git gc fails on Windows network share","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-01-21T17:03:30Z","receivedAt":"2014-01-21T17:03:30Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, Jan 21, 2014 at 5:57 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi kusma,\n>\n> On Tue, 21 Jan 2014, Erik Faye-Lund wrote:\n>\n>> On Tue, Jan 21, 2014 at 12:25 AM, Johannes Schindelin\n>> <Johannes.Schindelin@gmx.de> wrote:\n>> >\n>> > On Mon, 20 Jan 2014, Torsten Bögershausen wrote:\n>> >\n>> >> b) add \"+++\" at the places where you added the stat() and chmod(),\n>> >> c) and to send the question \"is this a good implementation ?\" to upstream git.\n>> >>\n>> >> I think your implementation makes sense.\n>> >\n>> > As I said in my other reply, I think that the problem would be\n>> > addressed more generally in compat/mingw.c. It is to be doubted highly\n>> > that upstream wants to handle cases such as \"rename() cannot overwrite\n>> > read-only files on Windows\" everywhere they call rename() because the\n>> > platforms upstream cares about do not have that problem.\n>>\n>> I'm not so sure. A quick test shows me that this is not the case for\n>> NTFS. Since this is over a network-share, the problem is probably\n>> server-side, and can affect other systems as well.\n>>\n>> So a work-around might be appropriate for all systems, no?\n>\n> I do not think that the problem occurs if you run the same commands on\n> Linux, on a mounted Samba share. So I guess that upstream Git can enjoy\n> their luxury of not having to care.\n>\n> In any case, if we would need this also for Linux, doing it for only one\n> user of rename() would probably not be good enough, either... so something\n> similar to mingw_rename() would be needed (interfering with mingw_rename\n> itself, of course).\n>\n\nIndeed. I was thinking of something along the lines of adding a\nxrename in wrapper.c.\n\nBut you're probably right that this doesn't happen under Samba; surely\nSamba would have added a work-around for such a filesystem by now. So\nyeah, you've convinced me. mingw_rename is probably the place to do\nthat.\n\nThe work-around would probably look something like this:\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex a37bbf3..580b820 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1697,6 +1697,14 @@ int mingw_rename(const char *pold, const char *pnew)\n      */\n     if (!_wrename(wpold, wpnew))\n         return 0;\n+\n+    if (errno == EPERM) {\n+        /* read-only files cannot be moved over on network shares */\n+        _wchmod(wpnew, 0666);\n+        if (!_wrename(wpold, wpnew))\n+            return 0;\n+    }\n+\n     if (errno != EEXIST)\n         return -1;\n repeat:\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/groups/opt_out.\n"}]}