bazelbuild / bazelbuild/rules_pkg

pkg_files remove the executable permission to generated executable

Open
#786 3 comments 1 reaction 0 assignees View on GitHub
bug P3
Dominant language
Starlark
Stars
253
Forks
221
Avg merge
10h 33m
Merged PRs (30d)
1

Description

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?

Contributor guide

Open the contributing guide

Research direction

Read pkg/mappings.bzl around line 258 and trace how pkg_files passes a cc_binary into pkg_tar. Reproduce the provided foo example and inspect the executable's mode in the resulting tarball. Done means the expected executable permission is preserved rather than being forced to 644.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.