git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] shell: add missing initialization of argv0_path
@ 2011-05-01  6:06 Dima Sharov
  0 siblings, 0 replies; 4+ messages in thread
From: Dima Sharov @ 2011-05-01  6:06 UTC (permalink / raw)
  To: git

According to c6dfb39 (remote-curl: add missing initialization of
argv0_path, 2009-10-13), stand-alone programs (non-builtins)
must call git_extract_argv0_path(argv[0]) in order to help builds
that derive the installation prefix at runtime. Without this call,
the program segfaults (or raises an assertion failure).

Signed-off-by: Dima Sharov <git.avalakvista@gmail.com>
---
 shell.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/shell.c b/shell.c
index dea4cfd..abb8622 100644
--- a/shell.c
+++ b/shell.c
@@ -137,6 +137,8 @@ int main(int argc, char **argv)
 	int devnull_fd;
 	int count;
 
+	git_extract_argv0_path(argv[0]);
+
 	/*
 	 * Always open file descriptors 0/1/2 to avoid clobbering files
 	 * in die().  It also avoids not messing up when the pipes are
-- 
1.7.2.3

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

* [PATCH] shell: add missing initialization of argv0_path
@ 2011-05-05  6:40 Dima Sharov
  2011-05-05  6:58 ` Johannes Sixt
  0 siblings, 1 reply; 4+ messages in thread
From: Dima Sharov @ 2011-05-05  6:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

According to c6dfb39 (remote-curl: add missing initialization of
argv0_path, 2009-10-13), stand-alone programs (non-builtins)
must call git_extract_argv0_path(argv[0]) in order to help builds
that derive the installation prefix at runtime. Without this call,
the program segfaults (or raises an assertion failure).

Signed-off-by: Dima Sharov <git.avalakvista@gmail.com>
---
shell.c |    2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/shell.c b/shell.c
index dea4cfd..abb8622 100644
--- a/shell.c
+++ b/shell.c
@@ -137,6 +137,8 @@ int main(int argc, char **argv)
	int devnull_fd;
	int count;

+	git_extract_argv0_path(argv[0]);
+
	/*
	 * Always open file descriptors 0/1/2 to avoid clobbering files
	 * in die().  It also avoids not messing up when the pipes are
-- 
1.7.2.3

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

* Re: [PATCH] shell: add missing initialization of argv0_path
  2011-05-05  6:40 [PATCH] shell: add missing initialization of argv0_path Dima Sharov
@ 2011-05-05  6:58 ` Johannes Sixt
  2011-05-05 16:32   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Sixt @ 2011-05-05  6:58 UTC (permalink / raw)
  To: Dima Sharov; +Cc: Junio C Hamano, git

Am 5/5/2011 8:40, schrieb Dima Sharov:
> According to c6dfb39 (remote-curl: add missing initialization of
> argv0_path, 2009-10-13), stand-alone programs (non-builtins)
> must call git_extract_argv0_path(argv[0]) in order to help builds
> that derive the installation prefix at runtime. Without this call,
> the program segfaults (or raises an assertion failure).

Good catch! I checked PROGRAM_OBJS in Makefile, and shell.c was the only
one remaining that did not call this function.

-- Hannes

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

* Re: [PATCH] shell: add missing initialization of argv0_path
  2011-05-05  6:58 ` Johannes Sixt
@ 2011-05-05 16:32   ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2011-05-05 16:32 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Dima Sharov, Junio C Hamano, git

Johannes Sixt <j.sixt@viscovery.net> writes:

> Am 5/5/2011 8:40, schrieb Dima Sharov:
>> According to c6dfb39 (remote-curl: add missing initialization of
>> argv0_path, 2009-10-13), stand-alone programs (non-builtins)
>> must call git_extract_argv0_path(argv[0]) in order to help builds
>> that derive the installation prefix at runtime. Without this call,
>> the program segfaults (or raises an assertion failure).
>
> Good catch! I checked PROGRAM_OBJS in Makefile, and shell.c was the only
> one remaining that did not call this function.

Thanks for an Ack; the patch was corrupt but was trivial to fix-up.
Will queue.

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

end of thread, other threads:[~2011-05-05 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-05  6:40 [PATCH] shell: add missing initialization of argv0_path Dima Sharov
2011-05-05  6:58 ` Johannes Sixt
2011-05-05 16:32   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2011-05-01  6:06 Dima Sharov

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).