git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>, emilyshaffer@google.com
Cc: git@vger.kernel.org, Emily Shaffer <nasamuffin@google.com>,
	Sheik <sahibzone@gmail.com>, Dragan Simic <dsimic@manjaro.org>
Subject: Re: [PATCH v3] bugreport: reject positional arguments
Date: Fri, 27 Oct 2023 15:41:44 +0100	[thread overview]
Message-ID: <3e15f266-c790-4b71-84b6-1328339425c1@gmail.com> (raw)
In-Reply-To: <CAPig+cTmYtWR=QN3LeN9yw3HmsKEmD2fUiRjKf=eJHhAZyT-yA@mail.gmail.com>

On 26/10/2023 18:18, Eric Sunshine wrote:
> On Thu, Oct 26, 2023 at 11:55 AM <emilyshaffer@google.com> wrote:
>> git-bugreport already rejected unrecognized flag arguments, like
>> `--diaggnose`, but this doesn't help if the user's mistake was to forget
>> the `--` in front of the argument. This can result in a user's intended
>> argument not being parsed with no indication to the user that something
>> went wrong. Since git-bugreport presently doesn't take any positionals
>> at all, let's reject all positionals and give the user a usage hint.
>>
>> Signed-off-by: Emily Shaffer <nasamuffin@google.com>
>> ---
>> Per Eric's and Dragan's comments, dropped the null checking for argv[0].
>> No point in being too paranoid, I suppose :)
>>
>> Note that after this morning it's not likely that I'll be able to find
>> time to update this again so quickly, so if there are other nits,
>> reviewers can feel free to send their own rerolls rather than waiting
>> for me to see it and turn the patch around.
> 
> Thanks. This version looks good enough to me. Just one minor comment below...
> 
>> diff --git a/t/t0091-bugreport.sh b/t/t0091-bugreport.sh
>> @@ -69,6 +69,13 @@ test_expect_success 'incorrect arguments abort with usage' '
>> +test_expect_success 'incorrect positional arguments abort with usage and hint' '
>> +       test_must_fail git bugreport false 2>output &&
>> +       test_i18ngrep usage output &&
>> +       test_i18ngrep false output &&
>> +       test_path_is_missing git-bugreport-*
>> +'
> 
> I didn't really pay attention to the test in earlier rounds so didn't
> notice this, but these days we just use 'grep' rather than
> 'test_i18ngrep'. (Indeed, the existing tests in this script use
> 'grep'.)

It is rather unfortunate that test_i18ngrep was deprecated without 
providing an alternative that offers the same debugging experience. When 
test_i18ngrep fails it prints a message with the pattern and text that 
failed to match so it is easy to see where the test failed. If grep 
fails there is no output and so unless the test is run with "-x" it can 
be hard to see which command caused the test to fail.

Best Wishes

Phillip



  reply	other threads:[~2023-10-27 14:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 20:59 git bugreport with invalid CLI argument does not report error Sheik
2023-10-25 22:53 ` Emily Shaffer
2023-10-25 23:11   ` Eric Sunshine
2023-10-26  0:55     ` [PATCH v2] bugreport: reject positional arguments emilyshaffer
2023-10-26  3:43       ` Eric Sunshine
2023-10-26  3:52         ` Dragan Simic
2023-10-26  4:03           ` Eric Sunshine
2023-10-26  4:06             ` Dragan Simic
2023-10-26 15:54       ` [PATCH v3] " emilyshaffer
2023-10-26 17:18         ` Eric Sunshine
2023-10-27 14:41           ` Phillip Wood [this message]
2023-10-30  0:15             ` Junio C Hamano
2023-10-30  0:26             ` Junio C Hamano
2023-10-30  0:33               ` Junio C Hamano
2023-10-30  1:59                 ` Junio C Hamano
2023-10-30 14:11                   ` Phillip Wood
2023-10-30 23:31                     ` Junio C Hamano
2023-10-31  2:17                       ` Junio C Hamano
2023-10-31  5:23                     ` [PATCH 0/2] Deprecate test_i18ngrep further Junio C Hamano
2023-10-31  5:23                       ` [PATCH 1/2] test framework: further deprecate test_i18ngrep Junio C Hamano
2023-10-31  5:23                       ` [PATCH 2/2] tests: teach callers of test_i18ngrep to use test_grep Junio C Hamano
2023-11-01 14:44                         ` Phillip Wood
2023-11-01 23:19                           ` Junio C Hamano
2023-10-26 18:22         ` [PATCH v4 0/2] bugreport: reject positional arguments emilyshaffer
2023-10-26 20:13           ` Eric Sunshine
2023-10-26 18:22         ` [PATCH v4 1/2] t0091-bugreport: stop using i18ngrep emilyshaffer
2023-10-29 23:59           ` Junio C Hamano
2023-10-26 18:22         ` [PATCH v4 2/2] bugreport: reject positional arguments emilyshaffer

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=3e15f266-c790-4b71-84b6-1328339425c1@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=dsimic@manjaro.org \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=nasamuffin@google.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sahibzone@gmail.com \
    --cc=sunshine@sunshineco.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.
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).