Subject: Re: bin/10625: /usr/bin/cmp is unable to compare rather large files
To: NetBSD GNATS submissions and followups <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 07/27/2000 15:29:23
[ On Thursday, July 27, 2000 at 10:50:36 (-0400), Andrew Brown wrote: ]
> Subject: Re: bin/10625: /usr/bin/cmp is unable to compare rather large files
>
> >However I'm not sure the bug is *really* fixed. Shouldn't the test used
> >to avoid mmap() be to see if the length is bigger than (SIZE_T_MAX / 2)?
>
> if mmap is so great, wouldn't it make sense to use a moving mmap (ie,
> mmap, scan, munmap, mmap next chunk...) instead of falling back to
> plain old read?
Well, yeah!
> then again...if mmap is so great, why doesn't cat use it? then cat
> would be just six system calls for each (regular) file.
"If I had a hammer...." :-)
> >Does mmap() really fail if the file is bigger than the *remaining* size
> >of the process's address space (the manual page makes no obvious claims
> >along these lines)?
>
> common sense says it should.
There've been some more or less similarly stupid bugs in various mmap()
implementations in the past....
--
Greg A. Woods
+1 416 218-0098 VE3TCP <gwoods@acm.org> <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>