Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1741076

Summary: /usr/share/doc/json-c is present in registry.access.redhat.com/ubi8-minimal
Product: Red Hat Enterprise Linux 8 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: json-cAssignee: Joe Orton <jorton>
Status: CLOSED ERRATA QA Contact: Ondrej Mejzlik <omejzlik>
Severity: low Docs Contact:
Priority: low    
Version: 8.0CC: omejzlik, pemensik, pmatilai, psklenar
Target Milestone: rcKeywords: AutoVerified, EasyFix, TestCaseProvided, Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1777815 (view as bug list) Environment:
Last Closed: 2021-05-18 14:47:00 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:
Bug Depends On:    
Bug Blocks: 1777815    

Description Jan Pazdziora (Red Hat) 2019-08-14 08:18:30 UTC
Description of problem:

Container images are typically created with tsflags=nodocs (or its equivalent). However, /usr/share/doc/json-c directory is still present in registry.access.redhat.com/ubi8-minimal image (and registry.access.redhat.com/ubi8).

Version-Release number of selected component (if applicable):

json-c-0.13.1-0.2.el8.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. docker run --rm registry.access.redhat.com/ubi8-minimal ls -la /usr/share/doc/json-c

Actual results:

total 8
drwxr-xr-x. 2 root root 4096 Aug 12  2018 .
drwxr-xr-x. 4 root root 4096 Jul 23 16:18 ..

Expected results:

ls: cannot access '/usr/share/doc/json-c': No such file or directory

Additional info:

The directory /usr/share/doc on the container image is empty apart from the json-c directory and apart from the xz/COPYING file

$ docker run --rm registry.access.redhat.com/ubi8-minimal ls -la /usr/share/doc
total 16
drwxr-xr-x.  4 root root 4096 Jul 23 16:18 .
drwxr-xr-x. 45 root root 4096 Jul 23 16:18 ..
drwxr-xr-x.  2 root root 4096 Aug 12  2018 json-c
drwxr-xr-x.  2 root root 4096 Jul 23 16:17 xz

That makes me think that shipping docs (including the directories) is not expected in these base images and thus json-c could follow suit.

It seems that the difference in behaviour comes from json-c defining

%doc %dir %{_pkgdocdir}

in the .spec file, while other packages use %doc with relative paths to files and let rpm do its work.

Comment 1 Jan Pazdziora (Red Hat) 2019-08-14 08:19:14 UTC
I've also filed bug 1741074 for xz.

Comment 2 Petr Menšík 2019-12-02 21:27:01 UTC
Oh, the empty directory is not useful. But there should be way to mark empty directory as %doc, but it does not seem to work.

Comment 3 Petr Menšík 2019-12-02 21:31:50 UTC
# rpm -qVv json-c
.........  a /usr/lib/.build-id
.........  a /usr/lib/.build-id/18
.........  a /usr/lib/.build-id/18/f2939d6e6ffc72ca6dde301523e18d7ce4b209
.........    /usr/lib64/libjson-c.so.4
.........    /usr/lib64/libjson-c.so.4.0.0
.........    /usr/share/doc/json-c
.........    /usr/share/licenses/json-c
.........  l /usr/share/licenses/json-c/AUTHORS
.........  l /usr/share/licenses/json-c/COPYING


Note both doc and license directories are not marked with correct letter. I think this is RPM bug. But doc directory could be removed from json-c package.

Comment 4 Panu Matilainen 2019-12-03 09:25:43 UTC
A directory is never a piece of documentation or a license, it's a directory.

This is an interesting quirk though: normally --nodocs causes the package doc directory to be skipped because rpm has special logic to skip directory creation if policies such as --nodocs would cause the directory to be empty. That logic doesn't trigger here because the directory is empty to begin with!

The question is, why are you specifically packaging an empty directory in /usr/share/doc/?

Comment 5 Petr Menšík 2019-12-03 19:56:43 UTC
Empty directory is not required in main package and was already removed in Fedora. It is required just in devel subpackage, where it includes few files from doc, but not all of them.
Would it work for devel, when that directory would not be empty?

I think that change was made long ago, in commit [1]. json-c originally served as common base for doc and devel packages and subpackages did not own the directory. When that changed, main package did not stop owning it for no reason.

It seems when --nodocs is used with json-c-devel, it indeed marks (not installed) both files and its directory. The same with doc.

.........    /usr/lib64/pkgconfig/json-c.pc
.........    /usr/share/doc/json-c (not installed)
.........  d /usr/share/doc/json-c/ChangeLog (not installed)
.........  d /usr/share/doc/json-c/README (not installed)
.........  d /usr/share/doc/json-c/README.html (not installed)
.........  d /usr/share/doc/json-c/README.md (not installed)


Ok, directories not possible to list as doc or license seems strange to me. But it has known design (with a weak spot). I think it should be fixed. Would fix the json-c anyway.

1. https://src.fedoraproject.org/rpms/json-c/c/301e4e679aef067f5522dbcbf6a03a1830c26416

Comment 6 Panu Matilainen 2019-12-04 07:35:09 UTC
Documentation or a license is something you can read, a directory is a container and can contain files of arbitrary types, including but not limited to those two types of documents.

There's no way to "fix" this behavior in rpm because packaging empty directories must be supported (hello "filesystem" package).

Comment 7 Petr Menšík 2020-06-01 08:20:43 UTC
Giving up this bz, let new maintainers handle it.

Comment 19 errata-xmlrpc 2021-05-18 14:47:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (json-c bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1601