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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 12, 2020 at 05:53:06PM +0200, SZEDER Gábor wrote:
> 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@xxxxxxxxxx>
> > ---
> 
> > 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.

Just a reminder that this test is still broken...

> 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
> > +'



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux