[8.6.0] zipper: handle empty filelist #28425
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
updates the zipper utility so it can handle empty filelists. previously this would fail with
(note the double space)
rather than being treated as an empty list (
[]), an empty filelist was being treated as a non-empty list of length one with the only element being an empty string ([''])Why on earth do I want this? I have a rule that outputs a zip file that may or may not be empty. There is no easy way to tell ahead of time if there will be files. The output could be optional, but that would make my life harder for reasons that I can't be bothered explaining (feel free to push on this if it's important).
@bazel_tools//tools/zip:zipperfails if the filelist is empty and I am working around this by manually creating an empty zip file using the EOCD record:it would be nice if I didn't have to do this :)
Closes #27008.
PiperOrigin-RevId: 812683346
Change-Id: Ifb7dc35b37ce9c07e53786206e90570da542fab7
Commit 349f6fb