Re: [PATCH] Workaround for strange cmp bug

4 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Workaround for strange cmp bug

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:36

Johannes Schindelin [off-list ref] writes:
The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 10.1 has
a subtle "shortcoming":

	$ echo a > a
	$ echo b > b
	$ cmp a b && echo nonono
	a b differ: char 1, line 1
	$ cmp a b >/dev/null && echo nonono
	nonono
	$ cmp -s a b >/dev/null && echo nonono

So, if cmp should _not_ be quiet, _and_ the output is redirected to
/dev/null, it has a bogus exit value. Our test suite redirects to
/dev/null, which triggers that bug. (Obviously, the tests pass when
running with '-v', which made that a real bugger to debug.)
While I sympathize unfortunate users who are stuck with such a
broken implementation of an important basic tool, such a rewrite
unnecessarily makes debugging of both test scripts _and_ real
breakage harder.

It actually is very useful, in the chain of &&, to see that
these steps in our tests output something when they shouldn't
when the tests are run under -v; you may have noticed that the
tests written by me have seemingly useless "echo happy" (which
always returns true) and such, and they are there for a reason.

Please get the distribution fixed.

Re: [PATCH] Workaround for strange cmp bug

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:36

Hi,

On Wed, 9 Aug 2006, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 10.1 has
a subtle "shortcoming":
Okay, I will try to fix the distribution. I only thought it was worthwhile 
spreading the workaround for other poor souls.
It actually is very useful, in the chain of &&, to see that
these steps in our tests output something when they shouldn't
when the tests are run under -v; you may have noticed that the
tests written by me have seemingly useless "echo happy" (which
always returns true) and such, and they are there for a reason.
Well, I found myself stuck with too many of hard-to-debug cascades, where 
there is no "echo happy". I think that you are lost with most test 
scripts, if you do not use "bash -x".

Ciao,
Dscho

Re: [PATCH] Workaround for strange cmp bug

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:36

Hi,

On Wed, 9 Aug 2006, Johannes Schindelin wrote:
On Wed, 9 Aug 2006, Junio C Hamano wrote:
quoted
Johannes Schindelin [off-list ref] writes:
quoted
[ a whole lot about the output of cmp when calling a test with -v ]
Thinking about it again, I remember replacing 'cmp' by 'diff -u' quite a 
few times, because the output of the latter was even more helpful... And 
besides, 'diff -u' is not broken in my setup ;-)

Ciao,
Dscho

Re: [PATCH] Workaround for strange cmp bug

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:36

Hi,

On Wed, 9 Aug 2006, Johannes Schindelin wrote:
On Wed, 9 Aug 2006, Junio C Hamano wrote:
quoted
Johannes Schindelin [off-list ref] writes:
quoted
The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 
10.1 has a subtle "shortcoming":
Okay, I will try to fix the distribution. I only thought it was worthwhile 
spreading the workaround for other poor souls.
Got it. The problem is that diffutils-2.8.7-15 and -18 (which seem to be 
the same...) have cherry-picked a "fix" from CVS (cmp-eof-dev-null.diff), 
which is wrong. It was fixed in diffutils CVS, and I submitted a bug 
report in openSUSEÂ's bugzilla.

So, look out for diffutils-2.8.7-15 on openSUSE (although it only breaks 
the _tests_, not git itself!).

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help