#1856 Issue closed: Fedora rear.spec: Remove needless use of %defattr

Labels: cleanup, not ReaR / invalid

gdha opened issue at 2018-07-11 08:57:

diff --git a/rear.spec b/rear.spec
index 5d9bdcb..1a67f3d 100644
--- a/rear.spec
+++ b/rear.spec
@@ -145,7 +145,6 @@ echo "30 1 * * * root /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >re
 %{__rm} -rf %{buildroot}

 %files
-%defattr(-, root, root, 0755)
 %doc MAINTAINERS COPYING README.adoc doc/*.txt
 %doc %{_mandir}/man8/rear.8*
 %config(noreplace) %{_sysconfdir}/cron.d/rear

Action: check the Fedora Packaging Guide what they have to say about it: https://fedoraproject.org/wiki/Packaging:Guidelines#File_Permissions

gdha commented at 2018-07-11 09:02:

From the File Permissions section
https://fedoraproject.org/wiki/Packaging:Guidelines#File_Permissions

The default file mode is 0644 or 0755. Directories should be mode 0755.
Most well behaved build scripts and rpm will use these defaults.
If the directory needs to be group writable, it SHOULD also have
the setgid bit set so that files written there are owned by that group.
These directories SHOULD have mode 2775.

The %defattr directive in the %files list SHOULD ONLY be used
when setting a non-default value, or to reset to the default value
after having set a non-default value. 

gdha commented at 2018-07-11 09:03:

@jsmeix The above statement is probably for RHEL based systems. The question is now does this also applies to SLES based systems?

jsmeix commented at 2018-07-11 09:34:

See my https://github.com/rear/rear/issues/1855#issuecomment-404100990

I think our ReaR upstream rear.spec is o.k. as long as our ReaR upstream RPMs
get built o.k. by the openSUSE build service for the various Linux distributions.

FYI:
My own rear.spec at
https://build.opensuse.org/package/view_file/Archiving/rear/rear.spec?expand=1
has

%defattr(-,root,root,-)

jsmeix commented at 2018-07-11 10:20:

As far as I see the "openSUSE:Specfile guidelines"
https://en.opensuse.org/openSUSE:Specfile_guidelines
require that

Every %files section must include a %defattr(...) line.

see
https://en.opensuse.org/openSUSE:Specfile_guidelines#Permissions

Permissions on files must be set properly.
Executables should be set with executable permissions, for example.
Every %files section must include a %defattr(...) line.
Here is a good default:

%files
%defattr(-,root,root)

Unless you have a very good reason to deviate from that,
you should use %defattr(-,root,root) for all %files sections
in your package.
You can use %defattr(-,root,root,0755) to fix permission issues
with directories. E.g. when an umask was too tight while unpacking. 

jsmeix commented at 2018-07-11 10:29:

I think this issue is not a ReaR upstream issue, cf.
https://github.com/rear/rear/issues/1855#issuecomment-404100990

jsmeix commented at 2018-07-16 11:48:

@gdha
provided you agree that this issue is not a ReaR upstream issue,
can we close it or do you need it to be open for some time?

gdha commented at 2018-07-17 08:37:

@jsmeix As OBS requires it I agree that we must keep it. We can close this task.


[Export of Github issue for rear/rear.]