build: the generated defaults header is written 0600, so a seat outside nevr-build cannot read it

Open Beginner friendly
#2,901 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cmake, cpp

Research direction

Read cmake/nevr_builtin_defaults.cmake around lines 87–89 and the requested static guard under tools/tests/. First run the guard against the base and confirm it fails because GROUP_READ is absent; then add GROUP_READ and verify the guard passes. A configure outside the build checkout should produce a group-readable generated/nevr_builtin_defaults.h; the issue specifies that the end-to-end worktree setup check is out of scope.

Written by the indexing model from the issue text.

Description

backlog

Evidence at 65630999e

The generator of the build-time defaults header sets the file to owner-only permissions. cmake/nevr_builtin_defaults.cmake, the
configure_file call that writes ${CMAKE_BINARY_DIR}/generated/nevr_builtin_defaults.h:

configure_file("${root}/cmake/nevr_builtin_defaults.h.in"
               "${CMAKE_BINARY_DIR}/generated/nevr_builtin_defaults.h" @ONLY
               FILE_PERMISSIONS OWNER_READ OWNER_WRITE)

(cmake/nevr_builtin_defaults.cmake:87-89). No group or other read bit is granted. The template cmake/nevr_builtin_defaults.h.in
is mode 664, so the explicit FILE_PERMISSIONS is what makes the output 600.

Measured on the shared build checkout (<work root>/build-checkout/nevr-runtime, read only):

  • stat -c '%a %U:%G %s' build/mingw-release/generated/nevr_builtin_defaults.h prints 600 nevr-build:nevr-src 561.
  • find build -perm 600 in that checkout lists this one file and nothing else.

The checkout is shared by the group nevr-src. A seat whose user is not nevr-build cannot read the file, so
just worktree-setup fails while it copies the generated files into a new worktree, with cp: cannot open ... Permission denied, and the build tree is not created. That failure was reported by the merge seat; this issue does not repeat it.

Not shown

  • The worktree-setup failure itself was not re-run from a seat whose user is not nevr-build. The claim that it is the
    generator's mode rests on the mode of the file and the configure_file line above.
  • No other generator in the tree writes nevr_builtin_defaults.h: the only configure_file for it is the one above (searched
    with grep -rn nevr_builtin_defaults over cmake/, CMakeLists.txt, src/quest/CMakeLists.txt and tools/).
  • Whether other build trees, outside build-checkout, hold files of mode 600 was not measured.

Falsifier

A configure of the tree at 65630999e that leaves generated/nevr_builtin_defaults.h with a mode that has no group read bit,
while the configure_file line above is unchanged, would show that this line is not the cause.

Work

  1. Test first: a static guard in tools/tests/ reads cmake/nevr_builtin_defaults.cmake and asserts that the configure_file
    for the defaults header grants group read (GROUP_READ in its FILE_PERMISSIONS). Run it against the base; it must fail there.
  2. Add GROUP_READ to the FILE_PERMISSIONS of that configure_file call, so the generated header is 640.
  3. Mutant: remove GROUP_READ again and show the guard fails with its output; restore it and show it passes.
  4. Check, by a configure of a worktree that is not the build checkout, that the generated header is group-readable; the
    worktree-setup run by a seat whose user is not nevr-build is the end-to-end check, and it is not run by this issue.
Dominant language
C++
Stars
3
Forks
5
Avg merge
4h 37m
Merged PRs (30d)
524

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EchoTools/nevr-runtime

All issues in EchoTools/nevr-runtime

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.