Describe the current behavior
gfile.Copy(overwrite=True) does not truncate the destination file before overwriting. That means if the src file is shorter than the dest file, the resulting dest file contains the mix of the two.
Describe the expected behavior
gfile.Copy(overwrite=True) results in having the exact same content of src file in the dest file.
Code to reproduce the issue
$ echo 'aaa' > a.txt
$ echo 'bbbbbb' > b.txt
$ python3 -c "from tensorflow import gfile; gfile.Copy('a.txt', 'b.txt', overwrite=True)"
$ cat b.txt
aaa
bb
Tested with pip3 install tensorflow==1.13.1, python 3.5.2
b.txt should have aaa as the content, not aaa\nbb.
Ref. https://www.tensorflow.org/api_docs/python/tf/gfile/Copy
Describe the current behavior
gfile.Copy(overwrite=True)does not truncate the destination file before overwriting. That means if the src file is shorter than the dest file, the resulting dest file contains the mix of the two.Describe the expected behavior
gfile.Copy(overwrite=True)results in having the exact same content of src file in the dest file.Code to reproduce the issue
Tested with
pip3 install tensorflow==1.13.1, python 3.5.2b.txtshould haveaaaas the content, notaaa\nbb.Ref. https://www.tensorflow.org/api_docs/python/tf/gfile/Copy