Subject: lib/6637: libc does not support 64-bit file offsets; fgetpos truncates
To: None <gnats-bugs@gnats.netbsd.org>
From: Phil Budne <phil@ultimate.com>
List: netbsd-bugs
Date: 12/22/1998 15:48:18
>Number:         6637
>Category:       lib
>Synopsis:       libc does not support 64-bit file offsets; fgetpos truncates
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 22 12:50:00 1998
>Last-Modified:
>Originator:     Phil Budne
>Organization:
	little or none
>Release:        12/18/98
>Environment:
	pc532, 1.3I
System: NetBSD pc532 1.3I NetBSD 1.3I (DDB) #0: Fri Dec 18 18:31:13 EST 1998 phil@pc532:/usr/src/sys-981218/arch/pc532/compile/DDB pc532


>Description:
	fgetpos(3) truncates file position to 32-bits, despite
	returning value via fpos_t (cause it uses ftell) on systems
	where sizeof long is larger than sizeof fpos_t (anything but
	alpha or sparc64?)

	seems to have been recently send-pr'ed on FreeBSD (pr bin/8637)

>How-To-Repeat:
	read lots of data, call fgetpos().

>Fix:
	Implement X/Open Large File Support functions ftello(), fseeko
		which use off_t rather than long for file offsets.
		Implement ftell, fseek using fello, fseeko.  ftell(),
		fseek() should fail with EOVERFLOW when file offset
		cannot be represented as a long.

	Add __warn_references() for ftell, fseek advising use
		of ftello/fgetpos fseeko/fsetpos??

	see http://www.sas.com/standards/large.file/
		for other baggage in the Large File Support extension.
>Audit-Trail:
>Unformatted: