lua-users home
lua-l archive

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


Line 303 says:

303: assert(io.read(5, 'l') == '"álo"') 

It is the counterpoint to lines 93-95, which create the file contents that start with the expected content that is read back in line 303:

093: assert(io.output():seek("set") == 0)
094:
095: assert(io.write('"álo"', "{a}\n", "second line\n", "third line \n"))

Try replacing line 303 with...

local m1,m2 = io.read(5,'l'); print('--->',#m1,m1,#m2,m2)

...and see what you get. In particular, #m2 should == 3 and m2 should == "{a}".

If #m2 comes out as 4 and m2 as "o{a}" then perhaps your copy of files.lua has had the one-byte extended ASCII encoding of "á" in the original file converted (a zealous text editor, perhaps?) to the UTF-8 representation of the character (LATIN SMALL LETTER A WITH ACUTE), which comes out as two bytes (0xC3 0xA1) instead of one bye in pure 8-bit "extended ASCII" (0xA1).

(For example, when I copied and pasted line 303 from vi into Outlook Web App to send this email, then copied it again and pasted it back into Lua, the encoding of "á" was changed from 0xA1 to 0xC3 0xA1.)

If so, try changing the "á" in lines 95 and 303 to, say, "A", or changing the 5 in line 303 to 6.

On my Linux system (Slackware 15-current with clang 11.0.0) the original files.lua works fine, except for line 747, where running 'kill -HUP' via sh causes popen to return 'signal', not 'exit'.

HtH.



From: Stefan Waldhör <swa-dev-lua@outlook.de>
Sent: 15 November 2020 19:06
To: lua-l@lists.lua.org <lua-l@lists.lua.org>
Subject: files.lua test is failing since lua 5.4.1
 
For me, since lua 5.4.1 the 'files.lua' test is broken (also in the latest 5.4.2-rc1 release and the associated tests release). The log is shown below. The error occurs on Linux (Ubuntu 18.04.5 LTS using gcc 7.5.0) and Windows (using any current MSVC). Built without customization.

Is this error also happening on your latest tests using 5.4.2-rc1 and the associated tests?

Error:

***** FILE 'files.lua'*****
testing i/o
+
.......................................................................................................................lua: files.lua:303: assertion failed!
stack traceback:
[C]: in function 'assert'
files.lua:303: in main chunk