git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v13 2/5] bugreport: add tool to generate debugging info

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Aug 12, 2020, 15:53 UTC
Message-ID
<20200812155306.GA23524@szeder.dev>
In-Reply-To
<20200416211807.60811-3-emilyshaffer@google.com>
On Thu, Apr 16, 2020 at 02:18:04PM -0700, Emily Shaffer wrote:
Show 15 quoted lines
> 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>
> ---
Show 18 quoted lines
> 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.

Show 15 quoted lines
> +		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
> +'
Previous: Emily ShafferNext: SZEDER Gábor
Message 17 of 40 in “git-bugreport with fixed VS build”
  1. 0/5 git-bugreport with fixed VS buildEmily Shaffer, Apr 16, 2020
  2. 1/5 help: move list_config_help to builtin/helpEmily Shaffer, Apr 16, 2020
  3. Junio C HamanoApr 16, 2020
  4. Junio C HamanoApr 16, 2020
  5. Emily ShafferApr 17, 2020
  6. Danh DoanApr 17, 2020
  7. Danh DoanApr 17, 2020
  8. Makefile: add missing dependencies of 'config-list.h'SZEDER Gábor, Apr 8, 2021
  9. Ævar Arnfjörð BjarmasonApr 8, 2021
  10. Jeff KingApr 8, 2021
  11. SZEDER GáborApr 9, 2021
  12. Junio C HamanoApr 16, 2021
  13. SZEDER GáborApr 16, 2021
  14. Junio C HamanoApr 16, 2021
  15. Ævar Arnfjörð BjarmasonApr 13, 2021
  16. 2/5 bugreport: add tool to generate debugging infoEmily Shaffer, Apr 16, 2020
  17. SZEDER GáborAug 12, 2020
  18. SZEDER GáborApr 8, 2021
  19. 4/5 bugreport: add uname infoEmily Shaffer, Apr 16, 2020
  20. Ævar Arnfjörð BjarmasonApr 8, 2021
  21. Junio C HamanoApr 8, 2021
  22. Ævar Arnfjörð BjarmasonApr 8, 2021
  23. Emily ShafferApr 8, 2021
  24. Junio C HamanoApr 8, 2021
  25. SZEDER GáborApr 9, 2021
  26. t0091-bugreport.sh: actually verify some content of reportMartin Ågren, Apr 11, 2021
  27. Junio C HamanoApr 12, 2021
  28. Martin ÅgrenApr 13, 2021
  29. Ævar Arnfjörð BjarmasonApr 13, 2021
  30. Emily ShafferApr 13, 2021
  31. t0091-bugreport.sh: actually verify some content of reportMartin Ågren, Jul 1, 2023
  32. Phillip WoodJul 3, 2023
  33. Martin ÅgrenJul 5, 2023
  34. t0091-bugreport.sh: actually verify some content of reportMartin Ågren, Jul 5, 2023
  35. Phillip WoodJul 5, 2023
  36. SZEDER GáborApr 13, 2021
  37. 3/5 bugreport: gather git version and build infoEmily Shaffer, Apr 16, 2020
  38. 5/5 bugreport: add compiler infoEmily Shaffer, Apr 16, 2020
  39. Ævar Arnfjörð BjarmasonApr 8, 2021
  40. Đoàn Trần Công DanhApr 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.