bazelbuild / rules_pkg

Bazel rules for creating packages of many types (zip, tar, deb, rpm, ...)
Apache License 2.0
214 stars 167 forks source link

Cannot set mode for executable files via `mode` on `pkg_tar` #822

Open Strum355 opened 5 months ago

Strum355 commented 5 months ago

Noticed after updating from 0.8.1 to 0.10.1, and narrowed down to most likely being as a result of https://github.com/bazelbuild/rules_pkg/pull/756, specifically the following line, https://github.com/bazelbuild/rules_pkg/blob/main/pkg/private/pkg_files.bzl#L411, its no longer possible to set a mode for executable files via the mode attribute on pkg_tar, as it gets forced to 0o755.

Non-executable files can still be set, as their values don't end up in the manifest (and the manifest takes preference over flags to build_tar.py) due to the default_mode being set to None.

This makes it impossible for us to set a more restrictive mode of 0o555 on executable files.

aiuto commented 4 months ago

Does setting the mode work with pkg_files | pkg_tar?

Strum355 commented 3 months ago

Does setting the mode work with pkg_files | pkg_tar?

Im presuming this means passing a pkg_files target to a pkg_tar's srcs, and setting the attributes in pkg_files instead. I can confirm that does indeed seem to work :slightly_smiling_face: