bazel icon indicating copy to clipboard operation
bazel copied to clipboard

tools/test/test-setup.sh assumes zip is available in test sandbox

Open jsharpe opened this issue 4 years ago • 8 comments

https://github.com/bazelbuild/bazel/blob/8e9d30039d913c883b52b9677f88cb82a0dd00ee/tools/test/test-setup.sh#L418 uses the command zip without considering that it may not be available within the test sandbox.

test-setup.sh should make use of @bazel_tools//tools/zip:zipper to remove this assumption.

jsharpe avatar Mar 16 '21 17:03 jsharpe

There is disconnect unfortunately between flags that zip & zipper supports:

https://github.com/bazelbuild/bazel/blob/030d94cf4cb23c3e4581141774a1b3d8cf828a85/tools/test/test-setup.sh#L430

vs.

Usage: zipper [vxc[fC]] x.zip [-d exdir] [[zip_path1=]file1 ... [zip_pathn=]filen]
  v verbose - list all file in x.zip
  x extract - extract files in x.zip to current directory, or
       an optional directory relative to the current directory
       specified through -d option
  c create  - add files to x.zip
  f flatten - flatten files to use with create or extract operation
  C compress - compress files when using the create operation
x and c cannot be used in 

sfc-gh-ptabor avatar Jun 06 '23 16:06 sfc-gh-ptabor

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

github-actions[bot] avatar Aug 10 '24 01:08 github-actions[bot]

The implicit dependency on zip is now more problematic, since https://github.com/bazelbuild/bazel/commit/8e639dfa8c7aa0723123ee90dc933d528a4f2b68 . With that change and zip missing, undeclared outputs are just summarily deleted.

rpoyner-tri avatar Aug 30 '24 16:08 rpoyner-tri

@alanfalloon as author of https://github.com/bazelbuild/bazel/commit/8e639dfa8c7aa0723123ee90dc933d528a4f2b68 can you comment on why the outputs are deleted if zip isn't present?

jsharpe avatar Aug 30 '24 19:08 jsharpe

Looks like a bug. The rm should probably be conditional on the zip success.

alanfalloon avatar Aug 30 '24 19:08 alanfalloon

One correct answer here is for this to depend on a toolchain type symbol, then even if zip falls through to the system by default, users would be able to register a hermetic zip toolchain to correct that.

alexeagle avatar Sep 27 '24 14:09 alexeagle

Likely most will see this issue vanish as 489d08bf472 propagates.

benjaminp avatar Sep 27 '24 14:09 benjaminp

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

github-actions[bot] avatar Dec 02 '25 01:12 github-actions[bot]