git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal
       [not found] ` <b9cf9e2168c3b2476bb5bb134a1528be@www.dscho.org>
@ 2015-08-12 17:43   ` Johannes Sixt
  2015-08-12 17:56     ` Jeff King
  2015-08-13  7:32     ` Johannes Schindelin
  0 siblings, 2 replies; 7+ messages in thread
From: Johannes Sixt @ 2015-08-12 17:43 UTC (permalink / raw)
  To: Git Mailing List; +Cc: msysGit

27e1e22d (prune: factor out loose-object directory traversal, 2014-10-16)
introduced a new function for_each_loose_file_in_objdir() with a helper
for_each_file_in_obj_subdir(). The latter calls callbacks for each file
found during a directory traversal and finally also a callback for the
directory itself.

git-prune uses the function to clean up the object directory. In
particular, in the directory callback it calls rmdir(). On Windows XP,
this rmdir call fails, because the directory is still open while the
callback is called. Close the directory before calling the callback.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 My Windows 8.1 machine does not require this fix for some unkonwn
 reason. But we still cater for Windows XP users, where this change
 is a real improvement.

 sha1_file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sha1_file.c b/sha1_file.c
index 4d1b26f..5cecc68 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -3473,12 +3473,12 @@ static int for_each_file_in_obj_subdir(int subdir_nr,
 				break;
 		}
 	}
+	closedir(dir);
+
 	strbuf_setlen(path, baselen);
-
 	if (!r && subdir_cb)
 		r = subdir_cb(subdir_nr, path->buf, data);
 
-	closedir(dir);
 	return r;
 }
 
-- 
2.3.2.245.gb5bf9d3

-- 
-- 
*** 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 "Git for Windows" 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.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal
  2015-08-12 17:43   ` [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal Johannes Sixt
@ 2015-08-12 17:56     ` Jeff King
  2015-12-11 19:37       ` Junio C Hamano
  2015-08-13  7:32     ` Johannes Schindelin
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff King @ 2015-08-12 17:56 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List, msysGit

On Wed, Aug 12, 2015 at 07:43:01PM +0200, Johannes Sixt wrote:

> 27e1e22d (prune: factor out loose-object directory traversal, 2014-10-16)
> introduced a new function for_each_loose_file_in_objdir() with a helper
> for_each_file_in_obj_subdir(). The latter calls callbacks for each file
> found during a directory traversal and finally also a callback for the
> directory itself.
> 
> git-prune uses the function to clean up the object directory. In
> particular, in the directory callback it calls rmdir(). On Windows XP,
> this rmdir call fails, because the directory is still open while the
> callback is called. Close the directory before calling the callback.

Makes sense, and the patch looks good to me. Sorry for breaking things
on Windows.

Acked-by: Jeff King <peff@peff.net>

-Peff

-- 
-- 
*** 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 "Git for Windows" 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal
  2015-08-12 17:43   ` [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal Johannes Sixt
  2015-08-12 17:56     ` Jeff King
@ 2015-08-13  7:32     ` Johannes Schindelin
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2015-08-13  7:32 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List, msysGit

Hi,

On 2015-08-12 19:43, Johannes Sixt wrote:
> 27e1e22d (prune: factor out loose-object directory traversal, 2014-10-16)
> introduced a new function for_each_loose_file_in_objdir() with a helper
> for_each_file_in_obj_subdir(). The latter calls callbacks for each file
> found during a directory traversal and finally also a callback for the
> directory itself.
> 
> git-prune uses the function to clean up the object directory. In
> particular, in the directory callback it calls rmdir(). On Windows XP,
> this rmdir call fails, because the directory is still open while the
> callback is called. Close the directory before calling the callback.
> 
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
>  My Windows 8.1 machine does not require this fix for some unkonwn
>  reason. But we still cater for Windows XP users, where this change
>  is a real improvement.

I believe that we have a concrete bug report for that:

    https://github.com/git-for-windows/git/issues/231

Ciao,
Johannes

-- 
-- 
*** 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 "Git for Windows" 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal
  2015-08-12 17:56     ` Jeff King
@ 2015-12-11 19:37       ` Junio C Hamano
  2015-12-11 19:41         ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2015-12-11 19:37 UTC (permalink / raw)
  To: Jeff King; +Cc: Johannes Sixt, Git Mailing List, msysGit, Johannes Schindelin

Jeff King <peff@peff.net> writes:

> On Wed, Aug 12, 2015 at 07:43:01PM +0200, Johannes Sixt wrote:
>
>> 27e1e22d (prune: factor out loose-object directory traversal, 2014-10-16)
>> introduced a new function for_each_loose_file_in_objdir() with a helper
>> for_each_file_in_obj_subdir(). The latter calls callbacks for each file
>> found during a directory traversal and finally also a callback for the
>> directory itself.
>> 
>> git-prune uses the function to clean up the object directory. In
>> particular, in the directory callback it calls rmdir(). On Windows XP,
>> this rmdir call fails, because the directory is still open while the
>> callback is called. Close the directory before calling the callback.
>
> Makes sense, and the patch looks good to me. Sorry for breaking things
> on Windows.
>
> Acked-by: Jeff King <peff@peff.net>

Sorry for reviving this old thread, but I noticed that we do not
have this patch in our tree yet.  I'll queue to 'pu' for now lest I
forget.  If I missed a good argument or concensus against the change
please let me know, otherwise I'll fast track the change to 2.7 final

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal
  2015-12-11 19:37       ` Junio C Hamano
@ 2015-12-11 19:41         ` Jeff King
  2015-12-13 13:26           ` Johannes Schindelin
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff King @ 2015-12-11 19:41 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Sixt, Git Mailing List, msysGit, Johannes Schindelin

On Fri, Dec 11, 2015 at 11:37:54AM -0800, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > On Wed, Aug 12, 2015 at 07:43:01PM +0200, Johannes Sixt wrote:
> >
> >> 27e1e22d (prune: factor out loose-object directory traversal, 2014-10-16)
> >> introduced a new function for_each_loose_file_in_objdir() with a helper
> >> for_each_file_in_obj_subdir(). The latter calls callbacks for each file
> >> found during a directory traversal and finally also a callback for the
> >> directory itself.
> >> 
> >> git-prune uses the function to clean up the object directory. In
> >> particular, in the directory callback it calls rmdir(). On Windows XP,
> >> this rmdir call fails, because the directory is still open while the
> >> callback is called. Close the directory before calling the callback.
> >
> > Makes sense, and the patch looks good to me. Sorry for breaking things
> > on Windows.
> >
> > Acked-by: Jeff King <peff@peff.net>
> 
> Sorry for reviving this old thread, but I noticed that we do not
> have this patch in our tree yet.  I'll queue to 'pu' for now lest I
> forget.  If I missed a good argument or concensus against the change
> please let me know, otherwise I'll fast track the change to 2.7 final

Ah, thanks for doing that. I noticed it when picking through "git branch
--no-merged pu" of your workspace a few weeks ago, but forgot to follow
up. I certainly have no objections.

-Peff

-- 
-- 
*** 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 "Git for Windows" 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal
  2015-12-11 19:41         ` Jeff King
@ 2015-12-13 13:26           ` Johannes Schindelin
  2015-12-14 19:02             ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2015-12-13 13:26 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, Johannes Sixt, Git Mailing List, msysGit

Hi Junio & Peff,

On Fri, 11 Dec 2015, Jeff King wrote:

> On Fri, Dec 11, 2015 at 11:37:54AM -0800, Junio C Hamano wrote:
> 
> > Jeff King <peff@peff.net> writes:
> > 
> > > On Wed, Aug 12, 2015 at 07:43:01PM +0200, Johannes Sixt wrote:
> > >
> > >> 27e1e22d (prune: factor out loose-object directory traversal, 2014-10-16)
> > >> introduced a new function for_each_loose_file_in_objdir() with a helper
> > >> for_each_file_in_obj_subdir(). The latter calls callbacks for each file
> > >> found during a directory traversal and finally also a callback for the
> > >> directory itself.
> > >> 
> > >> git-prune uses the function to clean up the object directory. In
> > >> particular, in the directory callback it calls rmdir(). On Windows XP,
> > >> this rmdir call fails, because the directory is still open while the
> > >> callback is called. Close the directory before calling the callback.
> > >
> > > Makes sense, and the patch looks good to me. Sorry for breaking things
> > > on Windows.
> > >
> > > Acked-by: Jeff King <peff@peff.net>
> > 
> > Sorry for reviving this old thread, but I noticed that we do not
> > have this patch in our tree yet.  I'll queue to 'pu' for now lest I
> > forget.  If I missed a good argument or concensus against the change
> > please let me know, otherwise I'll fast track the change to 2.7 final
> 
> Ah, thanks for doing that. I noticed it when picking through "git branch
> --no-merged pu" of your workspace a few weeks ago, but forgot to follow
> up. I certainly have no objections.

Git for Windows carries this patch since Git for Windows v2.5.0. So: no
objection from my side, either.

Ciao,
Dscho

-- 
-- 
*** 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 "Git for Windows" 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal
  2015-12-13 13:26           ` Johannes Schindelin
@ 2015-12-14 19:02             ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2015-12-14 19:02 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Jeff King, Johannes Sixt, Git Mailing List, msysGit

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> > Sorry for reviving this old thread, but I noticed that we do not
>> > have this patch in our tree yet.  I'll queue to 'pu' for now lest I
>> > forget.  If I missed a good argument or concensus against the change
>> > please let me know, otherwise I'll fast track the change to 2.7 final
>> 
>> Ah, thanks for doing that. I noticed it when picking through "git branch
>> --no-merged pu" of your workspace a few weeks ago, but forgot to follow
>> up. I certainly have no objections.
>
> Git for Windows carries this patch since Git for Windows v2.5.0. So: no
> objection from my side, either.

Thanks!

-- 
-- 
*** 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 "Git for Windows" 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-14 19:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <55CA5EB0.1000308@kdbg.org>
     [not found] ` <b9cf9e2168c3b2476bb5bb134a1528be@www.dscho.org>
2015-08-12 17:43   ` [PATCH jk/prune-mtime] prune: close directory earlier during loose-object directory traversal Johannes Sixt
2015-08-12 17:56     ` Jeff King
2015-12-11 19:37       ` Junio C Hamano
2015-12-11 19:41         ` Jeff King
2015-12-13 13:26           ` Johannes Schindelin
2015-12-14 19:02             ` Junio C Hamano
2015-08-13  7:32     ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).