Projects

Ticket #363 (new defect)

Opened 11 months ago

Last modified 11 months ago

IO.copy_stream dont handle copyfile.

Reported by: kazuhisa@… Owned by: lsansonetti@…
Priority: minor Milestone: MacRuby 0.5
Component: MacRuby Keywords:
Cc:

Description

I try to run folloing script.

  src = open("a")
  dst = open("b","w+")
  IO.copy_stream(src,dst)
  src.close
  dst.close

I expected to run via copyfile function . but not. because src/dst object is indicated as not T_FILE by rb_type.(T_NATIVE)

Change History

Changed 11 months ago by lsansonetti@…

Currently, copyfile() is only used if both operands are file paths (strings), otherwise we simulate it.

If an operand is of T_FILE and if its seek offset is 0 and if it has a path, we could potentially use copyfile() too (and update the seek offset in case it's the destination operand).

Changed 11 months ago by kazuhisa@…

ok. understand. but i have one question.

  • why is this routine not ported from matzruby 1.9 without copyfille? if i copied IO via IO.copy_stream, all memory for copy is allocated ( examply fille size is 500M , 1 G)
  • BUILDIN_TYPE should not be called in rb_type before NATIVE(obj) ?
  • why fcopyfile is not used ? the reason is exists? ( sorry i dont know detail of fcopyfile specification .... )

Note: See TracTickets for help on using tickets.