Skip Menu |
Report information
Id: 131145
Status: new
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...-


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