Thread (21 messages) flat view 21 messages, 9 authors, 2016-06-15

Re: git-commit fatal: Out of memory? mmap failed: Bad file descriptor

From: Brandon Casey <hidden>
Date: 2016-06-15 22:44:05
Subsystem: the rest · Maintainer: Linus Torvalds

Linus Torvalds wrote:
On Tue, 15 Jan 2008, Brandon Casey wrote:
quoted
Linus Torvalds wrote:
quoted
It would obviously be interesting to see the base repository and the 
commit you are trying to do - is that possibly publicly available?
I wish it was.
It's ok, I found the bug in your full strace.
Good catch, but that wasn't it. Still getting the same error.
and now it's trying to close that fd *again*
In that same vein, just above your changes in prepare_index() is:

	if (!pathspec || !*pathspec) {
		fd = hold_locked_index(&index_lock, 1);
		refresh_cache(REFRESH_QUIET);
		if (write_cache(fd, active_cache, active_nr) ||
		    close(fd) || commit_locked_index(&index_lock))
			die("unable to write new_index file");
		commit_style = COMMIT_AS_IS;
		return get_index_file();
	}

If I followed hold_locked_index() correctly, then fd and index_lock.fd
are equal, and commit_locked_index() does a close(lk->fd) making the
close(fd) above, redundant (or vice-versa).

Probably not causing the error at hand, but not good.

-brandon

diff --git a/builtin-commit.c b/builtin-commit.c
index 1e55c2e..3b4f4e2 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -256,7 +256,7 @@ static char *prepare_index(int argc, const char **argv, cons
		fd = hold_locked_index(&index_lock, 1);
		refresh_cache(REFRESH_QUIET);
		if (write_cache(fd, active_cache, active_nr) ||
-		    close(fd) || commit_locked_index(&index_lock))
+		    commit_locked_index(&index_lock))
			die("unable to write new_index file");
		commit_style = COMMIT_AS_IS;
		return get_index_file();
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help