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

pkg_files remove the executable permission to generated executable #786

Open CareF opened 7 months ago

CareF commented 7 months ago

Say I have

cc_binary(
    name = "foo",
    ....
)

pkg_files(
    name = "foo_files",
    srcs = [":foo"],  # in practice it also include other files to become a group
)

pkg_tar(
    name = "foo_tar",
    srcs = [":foo_files"],
)

The foo file in the tarball will have permission 644:

https://github.com/bazelbuild/rules_pkg/blob/3917ae64448da126ded00197a4cc99ac43e2b20f/pkg/mappings.bzl#L258

It seems to me counter intuitive. Should the above line be None rather than 644? or am I misunderstood the usage of pkg_files?

dieortin commented 4 months ago

When adding files to a PackageFilesInfo from DefaultInfo, the executable is detected and its permissions are changed to 0755 https://github.com/bazelbuild/rules_pkg/blob/c53ff51070c96b368188f057a6683d97c31b77f7/pkg/private/pkg_files.bzl#L411

I'm not sure why that wouldn't be happening here