-
Notifications
You must be signed in to change notification settings - Fork 106
Fix push on mac3 #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix push on mac3 #79
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,7 @@ struct child_process { | |
| unsigned use_shell:1; | ||
| unsigned clean_on_exit:1; | ||
| unsigned wait_after_clean:1; | ||
| unsigned close_parent_file_descriptors:1; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know about that name... I read it initially as all of the parent's file descriptors, but that is not true. For one, the fds that need to be inherited (because they are connected to a pipe so that the spawning process can talk to the spawned process) need to not be closed. And then, we only close file descriptors referring to files. If there is a socket open, the code typically still talks about "file" descriptors, but we do not close those. Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't think of anything better than 'close_parent_file_descriptors' - it doesn't say "all" file descriptors so someone will have to look at the code/commit/comments if they want to know which ones. :) |
||
| void (*clean_on_exit_handler)(struct child_process *process); | ||
| void *clean_on_exit_handler_cbdata; | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to upstream this, change
++fdtofd++. For some reason, the Git developers prefer this.About the magic
256... This sent me down a fun rabbit hole, thank you. The short version is that you should replace the constant bygetrlimit(RLIMIT_NOFILE, &fd_max_plus_one).But wait! Is
getrlimit()available everywhere? And even more importantly: does Git already use that function? Let's find out...git grep getrlimitto the rescue.Turns out that my short version was wrong: there is a
get_max_fd_limit()function inpackfile.c. What you will want to do is to move it to a more sensible place, declare it as a global function incache.h, and then use it also here.(BTW typically, the
RLIMIT_NOFILEvalue seems to be 1024... and beware:get_max_fd_limit()returns1as a fall-back, if there is no other available means to determine the value.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about the magic "3." I'd probably at least comment that you aren't closing stdin/out/err and why.