From: Kazuki Tsujimoto <kazuki@callcc.net>
To: git@vger.kernel.org
Subject: [BUG] realloc failed
Date: Sat, 21 May 2011 10:01:32 +0900 [thread overview]
Message-ID: <20110521100126.E3CD.BA9123DE@callcc.net> (raw)
The following command causes "fatal: Out of memory, realloc failed" error.
$ ./git --version
git version 1.7.5.GIT
$ cat ~/.gitconfig
[alias]
a = -c n=v status
$ MALLOC_CHECK_=0 ./git a
fatal: Out of memory, realloc failed
$ gdb --args ./git a
(gdb) run
*** glibc detected *** /tmp/git/git: realloc(): invalid pointer: 0x00000000007cd328 ***
...snip...
(gdb) bt
#0 0x00007ffff72c8a75 in raise () from /lib/libc.so.6
#1 0x00007ffff72cc5c0 in abort () from /lib/libc.so.6
#2 0x00007ffff73024fb in ?? () from /lib/libc.so.6
#3 0x00007ffff730c5b6 in ?? () from /lib/libc.so.6
#4 0x00007ffff73132e2 in realloc () from /lib/libc.so.6
#5 0x0000000000510bfb in xrealloc (ptr=0x7cd328, size=16) at wrapper.c:82
#6 0x0000000000405013 in handle_alias (argcp=0x7fffffffdfdc, argv=0x7fffffffdfd0) at git.c:236
#7 0x000000000040550a in run_argv (argcp=0x7fffffffdfdc, argv=0x7fffffffdfd0) at git.c:515
#8 0x000000000040566a in main (argc=1, argv=0x7fffffffe0f0) at git.c:579
When the "-c" option is specified, setenv will be called in git_config_push_parameter.
So it seems "envchanged" flag must be set to true in this case.
git.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git.c b/git.c
index a5ef3c6..e04e4d4 100644
--- a/git.c
+++ b/git.c
@@ -153,6 +153,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
usage(git_usage_string);
}
git_config_push_parameter((*argv)[1]);
+ if (envchanged)
+ *envchanged = 1;
(*argv)++;
(*argc)--;
} else {
After applying this patch, it works.
$ ./git a
fatal: alias 'a' changes environment variables
You can use '!git' in the alias to do this.
$ vi ~/.gitconfig
[alias]
a = !git -c n=v status
~~~~
$ ./git a
# On branch master
nothing to commit (working directory clean)
--
Kazuki Tsujimoto
next reply other threads:[~2011-05-21 1:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-21 1:01 Kazuki Tsujimoto [this message]
2011-05-21 1:35 ` [BUG] realloc failed Junio C Hamano
2011-05-21 5:50 ` Kazuki Tsujimoto
2011-05-22 19:34 ` Junio C Hamano
2011-05-22 19:42 ` Junio C Hamano
2011-05-27 13:59 ` Kazuki Tsujimoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110521100126.E3CD.BA9123DE@callcc.net \
--to=kazuki@callcc.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).