Bug 133391 - RFE: add __defattr macro
RFE: add __defattr macro
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
Mike McLean
: FutureFeature
Depends On:
  Show dependency treegraph
Reported: 2004-09-23 13:57 EDT by Anders F Björklund
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-03-17 22:12:05 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Anders F Björklund 2004-09-23 13:57:20 EDT
Description of problem:

Not all platforms have a "root" group as number 0.
On Darwin and Mac OS X, for instance, it's "wheel".

Here is a macro that can be used for the %files:

%ifnos darwin
%define __rootattr %defattr(-,root,root)
%define __rootattr %defattr(-,root,wheel)

Then you can just use a construct like this later:


Makes things neater, to avoid that %if everywhere ?

Here is the entry from /etc/group (and friends):
And here is the matching entry from /etc/passwd:
root:*:0:0:System Administrator:/var/root:/bin/sh
Comment 1 Anders F Björklund 2004-09-23 15:03:16 EDT
Some old code used __defattr, but I thought
__rootattr was more obvious? Either is fine.
Comment 2 Anders F Björklund 2004-09-23 15:19:04 EDT
Sorry, checked with some more spec files and
__defattr would be much a better choice here...

So __defattr it is. (awaiting any feedback)
Comment 3 Jeff Johnson 2004-09-23 19:49:12 EDT
What really needs doing is to automagically add %defattr
to every %files in every package so that root/wheel issues
can be fixed as part of build configuration, not in every
bleeping package spec file.

There is no case where adding %defattr after %files is
not the Right Thing To Do. Coreespondingly,
there is no case that not adding %defattr is ever correct.

So a deeper change, not just hiding "wheel" behind a macro,
is what is really needed.
Comment 4 Anders F Björklund 2004-09-24 03:07:45 EDT
Meanwhile, each spec "ported" to Darwin uses:


With the __defattr defined locally in the spec.
Comment 5 Jeff Johnson 2006-03-17 22:12:05 EST
There's nothing preventing configuring and using %{__defattr} to hide a default "wheel"
group. Changing default packaging styles to use %{__defattr} everywhere ain't likely to happen.

Note You need to log in before you can comment on or make changes to this bug.