Skip Menu |
Report information
Id: 131145
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: bartolin [at] gmx.de
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Thu, 13 Apr 2017 21:11:07 +0200
To: rakudobug [...] perl.org
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Subject: Modes for IO::Handle.open need clarification
Download (untitled) / with headers
text/plain 1.7k
Some of the newly added tests for IO::Handle.open with different modes fail on the JVM backend. The basic modes (:r, :w, :x, :a) and combinations of those do work as expected, but there are problems with :append and :create and :ra. Just now I found https://github.com/rakudo/rakudo/commit/36f773eb01 where those modes where added (I only looked at docs.perl6.org before). From the commit message I learned: :append was not meant as a synonym for :a :ra was not meant to stand for "read + append" :r, :a was not meant to stand for "read + append" The first one surprised me the most. But indeed :a and :append work differently: $ rm -f foo 2>/dev/null; ./perl6-m -e '"foo".IO.open(:a)'; ls -s foo 0 foo $ rm -f foo 2>/dev/null; ./perl6-m -e '"foo".IO.open(:append)'; ls -s foo Failed to open file /path/to/rakudo.moar/foo: no such file or directory in block <unit> at -e line 1 Actually thrown at: in block <unit> at -e line 1 ls: foo: No such file or directory What poses a problem for rakudo-j is, that :append and :create (without :w) are assumed to mean "read" with Java and those combinations (append + read) and (create + read) do not work well. [2] IMHO a clarification is needed. If we want the additional modes as described in rakudo commit 36f773eb01 (and as implemented, bugs notwithstanding) then we should * define that :append and :create always imply "write" * change the implementation for the JVM backend so that the newly added tests pass * expand the documentation of "open" See also the discussion on #perl6-dev: https://irclog.perlgeek.de/perl6-dev/2017-04-13#i_14424307 [1] https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html#open-java.nio.file.Path-java.util.Set-java.nio.file.attribute.FileAttribute...-
Download (untitled) / with headers
text/plain 184b
On Thu, 13 Apr 2017 12:21:57 -0700, bartolin@gmx.de wrote: Show quoted text
> [...] > * expand the documentation of "open"
That was done by Zoffix++ with https://github.com/perl6/doc/commit/ca2a3a0bfb
Download (untitled) / with headers
text/plain 220b
On Thu, 13 Apr 2017 12:21:57 -0700, bartolin@gmx.de wrote: Show quoted text
> [...] > * define that :append and :create always imply "write"
That was also done by Zoffix++ -- mainly with https://github.com/perl6/roast/commit/091931a717
Download (untitled) / with headers
text/plain 422b
On Sat, 10 Mar 2018 11:40:24 -0800, bartolin@gmx.de wrote: Show quoted text
> On Thu, 13 Apr 2017 12:21:57 -0700, bartolin@gmx.de wrote:
> > [...] > > * define that :append and :create always imply "write"
> > That was also done by Zoffix++ -- mainly with > https://github.com/perl6/roast/commit/091931a717
Sorry, that comment wasn't clear. What I meant was, that the different open modes were specced in S32-io/open.t with said commit.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 274b
On Thu, 13 Apr 2017 12:21:57 -0700, bartolin@gmx.de wrote: Show quoted text
> [...] then we should > > * change the implementation for the JVM backend so that the newly > added tests pass
The tests for open modes are passing now on the JVM backend. I'm closing this ticket as 'resolved'.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org