Subject: read/write
To: None <>
From: Jason Thorpe <>
List: tech-userlevel
Date: 12/12/1994 00:08:06
Well, after happily installing texinfo-3.1 on my i386, I went to 
plop it onto my hp300.  Much to my dismay, it didn't work so hot.

I traced it down to some code in makeinfo and some other utils where it 
actually reads in the file.  It basically does the following:

	1.  stat the file (for st_size)
	2.  malloc that many bytes for a buffer
	3.  read the file into the buffer with one call to read

The problem is that st_size is an off_t (64 bit) where malloc(3) and read(2) 
expect size_t (32 bit).  This is definitely a problem, just 
one that doesn't manifest itself on the i386.

But, I believe POSIX states that read(2) and write(2) will take a size_t - 
period...So, this has left me with  a bit of a dilemma.

Really, this could be described as a bug (or just poorly written code) in 
the texinfo package, but I think that this issue warrants some 
attention.  I mean, it seems to me that the maximum file size should be 
passable to read(2) as an argument...


Jason R. Thorpe                      758-2003
OJGSE NERO Project               CSWest Room 5                    737-5567
Shared Computing Environment Group

   "Morality and law are merely conventions adopted out of mutual fear."
		-- Plato