afero
afero copied to clipboard
construct a new bytes.Reader per each opened file in tarfs
trafficstars
Closes #486
Currently, every call to Open "copies" the File, but since it has pointer fields, it's not really the kind of clean independent copy that's desired here. Notably, every File shares the same bytes.Reader state.
This causes a few bugs:
- A file which has been read to the end will be unreadable by anyone else.
- Any file which has been
Closed has haddataset tonil, essentially permanently erasing that file.
My proposed solution is to introduce an internal fsEntry type, and to construct a new tarfs.File from that data on each call to Open. Continuing to share a *tar.Header field seems fine, as you shouldn't modify that during normal use.