1
votes

I am creating an RPM spec file with a %files section that specifies ownership of the included files. I am trying to specify the user and group as follows:

...
%attr (755, DOMAIN\\user, "DOMAIN\\domain users") /opt/whatever
...

The user seems to work but the space in the group name causes the syntax check to fail on rpmbuild. This link seems to suggest that standard globbing rules apply and that spaces must exist within double quotes but this doesn't seem to fix the problem. Any ideas?

1
The syntax for an %attr entry is %attr(mode,user,group), you seem to be missing a comma. Or is that a copy/paste error? - fge
Yes, sorry that was just a copy/paste error. Fixed. - nweiler
I have tried quite a few things and it looks like spaces are indeed not supported in %attr. Looks like a limitation. - fge
Try to remove the space before the opening parenthesis. By the way why do you want to hardcode this into an RPM? This does not make sense at all. RPMs are usually generic. What is your usecase? - lzap
Thanks. Yes, but in our case the files must belong to a specific group in all cases. Our RPMs are not intended for wider distribution but rather to ease install/uninstall and increase traceability. - nweiler

1 Answers

1
votes

Yes spaces aren't permitted in file user/group tags.

The simplest fix is not to use %attr, but to set the user/group in the %post script let.

To set user/group in %post pedantically correctly, one should also disable user/group checking by rpm -V using a prepended %verify directive in the spec %files, and then add a %verifyscript (that is run by rpm --verify|-V) to verify that the settings in the %post scriptlet are correct.