To answer myself, it's a known bug reported over a year ago :-( https://rt.perl.org/Public/Bug/Display.html?id=127772
On 18 September 2017 at 16:18, Norman Gaywood <ngayw...@une.edu.au> wrote: > $ perl6 -v > This is Rakudo version 2017.07 built on MoarVM version 2017.07 > implementing Perl 6.c. > $ perl6 > To exit type 'exit' or '^D' > > '/'.IO.d > True > > try { mkdir '/' } > "/".IO > > if $! { say "Fail" } else { say "Bazinga" } > Bazinga > > So the mkdir / would have failed because the dir exists. But it is a .d > so maybe that's ok. > > Lets try mkdir on an existing file that we also have permissions to modify. > > > 'afile'.IO.d > False > > 'afile'.IO.e > True > > try { mkdir 'afile' } > "afile".IO > > if $! { say "Fail" } else { say "Bazinga" } > Bazinga > > 'afile'.IO.d > False > > > > Surely that mkdir should fail? > > mkdir does fail properly sometimes: > > > try { mkdir '/root/noway' } > Nil > > if $! { say "Fail" } else { say "Bazinga" } > Fail > > In perl5: > > DB<3> mkdir "afile" or warn "$!\n" > File exists > DB<4> mkdir "/" or warn "$!\n" > File exists > DB<5> mkdir "/root/noway" or warn "$!\n" > Permission denied > DB<6> mkdir "adir" or warn "$!\n" > > DB<7> mkdir "adir" or warn "$!\n" > File exists > > -- > Norman Gaywood, Computer Systems Officer > School of Science and Technology > University of New England > Armidale NSW 2351, Australia > > ngayw...@une.edu.au http://turing.une.edu.au/~ngaywood > Phone: +61 (0)2 6773 2412 <(02)%206773%202412> Mobile: +61 (0)4 7862 0062 > > Please avoid sending me Word or Power Point attachments. > See http://www.gnu.org/philosophy/no-word-attachments.html > -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au http://turing.une.edu.au/~ngaywood Phone: +61 (0)2 6773 2412 Mobile: +61 (0)4 7862 0062 Please avoid sending me Word or Power Point attachments. See http://www.gnu.org/philosophy/no-word-attachments.html