Bug 133391

Summary: RFE: add __defattr macro
Product: [Fedora] Fedora Reporter: Anders F Björklund <afb>
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED WONTFIX QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: nobody+pnasrat
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-18 03:12:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Anders F Björklund 2004-09-23 17:57:20 UTC
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)
%else
%define __rootattr %defattr(-,root,wheel)
%endif

Then you can just use a construct like this later:

%files
%{__rootattr}
%doc README
%{_bindir}/*

Makes things neater, to avoid that %if everywhere ?


BTW;
Here is the entry from /etc/group (and friends):
wheel:*:0:root
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 19:03:16 UTC
Some old code used __defattr, but I thought
__rootattr was more obvious? Either is fine.

Comment 2 Anders F Björklund 2004-09-23 19:19:04 UTC
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 23:49:12 UTC
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 07:07:45 UTC
Meanwhile, each spec "ported" to Darwin uses:

%files
%{__defattr}

With the __defattr defined locally in the spec.

Comment 5 Jeff Johnson 2006-03-18 03:12:05 UTC
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.