fixes #6275 - idempotence needs clone of original data and to handle *_port
Replace Kernel#open with File.open