Skip to content

Conversation

@jnavarrorb
Copy link
Contributor

Related issue in RedMine

Fix incorrect file permissions in packaged cookbook
[https://redmine.redborder.lan/issues/18458]

Description / Motivation

The cookbook RPM installs with incorrect file permissions: all files inside /var/chef/cookbooks/druid are marked as executable (0755), including .rb, .erb and other files that do not require execution permissions.

This PR fixes the packaging spec to prevent unnecessary +x on non-executable files.

Detail

The issue stems from the use of %defattr(0755,root,root) under the %files section in the RPM spec file. This directive recursively applies 0755 permissions to all files listed, causing .rb, .erb, and other files to be installed with executable permission.

To fix this,

%defattr(0755,root,root)
/var/chef/cookbooks/"name"

has been changed to:

%defattr(0644,root,root)
%attr(0755,root,root)
/var/chef/cookbooks/"name"

This ensures that:

All files receive default 0644 permissions (readable, writable by root, not executable).

The cookbook directory /var/chef/cookbooks/"name" is still executable so Chef can access its contents properly.

This avoids granting execution rights to source files unnecessarily.

Additional information

This issue does not affect Chef’s ability to run recipes, since execution of the files is handled by the Chef interpreter, not directly by the shell.

@rgomezborder rgomezborder merged commit 88bff34 into development Jul 25, 2025
2 checks passed
@rgomezborder rgomezborder deleted the improvement/18458_Remove_x_permissions_on_cookbook_templates branch July 25, 2025 11:26
@rgomezborder rgomezborder mentioned this pull request Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants