lua-users home
lua-l archive

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

> 1) Mention in the manual that using f:lines() (or io.lines()) on a non-text
> file may produce inconsistent results.  This maintains the status quo, but
> Lua cannot read a line of bytes containing embedded NUL bytes (that this
> comes up is interesting, but that the last time it came up was eight years
> ago also says something).  This is the easiest solution (and for now, looks
> to be the one picked).

> [1]     Had getline() (or getdelim()) not existed, and René used fgets() in
>         a C implementation, I suspect he might have had to resort to strace
>         to figure out why he wasn't getting all the data, or more data than
>         expected.  I only point this out as an observation.

I'm not so sure it's that obscure. I ran into this problem a couple of months
ago and it took maybe 10 minutes to hexdump the truncated lines to see
what was causing it and about 2 minutes to fix it: