# New Ticket Created by  Maxim Vuets 
# Please include the string:  [perl #123406]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=123406 >


Rakudo+MoarVM dies on attempt to open a symlink:

    ~$ ls -l /etc/system-release
    lrwxrwxrwx. 1 root root 14 Mar 30  2014 /etc/system-release -> 
fedora-release

    ~$ ls -l /etc/fedora-release 
    -rw-r--r--. 1 root root 30 Feb 19  2014 /etc/fedora-release

    ~$ cat /etc/system-release
    Fedora release 20 (Heisenbug)

    ~$ perl6 -e 'say open("/etc/system-release").get;'
    Failed to stat in filehandle: no such file or directory
      in method eof at src/gen/m-CORE.setting:15551
      in method get at src/gen/m-CORE.setting:15555
      in block <unit> at -e:1

slurp() works though:

    ~$ perl6 -e 'say slurp("/etc/system-release")'
    Fedora release 20 (Heisenbug)

**NB.** It is tricky to reproduce, it has to do something with CWD:

    ~$ cd /tmp
    /tmp$ pwd
    /tmp
    /tmp$ echo hi >file
    /tmp$ ln -s file link
    /tmp$ perl6 -e 'say open("link").get'
    hi
    /tmp$ perl6 -e 'say open("/tmp/link").get'
    hi
    /tmp$ cd /
    /$ perl6 -e 'say open("/tmp/link").get'
    Failed to stat in filehandle: no such file or directory
      in method eof at src/gen/m-CORE.setting:15551
      in method get at src/gen/m-CORE.setting:15555
      in block <unit> at -e:1

Here's hoelzro++ input:

> I know why
> it reads the link with readlink
> and then it tries to stat *that*
> if it's a relative path (which is resolved by the kernel as relative to the 
> *symlink*, not the CWD)
> perl6 freaks out!
> I'm wondering why the hell it's stat'ing
> esp. based on the *filename*
> that's a race condition waiting to happen

This is perl6 version 2014.11-75-gc91a583 built on MoarVM version 
2014.11-66-g23f2089

Reply via email to