git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: Clemens Buchacher <drizzd@aon.at>,
	Finn Arne Gangstad <finnag@pvv.org>,
	Tim Olsen <tim@brooklynpenguin.com>,
	git@vger.kernel.org
Subject: Re: [PATCH v2] diff -c -p: do not die on submodules
Date: Wed, 29 Apr 2009 16:09:28 -0700	[thread overview]
Message-ID: <7vr5zb5a6v.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <81b0412b0904291450w3d292ed5i3b2ab5164c0ae0f4@mail.gmail.com> (Alex Riesen's message of "Wed, 29 Apr 2009 23:50:20 +0200")

Alex Riesen <raa.lkml@gmail.com> writes:

> 2009/4/29 Junio C Hamano <gitster@pobox.com>:
>> +
>> +       if (S_ISGITLINK(mode)) {
>> +               blob = xmalloc(100);
>> +               *size = snprintf(blob, 100,
>> +                                "Subproject commit %s\n", sha1_to_hex(sha1));
>
> snprintf returns a signed value. It also has a bad record of returning
> negative values for obscure reasons (on obscure platforms, admittedly).

The arena is sufficiently large that there is no way any broken snprintf
can return negative here.

This is a copy from Linus's diff_populate_gitlink(), that dates back to
0478675 (Expose subprojects as special files to "git diff" machinery,
2007-04-15), and you have never seen any breakage, which should tell you
something.

As I mentioned in the original patch, the codepath that reads one side of
diff (either from a blob or from a work tree entity) in show_patch_diff()
and grab_blob() in combine-diff.c should do the same thing as what
diff_populate_filespec() in diff.c does, and these three functions need
some refactoring to share more code.  The patch however is about fixing
the existing breakage without invasive refactoring.

  parent reply	other threads:[~2009-04-29 23:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 17:36 different git-merge behavior with regard to submodules in 1.6.2.4 vs. 1.6.2.1 Tim Olsen
2009-04-28 18:29 ` Junio C Hamano
2009-04-28 21:12   ` Finn Arne Gangstad
2009-04-29  8:42     ` Clemens Buchacher
2009-04-29 12:15       ` Finn Arne Gangstad
2009-04-29 18:53       ` [PATCH] Teach gitlinks to combine-diff Junio C Hamano
2009-04-29 20:26         ` [PATCH v2] diff -c -p: do not die on submodules Junio C Hamano
2009-04-29 21:50           ` Alex Riesen
2009-04-29 22:13             ` Johannes Schindelin
2009-04-29 22:19               ` Alex Riesen
2009-04-29 22:39                 ` Johannes Schindelin
2009-04-30  5:47                   ` Alex Riesen
2009-04-30  6:07                     ` Finn Arne Gangstad
2009-04-29 23:09             ` Junio C Hamano [this message]
2009-04-29 18:54       ` different git-merge behavior with regard to submodules in 1.6.2.4 vs. 1.6.2.1 Junio C Hamano

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=7vr5zb5a6v.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=drizzd@aon.at \
    --cc=finnag@pvv.org \
    --cc=git@vger.kernel.org \
    --cc=raa.lkml@gmail.com \
    --cc=tim@brooklynpenguin.com \
    /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).