The issue is simple and simple enough for a beginner to fall foul of - test procedure:
Change directory to any directory with files in totally a few 10s of megs (ideally but it doesn't matter much).
python -m zipfile -c my_zipfile.zip .
Wait a few minutes and press control-C then do a directory - you will find that my_zipfile.zip is huge (much bigger than the total of the files in the original directory). The same applies to tarfile.
If you fail to hit control-C soon enough (how long depends on the spare space on the current drive) it will crash when it runs out of disk space, possibly, on some systems, requiring a format and re-install of the OS.
The cause of the problem is that when zipfile &/or tarfile is archiving to a file in the current directory it tries to add the target file to the input list and you have an Ouroboros situation. The fix is also simple - exclude the target file from the permitted inputs.
I have seen this happen in the wild, I do know that python is not the only archiving tool that suffers from this problem but that seems to me to be no reason not to address this.
If write were patched to simply count the bytes but not write the file then the problem would not occur so I guess that it would need to be patched in a transparent manner.
Steve Barnes
-----Original Message-----
From: remi.lapeyre@henki.fr