From: Junio C Hamano <gitster@pobox.com>
To: Steffen Prohaska <prohaska@zib.de>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
git@vger.kernel.org, Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
Subject: Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()
Date: Wed, 21 Nov 2007 23:52:05 -0800 [thread overview]
Message-ID: <7vsl2y90pm.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <C50619A0-4A67-4968-8431-D7A685F723B7@zib.de> (Steffen Prohaska's message of "Thu, 22 Nov 2007 07:13:50 +0100")
Steffen Prohaska <prohaska@zib.de> writes:
> On Nov 22, 2007, at 3:34 AM, Junio C Hamano wrote:
>
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>
>>> Does this not have a fundamental issue? When you call other git
>>> programs
>>> with run_command(), you _need_ GIT_DIR to be set, no?
>>
>> It is much worse. set_git_dir() does not just setenv() but does
>> setup_git_env() as well.
>
> What do your comments mean?
>
> My understanding is that set_git_dir() sets the environment and
> then calls setup_git_env() to cache all pointers. This call
> updates dangling pointer if they have been cached earlier.
Well, I was agreeing with you. "Worse" was about what the
current code does _not_ do.
If there are earlier calls that obtain locations relative to the
earlier definition of GIT_DIR, the locations they obtained are
not just stored in memory that is "dangling" (which was what
your proposed log message described) but they are also
inconsistent with the updated definition of GIT_DIR.
I suspect Johannes mistook set_git_dir() was only local
(i.e. per calling process) matter without noticing that it has
its own setenv() when he made that comment, hence my response to
point out that the current code only calls setenv(), but
set_git_dir() does setup_git_env() too, which should hide the
inconsistency problem.
HOWEVER.
I suspect that if there are even earlier callers than these
early parts in the codepaths (handle_options, enter_repo, and
setup_git_directory_gently), maybe these earlier callers are
doing something wrong. Logically, if you are somewhere very
early in the codepath that you can still change the value of
GIT_DIR, you shouldn't have assumed the unknown value of GIT_DIR
and cached locations relative to that directory, no? What are
the problematic callers? What values do they access and why?
next prev parent reply other threads:[~2007-11-22 7:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-21 20:27 [PATCH 0/3] msysgit fallout Steffen Prohaska
2007-11-21 20:27 ` [PATCH 1/3] sha1_file.c: Fix size_t related printf format warnings Steffen Prohaska
2007-11-21 20:27 ` [PATCH 2/3] builtin-init-db: use get_git_dir() instead of getenv() Steffen Prohaska
2007-11-21 20:27 ` [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir() Steffen Prohaska
2007-11-22 1:22 ` Johannes Schindelin
2007-11-22 2:34 ` Junio C Hamano
2007-11-22 6:13 ` Steffen Prohaska
2007-11-22 7:52 ` Junio C Hamano [this message]
2007-11-22 8:31 ` Steffen Prohaska
2007-11-22 9:58 ` Johannes Sixt
2007-11-22 17:56 ` Steffen Prohaska
2007-11-22 22:09 ` Johannes Schindelin
2008-01-01 18:52 ` Steffen Prohaska
2008-01-03 4:07 ` Dmitry Kakurin
2008-01-03 6:02 ` Steffen Prohaska
2008-01-03 6:26 ` Dmitry Kakurin
2008-01-03 7:53 ` Steffen Prohaska
2007-11-22 7:29 ` Johannes Sixt
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=7vsl2y90pm.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Dmitry.Kakurin@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=prohaska@zib.de \
/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).