Re: [PATCH] t/lib-gpg: fix gpgconf stderr redirect to /dev/null
- From
Todd Zullinger <tmz@pobox.com>
- Date
- Nov 14, 2017, 03:03 UTC
- Message-ID
- <20171114030351.GS5144@zaya.teonanacatl.net>
- In-Reply-To
- <xmqq60ad7ewx.fsf@gitster.mtv.corp.google.com>
Junio C Hamano wrote:
> **Blush**. I should have caught this during the review. Thanks.
I've written that code myself in the past and I am sure I will do it again. :)
Show 5 quoted lines
> I wonder if this line in 3320 is doing what it meant to do: > > test_must_fail git notes merge z 2>&1 >out && > test_i18ngrep "Automatic notes merge failed" out && > grep -v "A notes merge into refs/notes/x is already in-progress in" out
That's a fine question. I only grepped for 2>&1 >/dev/null. Dropping /dev/null, as you did only turns up that test as an additional hit.
I think, based on a very cursory reading of the test, that it's intending to direct stderr and stdout to the file out. The test gets lucky that the code in builtin/notes.c directs the error message to stdout:
printf(_("Automatic notes merge failed. Fix conflicts in %s and "
"commit the result with 'git notes merge --commit', or "
"abort the merge with 'git notes merge --abort'.\n"),
git_path(NOTES_MERGE_WORKTREE));Perhaps that should be using fprintf(stderr, ...) instead? (And the test redirection corrected as well, of course.) If that seems correct, I can submit the trivial patch for that as well, while I'm on the subject.
-- Todd ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Chaos, panic, and disorder - my job is done here.