git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug - Git reset --quiet not quiet

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
May 13, 2014, 09:09 UTC
Message-ID
<CABPQNSaj3xwknXsrYnF35tcDAmTwK5KALOsUOgHF_hrEf2H_+g@mail.gmail.com>
In-Reply-To
<764966de191443d68e7ceca790b641ff@CO1PR02MB029.namprd02.prod.outlook.com>

On Mon, May 12, 2014 at 9:16 PM, Thomas-Louis Laforest <tllaforest@arbault.ca> wrote:

Show 8 quoted lines
> Good afternoon,
>
> When running this command on Git for Windows (version 1.9.2-preview20140411)
> git reset --quiet --hard with one file having read/write lock git ask this question :
> Unlink of file 'XXXX' failed. Should I try again? (y/n)
>
> I will have expected the command --quiet to remove the question and auto-answer no.
> This broke an automated script we use.
Thanks for reporting this.

The problem here is really a nasty case of layering: the question comes from a place deep inside the OS compatibility layer, which doesn't know about the --quiet flag.

However, do note that if fixed, the command would still fail under these conditions. But it won't hang forever, as it does now.

Mainline Git-folks: The problem here is essentially unlink returning EBUSY (although that's not *exactly* what happes - but it's close enough, implementation details in mingw_unlink), which most of the git codebase assume won't happen. On Windows, this happens *all* the time, usually due to antivirus-software scanning a newly written file. We currently retry a few times with some waiting in mingw_unlink, and then finally prompts the user. But this gives the problem described above, as mingw_unlink has no clue about --quiet.

I guess this could be solved in a few ways.
1) Let mingw_unlink() know about the quiet-flag. This probably
involves moving the quiet-flag from each tool into libgit.a.
2) Make the quiet-flags close stdout instead of suppressing every output.
3) Make the higher level call-sites of Git EBUSY-aware. This probably
involves making an interactive convenience-wrapper of unlink, that
accepts a quiet flag - similar to what mingw_unlink does.

Option 1) seems quite error-prone to me - it's difficult to make sure all code-paths actually set this flag, so there's a good chance of regressions. Option 2) also sounds a bit risky, as we lose stdout forever, with no escape-hatch. So to me option 3) seems preferable although it might translate into a bit of churn. Thoughts?

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Previous: Thomas-Louis LaforestNext: Johannes Sixt
Message 2 of 4 in “Bug - Git reset --quiet not quiet”
  1. Thomas-Louis LaforestMay 12, 2014
  2. Erik Faye-LundMay 13, 2014
  3. Johannes SixtMay 13, 2014
  4. Erik Faye-LundMay 13, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.