|
From: | Elias Mårtenson |
Subject: | Re: [Bug-apl] Return value of fgets ignored in lib_file _io. (Was: Re: is there a )copy ⎕fns lik e ⎕ex is )erase) |
Date: | Sat, 26 Apr 2014 23:00:19 +0800 |
Fantastic/wow - you found the bug that fast? What a bunch of great programmers we have behind this grand apl. The whole project has become quite amazing.
If there is anything I can ever help you debug let me know ... I am great at ⍳100 ;)
btw - There is an #apl channel on freenode that has a few non-talking people in it
enztec
On Sat, 26 Apr 2014 15:43:31 +0200
Kacper Gutowski <address@hidden> wrote:
> On 2014-04-26 07:13:21, address@hidden wrote:
> > btw if you can take a look at the FILE_IO code in http://lists.gnu.org/archive/html/bug-apl/2014-04/msg00269.html
> > and give me an idea why the difference between c popen and apl popen - null vs no '10' at end of data still returned - i'd appreciate it
>
> The difference is that there is a bug in lib_file_io.
> When FILE_IO[8] is called dyadically, return value of fgets(3) is silently ignored and garbage is returned.
>
> -k
>
>
>
> Index: src/native/file_io.cc
> ===================================================================
> --- src/native/file_io.cc (revision 224)
> +++ src/native/file_io.cc (working copy)
> @@ -796,7 +796,7 @@
> buffer = del = new char[bytes + 1];
>
> const char * s = fgets(buffer, bytes, fe.fe_file);
> - const int len = strlen(buffer);
> + const int len = s ? strlen(s) : 0;
> Value_P Z(new Value(len, LOC));
> new (&Z->get_ravel(0)) IntCell(0); // prototype
> loop(z, len) new (&Z->get_ravel(z)) IntCell(buffer[z] & 0xFF);
>
>
[Prev in Thread] | Current Thread | [Next in Thread] |