Bug 20143

Summary: "cmp -s" broken when reading a pipe
Product: Base System Reporter: trost <trost>
Component: binAssignee: Sheldon Hearn <sheldonh>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description trost 2000-07-24 18:00:01 UTC
	"cmp -s" will incorrectly report that files are different if
	one of the files is standard input.

Fix: 

I've changed a script that uses "cmp -s" to just use "cmp" and
	redirect stdout to /dev/null.
How-To-Repeat: 
	$ date > a
	$ cmp -s a a || echo different
	$ cat a | cmp - a || echo different
	$ cat a | cmp -s - a || echo different
	different
Comment 1 Sheldon Hearn 2000-07-25 13:19:50 UTC
On 24 Jul 2000 16:52:56 GMT, trost@cloud.rain.com wrote:

> 	"cmp -s" will incorrectly report that files are different if
> 	one of the files is standard input.

I think that this is because -s implies -z (not mentioned in the manual
page).

Ciao,
Sheldon.
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 2000-07-25 15:49:31 UTC
State Changed
From-To: open->closed

The problem came down to a pair of missing braces in rev 1.8. 
This'll be fixed in 4.1-RELEASE.  Thanks for the report! 


Comment 3 Sheldon Hearn freebsd_committer freebsd_triage 2000-07-25 15:49:31 UTC
Responsible Changed
From-To: freebsd-bugs->sheldonh