Subject: bin/6863: more/less cannot handle files larger than 2GB
To: None <gnats-bugs@gnats.netbsd.org>
From: Tero Kivinen <kivinen@ssh.fi>
List: netbsd-bugs
Date: 01/22/1999 15:42:22
>Number:         6863
>Category:       bin
>Synopsis:       Less cannot handle files larger than 2GB
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 22 05:50:01 1999
>Last-Modified:
>Originator:     Tero Kivinen
>Organization:
SSH Communications Security
>Release:        NetBSD 1.3.2
>Environment:
	
System: NetBSD taulu.ssh.fi 1.3.2 NetBSD 1.3.2 (TAULU) #4: Mon Nov 16 22:07:42 EET 1998 ztk@nurkka.ssh.fi:/usr/src/sys/arch/i386/compile/TAULU i386

>Description:

	If you try to less file that is more than 2GB in size the
	less will print error message

	Cannot seek to that file position  (press RETURN)

	and exit. 

>How-To-Repeat:

	Create 2GB file and try to less it:

	dd if=/dev/zero bs=1024k count=1 seek=2048 of=/tmp/foo
	less /tmp/foo
	
>Fix:

	I assume that changing line 143 in the less.h from

	typedef long		POSITION;

	to

	typedef off_t		POSITION;

	will fix the actual problem, but it will propably create
	new ones with the printf format characters (at least the
	comment below says so).

	Perhaps less needs also

	#define POSITION_FMT_CHAR	"%ld"

	that needs to be changed to match the format string of the
	off_t, and then all printfs must be changed to use that.
>Audit-Trail:
>Unformatted: