Hide Forgot
I have a spec file with %files %attr(0755,root,root) %{_initrddir}/quota_nld resulting binary package built by rpm-build-4.8.0-12 owns not only %{_initrddir}/quota_nld file, but all components of %{_initrddir} except leading /etc too: # rpm -q -l -p ~/rpmbuild/RPMS/x86_64/quota-3.17-11.el6.x86_64.rpm |grep etc /etc/quotagrpadmins /etc/quotatab /etc/rc.d ← /etc/rc.d/init.d ← /etc/rc.d/init.d/quota_nld /etc/sysconfig /etc/sysconfig/quota_nld /etc/warnquota.conf Is is O.k.? You can check it with latest quota package (https://brewweb.devel.redhat.com/buildinfo?buildID=155839).
Globs match directories too, this is what causes the package to own the directories too: %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/* In other words, it's a packaging issue, not an rpm bug.
I agree %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/* matches direct subdirectories under %{_sysconfdir}, however I have this code: %attr(0755,root,root) %{_initrddir}/quota_nld and resulting ownership is /etc/rc.d, /etc/rc.d/init.d, and /etc/rc.d/init.d/quota_nld. This is not what I expected, nor you described.
I see, %{_sysconfdir} is /etc, thous it owns everything under /etc. Thanks for finding the packaging bug.