| Summary: | /usr/bin/head does not work with files over 2GB. | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Brian Cornell <briancornell> |
| Component: | bin | Assignee: | Brooks Davis <brooks> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Brian Cornell
2007-01-11 14:20:13 UTC
On Thu, Jan 11, 2007 at 02:19:04PM +0000, Brian Cornell wrote:
>
> Change byte counters in head.c from long to double types. This has been tested & works.
> Output of diff from release to modified source code:
> diff head.c head.61freebsd
> 64c64
> < static void head_bytes(FILE *, double);
> ---
> > static void head_bytes(FILE *, size_t);
> 73,74c73
> < int first, linecnt = -1, eval = 0;
> < double bytecnt = -1;
> ---
> > int first, linecnt = -1, bytecnt = -1, eval = 0;
> 81c80
> < bytecnt = strtod(optarg, &ep);
> ---
> > bytecnt = strtol(optarg, &ep, 10);
> 142c141
> < head_bytes(FILE *fp, double cnt)
> ---
> > head_bytes(FILE *fp, size_t cnt)
> 145c144
> < double readlen;
> ---
> > size_t readlen;
This is bogus. Using a floating point type to hold an interger quantity
is wrong. The correct type here is off_t. I'd suggest using strtoll or
strtonum for the conversion.
-- Brooks
brooks 2007-01-11 17:03:51 UTC
FreeBSD src repository
Modified files:
usr.bin/head Makefile head.c
Log:
Fix head -c ### where ### is greater than 2^31. Unlike the submitted
patch this uses off_t.
WARNSify and add $FreeBSD$ to Makefile.
PR: bin/107824
Submitted by: Brian Cornell <briancornell at earthlink dot net>
MFC after: 3 days
Revision Changes Path
1.2 +2 -0 src/usr.bin/head/Makefile
1.19 +6 -4 src/usr.bin/head/head.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: open->patched Fixed in HEAD. Responsible Changed From-To: freebsd-bugs->brooks Fixed in HEAD. brooks 2007-01-15 17:11:38 UTC
FreeBSD src repository
Modified files: (Branch: RELENG_6)
usr.bin/head Makefile head.c
Log:
MFC: head.c revs 1.19-20, Makefile rev 1.2
Fix head -c ### where ### is greater than 2^31. Unlike the submitted
patch this uses off_t.
WARNSify and add $FreeBSD$ to Makefile.
PR: bin/107824
Submitted by: Brian Cornell <briancornell at earthlink dot net>
Revision Changes Path
1.1.1.1.46.1 +2 -0 src/usr.bin/head/Makefile
1.18.14.1 +7 -5 src/usr.bin/head/head.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: patched->closed Merged to RELENG_6. Will be in 6.3-RELEASE. |