git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Emily Shaffer <emilyshaffer@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v13 2/5] bugreport: add tool to generate debugging info
Date: Wed, 12 Aug 2020 17:53:06 +0200	[thread overview]
Message-ID: <20200812155306.GA23524@szeder.dev> (raw)
In-Reply-To: <20200416211807.60811-3-emilyshaffer@google.com>

On Thu, Apr 16, 2020 at 02:18:04PM -0700, Emily Shaffer wrote:
> Teach Git how to prompt the user for a good bug report: reproduction
> steps, expected behavior, and actual behavior. Later, Git can learn how
> to collect some diagnostic information from the repository.
> 
> If users can send us a well-written bug report which contains diagnostic
> information we would otherwise need to ask the user for, we can reduce
> the number of question-and-answer round trips between the reporter and
> the Git contributor.
> 
> Users may also wish to send a report like this to their local "Git
> expert" if they have put their repository into a state they are confused
> by.
> 
> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> ---

> diff --git a/t/t0091-bugreport.sh b/t/t0091-bugreport.sh
> new file mode 100755
> index 0000000000..2e73658a5c
> --- /dev/null
> +++ b/t/t0091-bugreport.sh
> @@ -0,0 +1,61 @@
> +#!/bin/sh
> +
> +test_description='git bugreport'
> +
> +. ./test-lib.sh
> +
> +# Headers "[System Info]" will be followed by a non-empty line if we put some
> +# information there; we can make sure all our headers were followed by some
> +# information to check if the command was successful.
> +HEADER_PATTERN="^\[.*\]$"
> +
> +check_all_headers_populated () {

I'm afraid that this helper function doesn't do what it was supposed
to.

> +	while read -r line

It iterates through each line of stdin, which is a file written by
'git bugreport'.

> +	do
> +		if test "$(grep "$HEADER_PATTERN" "$line")"

This first tries to find a match in the _file_ called "$line", which never
exists, resulting in trace output:

  + check_all_headers_populated
  + read -r line
  + grep ^\[.*\]$ Thank you for filling out a Git bug report!
  grep: Thank you for filling out a Git bug report!: No such file or directory
  + test 
  + read -r line
  + grep ^\[.*\]$ Please answer the following questions to help us understand your issue.
  grep: Please answer the following questions to help us understand your issue.: No such file or directory
  + test
  + read -r line
  + grep ^\[.*\]$
  grep: : No such file or directory
  [...]

Then, since 'grep' doesn't print any matches to its stdout, it invokes

  test ""

which always returns non-zero, so that if condition is never fulfilled.

On first sight I thought that simply changing that 'grep' invocation
to something like:

  $(printf "%s\n" "$line" | grep "$HEADER_PATTERN")

would be sufficient to fix it, but then the first test failed... and
I'm not sure that I understand what this was supposed to check in the
first place.

> +		then
> +			echo "$line"
> +			read -r nextline
> +			if test -z "$nextline"; then
> +				return 1;
> +			fi
> +		fi
> +	done
> +}
> +
> +test_expect_success 'creates a report with content in the right places' '
> +	test_when_finished rm git-bugreport-check-headers.txt &&
> +	git bugreport -s check-headers &&
> +	check_all_headers_populated <git-bugreport-check-headers.txt
> +'

  reply	other threads:[~2020-08-12 15:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 21:18 [PATCH v13 0/5] git-bugreport with fixed VS build Emily Shaffer
2020-04-16 21:18 ` [PATCH v13 1/5] help: move list_config_help to builtin/help Emily Shaffer
2020-04-16 22:21   ` Junio C Hamano
2020-04-16 22:28     ` Junio C Hamano
2020-04-17 19:36       ` Emily Shaffer
2020-04-17  2:04   ` Danh Doan
2020-04-17  2:11     ` Danh Doan
2021-04-08 21:29   ` [PATCH] Makefile: add missing dependencies of 'config-list.h' SZEDER Gábor
2021-04-08 22:08     ` Ævar Arnfjörð Bjarmason
2021-04-08 23:40       ` Jeff King
2021-04-09 21:20         ` SZEDER Gábor
2021-04-16 19:03           ` Junio C Hamano
2021-04-16 21:33             ` SZEDER Gábor
2021-04-16 22:25               ` Junio C Hamano
2021-04-13 19:07         ` Ævar Arnfjörð Bjarmason
2020-04-16 21:18 ` [PATCH v13 2/5] bugreport: add tool to generate debugging info Emily Shaffer
2020-08-12 15:53   ` SZEDER Gábor [this message]
2021-04-08 21:36     ` SZEDER Gábor
2020-04-16 21:18 ` [PATCH v13 3/5] bugreport: gather git version and build info Emily Shaffer
2020-04-16 21:18 ` [PATCH v13 4/5] bugreport: add uname info Emily Shaffer
2021-04-08 22:19   ` Ævar Arnfjörð Bjarmason
2021-04-08 22:25     ` Junio C Hamano
2021-04-08 22:33       ` Ævar Arnfjörð Bjarmason
2021-04-08 23:41         ` Emily Shaffer
2021-04-08 23:58           ` Junio C Hamano
2021-04-09 21:27           ` SZEDER Gábor
2021-04-11 14:33             ` [PATCH] t0091-bugreport.sh: actually verify some content of report Martin Ågren
2021-04-12 17:17               ` Junio C Hamano
2021-04-13 18:32                 ` Martin Ågren
2021-04-13 19:27                   ` Ævar Arnfjörð Bjarmason
2021-04-13 22:21                     ` Emily Shaffer
2023-07-01 19:26                       ` [PATCH v2] " Martin Ågren
2023-07-03 15:47                         ` Phillip Wood
2023-07-05 18:31                           ` Martin Ågren
2023-07-05 18:40                             ` [PATCH v3] " Martin Ågren
2023-07-05 19:46                               ` Phillip Wood
2021-04-13 19:44               ` [PATCH] " SZEDER Gábor
2020-04-16 21:18 ` [PATCH v13 5/5] bugreport: add compiler info Emily Shaffer
2021-04-08 22:23   ` Ævar Arnfjörð Bjarmason
2021-04-08 22:59     ` Đoàn Trần Công Danh

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=20200812155306.GA23524@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    /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).