[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: io:lines() and \0
- From: Tim Hill <drtimhill@...>
- Date: Fri, 21 Feb 2014 02:01:05 -0800
On Feb 21, 2014, at 12:48 AM, Dirk Laurie <firstname.lastname@example.org> wrote:
> 2014-02-17 17:51 GMT+02:00 René Rebe <email@example.com>:
>> May I suggest replacing the call to fgets in src/liolib.c so that we can
>> read lines with \0 data?
> After 95 messages, 26 of them by the OP mainly pooh-poohing all
> attempts to disagree, let's take stock.
> 1. Anybody besides the OP thinking that this should be done?
> 2. Anybody, even the OP, thinking that the Lua developers
> will do this?
> My vote: 1. No. 2. No.
Well, why is it a BAD idea to do this, other than inertia? Yes, it may be that it gets pushed to the bottom of a priority stack, but is it such a terrible idea to make Lua more robust across platforms?
And in fact there is an irony here. Lua makes a big deal about it’s strings being “8-bit clean”, and yet while the C runtime manages to read a line with an embedded \0, the Lua code muddles up loading it because it uses C string functions in its I/O path. As Rene points out this has nothing to do with text/binary modes.
So my vote:
2. Sadly, no
Rene has found an odd behavior here, and more or less found the cause in the Lua code stack, AND more or less volunteered a patch to fix it. And is apparently being shot down for this.