From: Linus Torvalds <torvalds@osdl.org>
To: Petr Baudis <pasky@suse.cz>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH] Fix broken sha1 locking
Date: Tue, 19 Sep 2006 15:10:58 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0609191501311.4388@g5.osdl.org> (raw)
In-Reply-To: <20060919212340.GC8259@pasky.or.cz>
On Tue, 19 Sep 2006, Petr Baudis wrote:
>
> lock_ref_sha1_basic() never strdup()s ref (at least the reference used
> for git_path() later).
Ahh. So how did that ever work? Even in the current "master" branch, we
call "resolve_ref()", which calls "git_path()", and historically we only
had a single buffer..
So we're doing
lock_ref_sha1_basic(git_path("refs/%s", ref),...
with that single buffer, and we _do_ do "xstrdup(path)" in between.
[ looks.. ]
Ahh.
We re-assign the "path" to point to the result value of the resolve_ref(),
and so we do re-use the buffer, but we apparently never have any
overlapping use. The packed-ref changes make us need pathnames in the
middle, which we didn't use to do.
I do agree that we tend to use too many static buffers there. The static
buffers are fine for the low-level functions ("mkpath()" and
"git_path()"), but once they start getting passed around as arguments to
other functions, they should be xstrdup'd or something.
Linus
prev parent reply other threads:[~2006-09-19 22:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-19 20:58 [PATCH] Fix broken sha1 locking Petr Baudis
2006-09-19 21:16 ` Linus Torvalds
2006-09-19 21:23 ` Petr Baudis
2006-09-19 22:10 ` Linus Torvalds [this message]
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=Pine.LNX.4.64.0609191501311.4388@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=pasky@suse.cz \
/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).