All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Hostetler <git@jeffhostetler.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, gitster@pobox.com,
	Johannes.Schindelin@gmx.de,
	Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: [PATCH v4 5/8] status: print per-file porcelain v2 status data
Date: Fri, 5 Aug 2016 17:27:28 -0400	[thread overview]
Message-ID: <57A504C0.1060808@jeffhostetler.com> (raw)
In-Reply-To: <20160805210222.a2rvlmioim4psbhw@sigill.intra.peff.net>



On 08/05/2016 05:02 PM, Jeff King wrote:
> On Tue, Aug 02, 2016 at 10:12:14AM -0400, Jeff Hostetler wrote:
>
>> +static void wt_porcelain_v2_print_unmerged_entry(
>> +	struct string_list_item *it,
>> +	struct wt_status *s)
>> +{
>> +	struct wt_status_change_data *d = it->util;
>> +	const struct cache_entry *ce;
>> +	struct strbuf buf_current = STRBUF_INIT;
>> +	const char *path_current = NULL;
>> +	int pos, stage, sum;
>> +	struct {
>> +		int mode;
>> +		struct object_id oid;
>> +	} stages[3];
>> +	char *key;
>> [...]
>> +	switch (d->stagemask) {
>> +	case 1: key = "DD"; break; /* both deleted */
>> +	case 2: key = "AU"; break; /* added by us */
>> +	case 3: key = "UD"; break; /* deleted by them */
>> +	case 4: key = "UA"; break; /* added by them */
>> +	case 5: key = "DU"; break; /* deleted by us */
>> +	case 6: key = "AA"; break; /* both added */
>> +	case 7: key = "UU"; break; /* both modified */
>> +	}
>> [...]
>> +	fprintf(s->fp, "%c %s %s %06o %06o %06o %06o %s %s %s %s%c",
>> +			unmerged_prefix, key, submodule_token,
>
> Coverity complains that "key" can be uninitialized here. I think it's
> wrong, and just doesn't know that d->stagemask is constrained to 1-7.
>
> But perhaps it is worth adding a:
>
>    default:
> 	die("BUG: unhandled unmerged status %x", d->stagemask);
>
> to the end of the switch. That would shut up Coverity, and give us a
> better indication if our constraint is violated.
>
> -Peff
>

got it. thanks!
Jeff

  parent reply	other threads:[~2016-08-05 21:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 14:12 [PATCH v4 0/8] status: V2 porcelain status Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 1/8] status: rename long-format print routines Jeff Hostetler
2016-08-03 21:28   ` Junio C Hamano
2016-08-04 12:30     ` Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 2/8] status: cleanup API to wt_status_print Jeff Hostetler
2016-08-03 21:36   ` Junio C Hamano
2016-08-04 12:35     ` Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 3/8] status: support --porcelain[=<version>] Jeff Hostetler
2016-08-03 21:37   ` Junio C Hamano
2016-08-02 14:12 ` [PATCH v4 4/8] status: per-file data collection for --porcelain=v2 Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 5/8] status: print per-file porcelain v2 status data Jeff Hostetler
2016-08-05 21:02   ` Jeff King
2016-08-05 21:09     ` Junio C Hamano
2016-08-05 21:14       ` Jeff King
2016-08-05 21:21         ` Junio C Hamano
2016-08-05 21:43         ` Stefan Beller
2016-08-05 21:47           ` Stefan Beller
2016-08-05 21:27     ` Jeff Hostetler [this message]
2016-08-02 14:12 ` [PATCH v4 6/8] status: print branch info with --porcelain=v2 --branch Jeff Hostetler
2016-08-05 17:01   ` Junio C Hamano
2016-08-05 18:11     ` Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 7/8] git-status.txt: describe --porcelain=v2 format Jeff Hostetler
2016-08-05 17:50   ` Junio C Hamano
2016-08-05 18:27     ` Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 8/8] status: tests for --porcelain=v2 Jeff Hostetler
2016-08-05 18:12   ` Junio C Hamano
2016-08-05 18:31     ` Jeff Hostetler
2016-08-03 15:09 ` [PATCH v4 0/8] status: V2 porcelain status Johannes Schindelin
2016-08-03 15:23   ` Junio C Hamano
2016-08-03 16:10     ` Johannes Schindelin
2016-08-03 16:59       ` 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=57A504C0.1060808@jeffhostetler.com \
    --to=git@jeffhostetler.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.