Bug 1116373

Summary: having "%doc FILE" in %files surprisingly adds all of %{_pkgdocdir} to the package
Product: [Fedora] Fedora Reporter: Michal Schmidt <mschmidt>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: jzeleny, lkardos, novyjindrich, packaging-team-maint, pmatilai, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-17 12:48:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Schmidt 2014-07-04 11:06:06 UTC
Description of problem:
When a spec file lists "%doc FILE" in its %files section, rpmbuild adds not just FILE to the package, but also the whole %_pkgdocdir directory with all its contents.

Example spec file:

Name:         testdoc
Version:      1
Release:      1%{?dist}
Summary:      test for spec file doc directive
License:      BSD

%description
Test for the behavior of the doc directive

%prep
echo "BSD" > COPYING
%build
%install
mkdir -p %{buildroot}/%{_datadir}/doc/testdoc
echo "Hello" > %{buildroot}/%{_datadir}/doc/testdoc/readme.txt

%files
%doc COPYING

%changelog
* Fri Jul 04 2014 Michal Schmidt <mschmidt> 1-1
- first version


Version-Release number of selected component (if applicable):
rpm-4.11.2-2.fc20.x86_64

How reproducible:
always

Steps to Reproduce:
1. rpmbuild -bb testdoc.spec
2. rpm -qlp testdoc-1-1.fc20.x86_64.rpm

Actual results:
It lists the following package contents:
/usr/share/doc/testdoc
/usr/share/doc/testdoc/COPYING
/usr/share/doc/testdoc/readme.txt

Expected results:
I did not expect readme.txt to be packaged.

Additional info:
I noticed this because of hitting a file conflict between dbus-1.6.12-9.fc20.x86_64 and dbus-doc-1.6.12-9.fc20.noarch, where all the documentation files are accidentally included in the main dbus package too even though the author clearly only wanted to have the COPYING file there.
This may be expected behavior, but it is not obvious.

Comment 1 Panu Matilainen 2014-07-07 07:05:30 UTC
Yup... see bug 728959, whose dupe this mostly/effectively is, and also bug 1113236 and bug 1113233 revolve around the same issue.

Comment 2 Ľuboš Kardoš 2015-04-17 12:48:19 UTC

*** This bug has been marked as a duplicate of bug 728959 ***