Bug 1113236

Summary: %{_pkgdocdir} isn't automatically packaged
Product: [Fedora] Fedora Reporter: Ralf Corsepius <rc040203>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 22CC: jzeleny, novyjindrich, packaging-team-maint, 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: 2016-07-19 20:05:40 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 Ralf Corsepius 2014-06-25 17:18:30 UTC
Description of problem:
rpmbuild automatically adds %{_pkgdocdir} to packages, which are using %doc <relative filename>.

However, rpmbuild does not automatically add %{_pkgdocdir} to packages, which are directly installing into %{_pkgdocdir} and are not using %doc.

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

How reproducible:
Always.

Steps to Reproduce:
1. Create an rpm.spec which installs all its docs directly into %{_pkgdocdir} in %install.
2. Build this rpm

Actual results:
%{_pkgdocdir} is unowned inside of the resulting rpm.

Expected results:
%{_pkgdocdir} to be automatically owned by a package, if this package ships files inside of %{_pkgdocdir}.

Additional info:
ATM, this behavior forces packagers to explictly add
%dir %{_pkgdocdir}
to such packages' %files.

Comment 1 Panu Matilainen 2014-06-26 06:25:56 UTC
The problem is that %{_pkgdocdir} is in no way special to rpm, its nothing more than a simple macro added by Fedora, 100% the same as doing this in a spec:

---
%define mydir /some/path

...

%files
%{mydir}/bar
---

"Obviously" %{mydir} will not be packaged in this scenario. 

This all goes back to http://rpm.org/ticket/836  which is one of the things I've really come to regret because these side-effects of the "cure" (combined with the new Fedora docdir format and _pkgdocdir confusion to top) are far worse than the disease ever was.

Comment 2 Ralf Corsepius 2014-06-26 07:38:29 UTC
(In reply to Panu Matilainen from comment #1)
> The problem is that %{_pkgdocdir} is in no way special to rpm,
Hmm, I do not understand.

rpm already somehow (no idea how) treats special
%files
%{_pkgdocdir}/<somefile>
insofar, as it automatically marks <somefile> as "doc".

So, can't this mechanism be extended to automatically add %{_pkgdocdir} to %files, if it is non-empty for a package?

> (combined with the new Fedora docdir format and _pkgdocdir confusion to top)
> are far worse than the disease ever was.
Correct. A very brief look into current rawhide reveals many packages are shipping unowned %{_pkgdocdir}'s. 

Unfortunately, the hacked-up script I am currently applying to check rpms for this issue is producing too many falses to provide an estimate of how many packages are affected :-(

Comment 3 Panu Matilainen 2014-06-26 08:09:33 UTC
The magic that turns %{_pkgdocdir}/<somefile> into doc is that %{_pkgdocdir} happens to fall under one of the paths listed in %__docdir_path:

[pmatilai@localhost rpm]$ rpm --eval "%{__docdir_path}"
/usr/share/doc:/usr/share/man:/usr/share/info:/usr/share/gtk-doc/html::/usr/share/man:/usr/share/info:/usr/share/javadoc:/usr/doc:/usr/man:/usr/info:/usr/X11R6/man
[pmatilai@localhost rpm]$

Rpm can't go owning everything under those, so no that mechanism cannot be used.
Anyway, I agree the chaos resulting from these changes needs to be addressed *somehow*, just dont know how exactly.

One possibility might be calculating the directory special %doc would use even when its not used, detect existence of that directory and implicitly own it but warn. Or something... there's also bug 728959 that is kinda related to all this.

Comment 4 Jaroslav Reznik 2015-03-03 16:04:02 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 5 Fedora End Of Life 2016-07-19 20:05:40 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.