From: Junio C Hamano Date: Mon, 28 Feb 2011 20:38:56 GMT Subject: Re: [PATCH] Limit file descriptors used by packs Message-ID: <7vwrkjhp27.fsf@alter.siamese.dyndns.org> In-Reply-To: <1298924835-23413-1-git-send-email-spearce@spearce.org> "Shawn O. Pearce" writes: > ... The output file is opened by pack-objects after > object enumeration and delete compression are done, ... s/delete/deflate/, I guess. > diff --git a/sha1_file.c b/sha1_file.c > index d949b35..8863ff6 100644 > --- a/sha1_file.c > +++ b/sha1_file.c > @@ -708,9 +713,35 @@ static int open_packed_git_1(struct packed_git *p) > if (!p->index_data && open_pack_index(p)) > return error("packfile %s index unavailable", p->pack_name); > > + if (!pack_max_fds) { > + ... > + if (lim.rlim_cur < lim.rlim_max) { > + lim.rlim_cur = lim.rlim_max; > + if (!setrlimit(RLIMIT_NOFILE, &lim)) > + max_fds = lim.rlim_max; > + } This is somewhat questionable, isn't it? We don't know why the user chose to ulimit the process yet forcibly bust that limit without telling him? Other than that it looks sensible. Thanks.