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

Re: [PATCH] Fix 'git clean' failure on NFS.

From
Török Edwin <edwintorok@gmail.com>
Date
Jun 18, 2010, 13:09 UTC
Message-ID
<4C1B7026.2010501@gmail.com>
In-Reply-To
<4C1B63CB.7080209@viscovery.net>
On 06/18/2010 03:17 PM, Johannes Sixt wrote:
Show 11 quoted lines
> Am 6/18/2010 13:07, schrieb Török Edwin:
>>  		else if (S_ISDIR(st.st_mode)) {
>> -			if (!remove_dir_recursively(path, only_empty))
>> +			if (!remove_dir_recursively(path, only_empty)) {
>> +				did_rm = 1;
>>  				continue; /* happy */
> 
> Is it possible that remove_dir_recursively exits with 0, but it actually
> did not remove the directory? That would result in an endless loop: it
> would have to re-enter remove_dir_recursively on the next iteration,
> return 0 again (without removing the directory), next iteration, etc.
Hmm, I think this could cause problems:
	if ((flag & REMOVE_DIR_KEEP_NESTED_GIT) &&
	    !resolve_gitlink_ref(path->buf, "HEAD", submodule_head))
		/* Do not descend and nuke a nested git work tree. */
		return 0;

What if we limit the amount of times you can loop? The worst case is that you loop == number of files in the directory, if you loop more times than we could break out early.

Or we can compare the number of files listed in one pass, and in another. If they stay equal, we can break out (since we'd infloop), if it is higher (new files added) or lower (successfully removed some) we can keep looping.

How does that sound?
--Edwin
Previous: Johannes SixtNext: Erik Faye-Lund
Message 6 of 10 in “[BUG] git clean not working on FreeBSD/NFS”
  1. Török EdwinJun 17, 2010
  2. Henrik GrubbströmJun 17, 2010
  3. Török EdwinJun 18, 2010
  4. Fix 'git clean' failure on NFS.Török Edwin, Jun 18, 2010
  5. Johannes SixtJun 18, 2010
  6. Török EdwinJun 18, 2010
  7. Erik Faye-LundJun 18, 2010
  8. Török EdwinJun 18, 2010
  9. Erik Faye-LundJun 18, 2010
  10. Török EdwinJun 18, 2010

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.