git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <ttaylorr@github.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: HG King via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, HG King <hgmaxwellking@gmail.com>
Subject: Re: [PATCH] fix: added new BANNED_EXPL macro for better error messages, new parameter
Date: Mon, 8 Mar 2021 13:05:46 -0500	[thread overview]
Message-ID: <YEZnaeJVt8Rk6duv@nand.local> (raw)
In-Reply-To: <xmqq7dmi8zym.fsf@gitster.c.googlers.com>

On Sun, Mar 07, 2021 at 12:34:57PM -0800, Junio C Hamano wrote:
> "HG King via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> >  #undef strcpy
> > -#define strcpy(x,y) BANNED(strcpy)
> > +#define strcpy(x,y) BANNED_EXPL(strcpy, buffer_overflow_risk)
>
> That does not help programmers that much (the above does not say
> what to use instead, for example), and the mechanism inherently
> does not give you sufficient space to give helpful guidance.

Trying to cram information like "why is this function unsafe?" and "what
function should I use instead?" seems ill-fitted to trying to a macro
which is supposed to have a field for each.

I'm certainly not opposed to making these banned functions clearer, but
I do not think that this is the way to do it.

> Adding a comment around each of these definition may be OK.  Upon
> seeing foo_is_a_banned_function, somebody new to the codebase would
> look for where it is banned, and find the above, so that is a good
> place to give guidance.

Perhaps, but all of this information is already covered accurately in
the patches that introduced each banned function. So I'm not sure that I
even agree that this information is difficult to discover to begin with,
but I may be biased.

Thanks,
Taylor

  reply	other threads:[~2021-03-08 18:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06  0:51 [PATCH] fix: added new BANNED_EXPL macro for better error messages, new parameter HG King via GitGitGadget
2021-03-07 20:34 ` Junio C Hamano
2021-03-08 18:05   ` Taylor Blau [this message]
2021-03-08 18:30     ` Jeff King
2021-03-08 18:41     ` 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=YEZnaeJVt8Rk6duv@nand.local \
    --to=ttaylorr@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=hgmaxwellking@gmail.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).