[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-24 Thread Zoffix Znet via RT
On Mon, 23 Oct 2017 20:05:33 -0700, c...@zoffix.com wrote:
> On Mon, 23 Oct 2017 09:28:47 -0700, b...@post.pl wrote:
> > > And some C++ stackoverflow post claimed this was a bug in standard
> > > library on macos that was fixed in some version already.
> >
> > I'll try to get you Sierra (10.12) and High Sierra (10.13) results
> > tomorrow.
> 
> 
> Added a test (in a branch) that covers the bug:
> https://github.com/perl6/roast/commit/27833272b4
> I also made a MoarVM PR that fixes the bug:
> https://github.com/MoarVM/MoarVM/pull/731
> 
> However, I've no idea if that fix is sane and whether it has
> significant performance impact
> on MacOS (I was using someone's VM for the fix and couldn't get
> reliable spectest or perf measure done).


Thank you for the report. This is now fixed.

Fix:  https://github.com/rakudo/rakudo/commit/eb1febd5658377a
  https://github.com/perl6/nqp/commit/8fa082b269
  https://github.com/MoarVM/MoarVM/commit/27f91344cc
Test: https://github.com/perl6/roast/commit/cb7ec603ccebdb55c


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-24 Thread Zoffix Znet via RT
On Mon, 23 Oct 2017 20:05:33 -0700, c...@zoffix.com wrote:
> On Mon, 23 Oct 2017 09:28:47 -0700, b...@post.pl wrote:
> > > And some C++ stackoverflow post claimed this was a bug in standard
> > > library on macos that was fixed in some version already.
> >
> > I'll try to get you Sierra (10.12) and High Sierra (10.13) results
> > tomorrow.
> 
> 
> Added a test (in a branch) that covers the bug:
> https://github.com/perl6/roast/commit/27833272b4
> I also made a MoarVM PR that fixes the bug:
> https://github.com/MoarVM/MoarVM/pull/731
> 
> However, I've no idea if that fix is sane and whether it has
> significant performance impact
> on MacOS (I was using someone's VM for the fix and couldn't get
> reliable spectest or perf measure done).


Thank you for the report. This is now fixed.

Fix:  https://github.com/rakudo/rakudo/commit/eb1febd5658377a
  https://github.com/perl6/nqp/commit/8fa082b269
  https://github.com/MoarVM/MoarVM/commit/27f91344cc
Test: https://github.com/perl6/roast/commit/cb7ec603ccebdb55c


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-23 Thread Zoffix Znet via RT
On Mon, 23 Oct 2017 09:28:47 -0700, b...@post.pl wrote:
> > And some C++ stackoverflow post claimed this was a bug in standard
> > library on macos that was fixed in some version already.
> 
> I'll try to get you Sierra (10.12) and High Sierra (10.13) results tomorrow.


Added a test (in a branch) that covers the bug: 
https://github.com/perl6/roast/commit/27833272b4
I also made a MoarVM PR that fixes the bug: 
https://github.com/MoarVM/MoarVM/pull/731

However, I've no idea if that fix is sane and whether it has significant 
performance impact
on MacOS (I was using someone's VM for the fix and couldn't get reliable 
spectest or perf measure done).


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-23 Thread Zoffix Znet via RT
On Mon, 23 Oct 2017 09:28:47 -0700, b...@post.pl wrote:
> > And some C++ stackoverflow post claimed this was a bug in standard
> > library on macos that was fixed in some version already.
> 
> I'll try to get you Sierra (10.12) and High Sierra (10.13) results tomorrow.


Added a test (in a branch) that covers the bug: 
https://github.com/perl6/roast/commit/27833272b4
I also made a MoarVM PR that fixes the bug: 
https://github.com/MoarVM/MoarVM/pull/731

However, I've no idea if that fix is sane and whether it has significant 
performance impact
on MacOS (I was using someone's VM for the fix and couldn't get reliable 
spectest or perf measure done).


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-23 Thread Pawel Pabian via RT
> And some C++ stackoverflow post claimed this was a bug in standard
> library on macos that was fixed in some version already.

I'll try to get you Sierra (10.12) and High Sierra (10.13) results tomorrow.


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-23 Thread Zoffix Znet via RT
On Mon, 23 Oct 2017 07:15:56 -0700, coke wrote:
> On Sun, 22 Oct 2017 12:25:07 -0700, b...@post.pl wrote:
> > There is no strace on macOS, I used dtruss (dtrace):
> >
> > $ dtruss -p 1827
> > SYSCALL(args)  = return
> > fstat64(0x0, 0x7FFF5B18B2F0, 0x1)  = 0 0
> > lseek(0x0, 0x0, 0x1)   = 54132 0
> > write(0x1, "Nil\n\0", 0x4) = 4 0
> > thread_selfid(0x0, 0x7F8252ED2090, 0x4)= 24710 0
> >
> >
> >
> 
> This behavior changed on
> https://github.com/rakudo/rakudo/commit/80bbfcdd47bcb27c21352a53a5156a6ecdd41e65
> 
> commit 80bbfcdd47bcb27c21352a53a5156a6ecdd41e65
> Author: Jonathan Worthington 
> Date:   Fri Jul 14 14:24:13 2017 +0200
> 
> Use same slow-path for getc and readchars.
> 
> This will allow fixing the common problem they have near the end of
> the file in one place, as well as giving less code to maintain.
> 
> 
> IRC chat noted the behavior of
> 
> perl6 -e '$*IN.eof.say'
> 
> Is different on OS X and other platforms (True on mac, False
> elsewhere)


More IRC discussion: https://irclog.perlgeek.de/perl6-dev/2017-10-23#i_15341428

Kinda boils down to this snippet saying "STDIN IS: seekable" on Macos, while 
NOT seekable everywhere else:

#include 
#include 
#include 

int main(void) {
int r = lseek(STDIN_FILENO, 0, SEEK_CUR);
printf("STDIN IS: %s\n", (r && r != -1)  ? "seekable" : "NOT seekable");
return 0;
}

And some C++ stackoverflow post claimed this was a bug in standard library on 
macos that was fixed in some version already.


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-23 Thread Zoffix Znet via RT
On Mon, 23 Oct 2017 07:15:56 -0700, coke wrote:
> On Sun, 22 Oct 2017 12:25:07 -0700, b...@post.pl wrote:
> > There is no strace on macOS, I used dtruss (dtrace):
> >
> > $ dtruss -p 1827
> > SYSCALL(args)  = return
> > fstat64(0x0, 0x7FFF5B18B2F0, 0x1)  = 0 0
> > lseek(0x0, 0x0, 0x1)   = 54132 0
> > write(0x1, "Nil\n\0", 0x4) = 4 0
> > thread_selfid(0x0, 0x7F8252ED2090, 0x4)= 24710 0
> >
> >
> >
> 
> This behavior changed on
> https://github.com/rakudo/rakudo/commit/80bbfcdd47bcb27c21352a53a5156a6ecdd41e65
> 
> commit 80bbfcdd47bcb27c21352a53a5156a6ecdd41e65
> Author: Jonathan Worthington 
> Date:   Fri Jul 14 14:24:13 2017 +0200
> 
> Use same slow-path for getc and readchars.
> 
> This will allow fixing the common problem they have near the end of
> the file in one place, as well as giving less code to maintain.
> 
> 
> IRC chat noted the behavior of
> 
> perl6 -e '$*IN.eof.say'
> 
> Is different on OS X and other platforms (True on mac, False
> elsewhere)


More IRC discussion: https://irclog.perlgeek.de/perl6-dev/2017-10-23#i_15341428

Kinda boils down to this snippet saying "STDIN IS: seekable" on Macos, while 
NOT seekable everywhere else:

#include 
#include 
#include 

int main(void) {
int r = lseek(STDIN_FILENO, 0, SEEK_CUR);
printf("STDIN IS: %s\n", (r && r != -1)  ? "seekable" : "NOT seekable");
return 0;
}

And some C++ stackoverflow post claimed this was a bug in standard library on 
macos that was fixed in some version already.


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-23 Thread Will Coleda via RT
On Sun, 22 Oct 2017 12:25:07 -0700, b...@post.pl wrote:
> There is no strace on macOS, I used dtruss (dtrace):
> 
> $ dtruss -p 1827
> SYSCALL(args)  = return
> fstat64(0x0, 0x7FFF5B18B2F0, 0x1)  = 0 0
> lseek(0x0, 0x0, 0x1)   = 54132 0
> write(0x1, "Nil\n\0", 0x4) = 4 0
> thread_selfid(0x0, 0x7F8252ED2090, 0x4)= 24710 0
> 
> 
> 

This behavior changed on 
https://github.com/rakudo/rakudo/commit/80bbfcdd47bcb27c21352a53a5156a6ecdd41e65

commit 80bbfcdd47bcb27c21352a53a5156a6ecdd41e65
Author: Jonathan Worthington 
Date:   Fri Jul 14 14:24:13 2017 +0200

Use same slow-path for getc and readchars.

This will allow fixing the common problem they have near the end of
the file in one place, as well as giving less code to maintain.


IRC chat noted the behavior of

perl6 -e '$*IN.eof.say' 

Is different on OS X and other platforms (True on mac, False elsewhere)

-- 
Will "Coke" Coleda


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-23 Thread Will Coleda via RT
On Sun, 22 Oct 2017 12:25:07 -0700, b...@post.pl wrote:
> There is no strace on macOS, I used dtruss (dtrace):
> 
> $ dtruss -p 1827
> SYSCALL(args)  = return
> fstat64(0x0, 0x7FFF5B18B2F0, 0x1)  = 0 0
> lseek(0x0, 0x0, 0x1)   = 54132 0
> write(0x1, "Nil\n\0", 0x4) = 4 0
> thread_selfid(0x0, 0x7F8252ED2090, 0x4)= 24710 0
> 
> 
> 

This behavior changed on 
https://github.com/rakudo/rakudo/commit/80bbfcdd47bcb27c21352a53a5156a6ecdd41e65

commit 80bbfcdd47bcb27c21352a53a5156a6ecdd41e65
Author: Jonathan Worthington 
Date:   Fri Jul 14 14:24:13 2017 +0200

Use same slow-path for getc and readchars.

This will allow fixing the common problem they have near the end of
the file in one place, as well as giving less code to maintain.


IRC chat noted the behavior of

perl6 -e '$*IN.eof.say' 

Is different on OS X and other platforms (True on mac, False elsewhere)

-- 
Will "Coke" Coleda


[perl #132349] [REGRESSION] $*IN.getc not blocking on macOS

2017-10-23 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
[Coke]++ bisected it to
https://github.com/rakudo/rakudo/commit/80bbfcdd47bcb27c21352a53a5156a6ecdd41e65

On 2017-10-22 12:25:07, b...@post.pl wrote:
> There is no strace on macOS, I used dtruss (dtrace):
>
> $ dtruss -p 1827
> SYSCALL(args) = return
> fstat64(0x0, 0x7FFF5B18B2F0, 0x1) = 0 0
> lseek(0x0, 0x0, 0x1) = 54132 0
> write(0x1, "Nil\n\0", 0x4) = 4 0
> thread_selfid(0x0, 0x7F8252ED2090, 0x4) = 24710 0
>
>
>