{"thread":{"id":"36640","subject":"Bug - Git reset --quiet not quiet","startedAt":"2014-05-12T19:16:33Z","lastAt":"2014-05-13T09:42:08Z","messageCount":4,"participants":["Thomas-Louis Laforest","Erik Faye-Lund","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"241309","messageId":"764966de191443d68e7ceca790b641ff@CO1PR02MB029.namprd02.prod.outlook.com","threadId":"36640","inReplyTo":null,"subject":"Bug - Git reset --quiet not quiet","fromName":"Thomas-Louis Laforest","fromEmail":"tllaforest@arbault.ca","sentAt":"2014-05-12T19:16:33Z","receivedAt":"2014-05-12T19:16:33Z","isPatch":false,"sender":{"key":"tllaforest@arbault.ca","avatar":null},"body":"Good afternoon,\n\nWhen running this command on Git for Windows (version 1.9.2-preview20140411)\ngit reset --quiet --hard with one file having read/write lock git ask this question : \nUnlink of file 'XXXX' failed. Should I try again? (y/n)\n\nI will have expected the command --quiet to remove the question and auto-answer no.\nThis broke an automated script we use.\n\nGood day\n\nThomas-Louis Laforest, ing. jr, Jr. Eng.\nChargé de projet, Project Leader\nsolutions intégrées  |  integrated solutions\nT 819 542-5600  x3106\nF 819 845-5600\ntllaforest@arbault.ca\nThe information contained herein is of private and confidential nature. It can be used only by the above-mentioned recipients. Any other person who would take note of it is advised that it is strictly forbidden for him to reveal the information, to distribute it or to copy it. If this communication were transmitted to you by mistake, warn us immediately by telephone or email, and erase the original, without taking a copy, revealing the content nor taking some measures based on it.\nLes renseignements contenus dans les présentes sont de nature privée et confidentielle. Ils ne peuvent être utilisés que par le ou les destinataires susmentionnés. Toute autre personne qui en prendrait connaissance est priée de noter qu'il lui est strictement interdit de les divulguer, de les distribuer ou de les copier. Si cette communication vous a été transmise par mégarde, veuillez nous en aviser immédiatement par téléphone ou par courriel, et effacer l'original, sans en tirer de copie, en dévoiler le contenu ni prendre quelque mesure fondée sur celui-ci.\n"},{"id":"241342","messageId":"CABPQNSaj3xwknXsrYnF35tcDAmTwK5KALOsUOgHF_hrEf2H_+g@mail.gmail.com","threadId":"36640","inReplyTo":"764966de191443d68e7ceca790b641ff@CO1PR02MB029.namprd02.prod.outlook.com","subject":"Re: Bug - Git reset --quiet not quiet","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-05-13T09:09:43Z","receivedAt":"2014-05-13T09:09:43Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, May 12, 2014 at 9:16 PM, Thomas-Louis Laforest\n<tllaforest@arbault.ca> wrote:\n> Good afternoon,\n>\n> When running this command on Git for Windows (version 1.9.2-preview20140411)\n> git reset --quiet --hard with one file having read/write lock git ask this question :\n> Unlink of file 'XXXX' failed. Should I try again? (y/n)\n>\n> I will have expected the command --quiet to remove the question and auto-answer no.\n> This broke an automated script we use.\n\nThanks for reporting this.\n\nThe problem here is really a nasty case of layering: the question\ncomes from a place deep inside the OS compatibility layer, which\ndoesn't know about the --quiet flag.\n\nHowever, do note that if fixed, the command would still fail under\nthese conditions. But it won't hang forever, as it does now.\n\nMainline Git-folks: The problem here is essentially unlink returning\nEBUSY (although that's not *exactly* what happes - but it's close\nenough, implementation details in mingw_unlink), which most of the git\ncodebase assume won't happen. On Windows, this happens *all* the time,\nusually due to antivirus-software scanning a newly written file. We\ncurrently retry a few times with some waiting in mingw_unlink, and\nthen finally prompts the user. But this gives the problem described\nabove, as mingw_unlink has no clue about --quiet.\n\nI guess this could be solved in a few ways.\n1) Let mingw_unlink() know about the quiet-flag. This probably\ninvolves moving the quiet-flag from each tool into libgit.a.\n2) Make the quiet-flags close stdout instead of suppressing every output.\n3) Make the higher level call-sites of Git EBUSY-aware. This probably\ninvolves making an interactive convenience-wrapper of unlink, that\naccepts a quiet flag - similar to what mingw_unlink does.\n\nOption 1) seems quite error-prone to me - it's difficult to make sure\nall code-paths actually set this flag, so there's a good chance of\nregressions. Option 2) also sounds a bit risky, as we lose stdout\nforever, with no escape-hatch. So to me option 3) seems preferable\nalthough it might translate into a bit of churn. Thoughts?\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/d/optout.\n"},{"id":"241343","messageId":"5371E818.1090001@viscovery.net","threadId":"36640","inReplyTo":"CABPQNSaj3xwknXsrYnF35tcDAmTwK5KALOsUOgHF_hrEf2H_+g@mail.gmail.com","subject":"Re: Bug - Git reset --quiet not quiet","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2014-05-13T09:38:32Z","receivedAt":"2014-05-13T09:38:32Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/13/2014 11:09, schrieb Erik Faye-Lund:\n> On Mon, May 12, 2014 at 9:16 PM, Thomas-Louis Laforest\n> <tllaforest@arbault.ca> wrote:\n>> When running this command on Git for Windows (version 1.9.2-preview20140411)\n>> git reset --quiet --hard with one file having read/write lock git ask this question :\n>> Unlink of file 'XXXX' failed. Should I try again? (y/n)\n>>\n>> I will have expected the command --quiet to remove the question and auto-answer no.\n>> This broke an automated script we use.\n...\n> I guess this could be solved in a few ways.\n> 1) Let mingw_unlink() know about the quiet-flag. This probably\n> involves moving the quiet-flag from each tool into libgit.a.\n> 2) Make the quiet-flags close stdout instead of suppressing every output.\n> 3) Make the higher level call-sites of Git EBUSY-aware. This probably\n> involves making an interactive convenience-wrapper of unlink, that\n> accepts a quiet flag - similar to what mingw_unlink does.\n\nIs any of this really needed? We have this in ask_yes_no_if_possible():\n\n\tif (!isatty(_fileno(stdin)) || !isatty(_fileno(stderr)))\n\t\treturn 0;\n\ni.e., we answer \"no\" automatically without asking if at least one of stdin\nand stderr are not a terminal. Perhaps the OP's problem is that they do\nnot redirect these channels to files or something in their automated\nscripts? In particular, it should be sufficient to redirect stdin from\n/dev/null (a.k.a. \"nul\" on Windows).\n\n-- Hannes\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/d/optout.\n"},{"id":"241344","messageId":"CABPQNSbw335wEeDfc+3Jg2X+Zv2422vPf5P5Wwm8NWbuYPMVQA@mail.gmail.com","threadId":"36640","inReplyTo":"5371E818.1090001@viscovery.net","subject":"Re: Bug - Git reset --quiet not quiet","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-05-13T09:42:08Z","receivedAt":"2014-05-13T09:42:08Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, May 13, 2014 at 11:38 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 5/13/2014 11:09, schrieb Erik Faye-Lund:\n>> On Mon, May 12, 2014 at 9:16 PM, Thomas-Louis Laforest\n>> <tllaforest@arbault.ca> wrote:\n>>> When running this command on Git for Windows (version 1.9.2-preview20140411)\n>>> git reset --quiet --hard with one file having read/write lock git ask this question :\n>>> Unlink of file 'XXXX' failed. Should I try again? (y/n)\n>>>\n>>> I will have expected the command --quiet to remove the question and auto-answer no.\n>>> This broke an automated script we use.\n> ...\n>> I guess this could be solved in a few ways.\n>> 1) Let mingw_unlink() know about the quiet-flag. This probably\n>> involves moving the quiet-flag from each tool into libgit.a.\n>> 2) Make the quiet-flags close stdout instead of suppressing every output.\n>> 3) Make the higher level call-sites of Git EBUSY-aware. This probably\n>> involves making an interactive convenience-wrapper of unlink, that\n>> accepts a quiet flag - similar to what mingw_unlink does.\n>\n> Is any of this really needed? We have this in ask_yes_no_if_possible():\n>\n>         if (!isatty(_fileno(stdin)) || !isatty(_fileno(stderr)))\n>                 return 0;\n>\n> i.e., we answer \"no\" automatically without asking if at least one of stdin\n> and stderr are not a terminal. Perhaps the OP's problem is that they do\n> not redirect these channels to files or something in their automated\n> scripts? In particular, it should be sufficient to redirect stdin from\n> /dev/null (a.k.a. \"nul\" on Windows).\n\nWell, sure. But if sounds like surprising behavior to me. And I also\nsuspect doing this unconditionally on all platforms will fix strange\ncorner-cases on other systems, when using Windows file-systems. AFAIK,\nthe whole \"cannot delete an open file\"-thing is an NTFS-detail (and\npossibly also FAT, which is quite commonly used on non-Windows).\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/d/optout.\n"}]}