This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yudilevi
Recipients Arthur.Darcet, Dave Sawyer, christian.heimes, chroipahtz, denfromufa, eric.araujo, gambl, lars.gustaebel, loewis, rhettinger, rossmclendon, sandro.tosi, serhiy.storchaka, terry.reedy, ubershmekel, victorlee129, yudilevi
Date 2020-04-04.10:26:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585996014.08.0.840756726993.issue6818@roundup.psfhosted.org>
In-reply-to
Content
I wasn't aware of this issue and opened another one which I just closed as a duplicate -
https://bugs.python.org/issue40175

I also submitted a PR for the other one -
https://github.com/python/cpython/pull/19336

The implementation does involve shifting the bytes of the files and updating the offset of each file in the central directory.
I do handle the case in which the central directory order and the order of the actual files in the archive isn't the same simply by sorting the central directory in memory before execution.

The only issue I see here is the fact that if something happens during the process, the archive might get corrupted - but IMO it's worth it.
Many tools provide that functionality (Windows, Total Commander) and as far as I know they do it in place.
In the worst case, it's possible to implement it by creating a temp archive like Serhiy suggested - not too difficult to implement either since it simply requires duplicating the file and operating on it.
History
Date User Action Args
2020-04-04 10:26:54yudilevisetrecipients: + yudilevi, loewis, rhettinger, terry.reedy, lars.gustaebel, christian.heimes, rossmclendon, eric.araujo, ubershmekel, victorlee129, sandro.tosi, chroipahtz, serhiy.storchaka, Arthur.Darcet, Dave Sawyer, gambl, denfromufa
2020-04-04 10:26:54yudilevisetmessageid: <1585996014.08.0.840756726993.issue6818@roundup.psfhosted.org>
2020-04-04 10:26:54yudilevilinkissue6818 messages
2020-04-04 10:26:53yudilevicreate