rules_pkg icon indicating copy to clipboard operation
rules_pkg copied to clipboard

pkg_files remove the executable permission to generated executable

Open CareF opened this issue 1 year ago • 1 comments

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?

CareF avatar Nov 22 '23 01:11 CareF

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

dieortin avatar Mar 19 '24 17:03 dieortin