From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 1/2] rebase: replace incorrect logical negation by correct bitwise one
Date: Tue, 28 May 2019 11:25:19 -0700 [thread overview]
Message-ID: <xmqq5zpu308g.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: aa0acf4c5ff843a480afdb5715fa03186d82a6d1.1558461018.git.gitgitgadget@gmail.com
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> In bff014dac7d9 (builtin rebase: support the `verbose` and `diffstat`
> options, 2018-09-04), we added a line that wanted to remove the
> `REBASE_DIFFSTAT` bit from the flags, but it used an incorrect negation.
>
> Found by Coverity.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> builtin/rebase.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index ba3a574e40..db6ca9bd7d 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -1203,7 +1203,7 @@ static int rebase_config(const char *var, const char *value, void *data)
> if (git_config_bool(var, value))
> opts->flags |= REBASE_DIFFSTAT;
> else
> - opts->flags &= !REBASE_DIFFSTAT;
> + opts->flags &= ~REBASE_DIFFSTAT;
> return 0;
> }
Obviously correct. Thanks.
At this point in the codeflow, the .flags field is not touched by
parse_options() yet, the configuration codepath only touches that
field for REBASE_DIFFSTAT, and because REBASE_DIFFSTAT is not 0,
"[rebase] stat = no", which would want only the REBASE_DIFFSTAT bit
cleared in the word, can afford to instead assign 0 to the whole
word without causing any damage, which is funny way for this bug to
be hidden for a long time...
next prev parent reply other threads:[~2019-05-28 18:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 17:50 [PATCH 0/2] Fix two issues pointed out by Coverity Johannes Schindelin via GitGitGadget
2019-05-21 17:50 ` [PATCH 1/2] rebase: replace incorrect logical negation by correct bitwise one Johannes Schindelin via GitGitGadget
2019-05-28 18:25 ` Junio C Hamano [this message]
2019-05-21 17:50 ` [PATCH 2/2] bisect--helper: verify HEAD could be parsed before continuing Johannes Schindelin via GitGitGadget
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5zpu308g.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).