lua-users home
lua-l archive

Re: Possible io:read bug

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Feb 25, 2004 at 10:58:10AM +0200, Tuomo Valkonen wrote:
> The first of the users who reported this problem was running SunOS and
> the second OpenBSD 3.4 with gcc 3.3.2 and both Lua 5.0 and 5.0.1.
you could add a temporary hack like
	f = io.open(filename)
	data = f:read('*a')
	f:close()
	p = io.popen('wc -c ' .. filename)
	assert(string.len(data) == p:read('*n'))
	p:close()
to check that the data returned from read('*a') has the correct length.
if this fails, then a system call trace should indicate why the all the
data is not being read in. on solaris, truss can also trace each call to
the C library function fread() in src/lib/liolib.c:read_chars() (which is
called for read('*a')).
-taj

AltStyle によって変換されたページ (->オリジナル) /