Actions
Bug #11915
closedFile.read reading string starting with | executes it.
Bug #11915:
File.read reading string starting with | executes it.
Actions
Added by yxhuvud (Linus Sellberg) over 10 years ago. Updated about 7 years ago.
Linus Sellberg wrote:
It is one thing that some of the
.openmethods actually can execute stuff, but a method named 'read' should not behave like that.
File.open does not.
Some class methods of IO, e.g. IO.foreach and IO.read, deal with a pipeline.
Seems a documentation issue.
Nobuyoshi Nakada wrote:
Linus Sellberg wrote:
It is one thing that some of the
.openmethods actually can execute stuff, but a method named 'read' should not behave like that.
File.opendoes not.
But File.read DOES. Which is what I find wrong. That File.open doesn't is another reason to not have .read do that.
People should (hopefully) always read files with an absolute path prefix, but something like this could be surprising:
(Yes, it's a contrived example.)
It makes sense if IO handles pipes, but File should probably mean real files.