delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/08/27/11:45:14

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Received: by 10.66.146.65 with SMTP id ta1mr6644112pab.19.1377616964034;
Tue, 27 Aug 2013 08:22:44 -0700 (PDT)
X-Received: by 10.49.28.97 with SMTP id a1mr772059qeh.0.1377616963800; Tue, 27
Aug 2013 08:22:43 -0700 (PDT)
Newsgroups: comp.os.msdos.djgpp
Date: Tue, 27 Aug 2013 08:22:43 -0700 (PDT)
In-Reply-To: <201308181854.r7IIs27x028304@delorie.com>
Complaints-To: groups-abuse AT google DOT com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=65.13.115.246;
posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
NNTP-Posting-Host: 65.13.115.246
References: <201308181854 DOT r7IIs27x028304 AT delorie DOT com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a1f85819-8b49-42df-a03d-29b7811a09a5@googlegroups.com>
Subject: Re: ANNOUNCE: DJGPP port of Lua 5.2.2 uploaded.
From: rugxulo AT gmail DOT com
Injection-Date: Tue, 27 Aug 2013 15:22:43 +0000
Bytes: 3831
Lines: 81
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Hi,

On Sunday, August 18, 2013 1:30:21 PM UTC-5, Juan Manuel Guerrero wrote:
>
> This is a port of Lua 5.2.2 to MSDOS/DJGPP.
> 
>    - The port has been test with the test suite available as:
> 
>        http://www.lua.org/tests/5.2/lua-5.2.2-tests.tar.gz
> 
>      After having installed lua, run the test suite by cd-ing into
>      lua-5.2.2-tests directory and starting the lua test script with
>      the command:
> 
>        lua -e"_U=true" all.lua
> 
>      No check will fail.  The final output should look like this:
> 
> test done on 18/08/2013, at 18:05:05
> Lua 5.2
> final OK !!!
> cleaning all!!!!
>      ---- total memory: 27.7K, max memory: 1.6M ----
> 
> total time: 4.78
> 
>  >>> closing state <<<

First of all, thanks for your work on this.

But there seems to be some (very) minor issues running the test suite, at
least under native FreeDOS. Under DOSEMU, it indeed passes entirely. I don't
know what environment you tested under (XP? Vista? MS-DOS?), so while you're
of course right to say it passed okay, I feel it's best to mention this to
you here.

I suspect it's just minor libc handling differences, similar to what you 
already noticed recently. The problematic lines are in files.lua : 465, 470,
and 478:

  assert(fr:read("*all") == "x")   -- `close' flushes it
  ...
  assert(fr:read("*all") == "x")  -- no buffer; output is ready
  ...
  assert(fr:read("*all") == "xa\n")  -- now we have a whole line

Here's my guess at why this is failing:

Lines 458 and 459 open the same "file" for "w" (write, as "f") and
"r" (read, as "fr"). "f" is closed and "fr" seeks to beginning.
Apparently they are assuming that the written file "f" is properly
flushed via "close" and that "fr" (still open) can correctly read a
char from it.

It's probably easier to just quote files.lua (lines 456-81) itself:

-- testing buffers
do
  local f = assert(io.open(file, "w"))
  local fr = assert(io.open(file, "r"))
  assert(f:setvbuf("full", 2000))
  f:write("x")
  assert(fr:read("*all") == "")  -- full buffer; output not written yet
  f:close()
  fr:seek("set")
  assert(fr:read("*all") == "x")   -- `close' flushes it
  f = assert(io.open(file), "w")
  assert(f:setvbuf("no"))
  f:write("x")
  fr:seek("set")
  assert(fr:read("*all") == "x")  -- no buffer; output is ready
  f:close()
  f = assert(io.open(file, "a"))
  assert(f:setvbuf("line"))
  f:write("x")
  fr:seek("set", 1)
  assert(fr:read("*all") == "")   -- line buffer; no output without `\n'
  f:write("a\n"):seek("set", 1)
  assert(fr:read("*all") == "xa\n")  -- now we have a whole line
  f:close(); fr:close()
  assert(os.remove(file))
end

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019