Bug 1296427

Summary: Old timestamp of docs/modifyrepo.1 causes caching the old version
Product: Red Hat Enterprise Linux 6 Reporter: Stanislav Zidek <szidek>
Component: manAssignee: Nikola Forró <nforro>
Status: CLOSED ERRATA QA Contact: Jakub Heger <jheger>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.8CC: bnater, isenfeld, james.antill, nforro, ovasik
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: man-1.6f-38.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 10:04:29 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:
Attachments:
Description Flags
Update cat file timestamps none

Description Stanislav Zidek 2016-01-07 09:03:33 UTC
Description of problem:
After updating from createrepo-0.9.9-22.el6 to createrepo-0.9.9-24.el6, old manpage of modifyrepo is displayed under some circumstances.

Version-Release number of selected component (if applicable):
createrepo-0.9.9-24.el6

How reproducible:
always

Steps to Reproduce:
1. ... install createrepo-0.9.9-22.el6 if not present
2. MANWIDTH=80 man modifyrepo >modifyrepo.before (causes /var/cache/man/cat1/modifyrepo.1.lzma to be created)
3. ... update to createrepo-0.9.9-24.el6
4. MANWIDTH=80 man modifyrepo >modifyrepo.after
5. diff -u modifyrepo.before modifyrepo.after

Actual results:
--- modifyrepo.before	2016-01-07 03:35:58.665998692 -0500
+++ modifyrepo.after	2016-01-07 03:36:31.360000001 -0500
@@ -31,10 +31,6 @@
               used by default.
 
 
-       --no-compress
-              Do not compress the new repodata before adding it to the repo.
-
-
        --compress-type <compress-type>
               Specify which compression type to use: compat (default), xz (may
               not be available), gz, bz2.


Expected results:
(empty output)

Additional info:
This problem is caused by old timestamp of manpage during update (Jan 26  2011), which is preserved during installation - "install -p --verbose" in docs/Makefile.

Comment 1 Stanislav Zidek 2016-01-07 09:18:24 UTC
Correction: actual result is empty output (man page that is shown is same as in old version although it changed) and expected result is the difference shown.

Comment 2 Karel Srot 2016-01-07 11:08:55 UTC
I think this is rather confusing behaviour of the man itself.
Even though I cannot reproduce the issue with exactly your commands (seems that there is a bit difference in my and your sessions when it comes to man output forwarding) below are my observations:

# rpm -q createrepo
createrepo-0.9.9-22.el6.noarch
# find /var/cache/man -name '*modify*'
# man modifyrepo
# # double-check that --no-compress option is listed
# find /var/cache/man -name '*modify*'
# # see, no cache was created
# MANWIDTH=80 man modifyrepo 
Formatting page, please wait...
# 
# find /var/cache/man -name '*modify*'
/var/cache/man/cat1/modifyrepo.1.lzma
# # wow, now we have a cache
# ls -l /var/cache/man/cat1/modifyrepo.1.lzma
-r--r--r--. 1 root root 1104 Jan  7 06:03 /var/cache/man/cat1/modifyrepo.1.lzma
# 
# rpm -Uvh http://download.devel.redhat.com/brewroot/packages/createrepo/0.9.9/24.el6/noarch/createrepo-0.9.9-24.el6.noarch.rpm
Retrieving http://download.devel.redhat.com/brewroot/packages/createrepo/0.9.9/24.el6/noarch/createrepo-0.9.9-24.el6.noarch.rpm
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]
# man modifyrepo
# # no-compress option is not listed anymore, this is correct
# MANWIDTH=80 man modifyrepo 
# # this time no-compress option is listed as the cache was used


# # btw
# man modifyrepo > a
# MANWIDTH=80 man modifyrepo > b
# diff a b
# # surprisingly, there is not difference, let's check those files
# less a
# less b
# # nope, non of them contained the no-compress option (i.e. new man page version was listed)

Comment 3 Karel Srot 2016-01-07 11:11:54 UTC
Just for completeness, man version was man-1.6f-32.el6.x86_64.

Comment 4 Nikola Forró 2016-01-08 11:10:46 UTC
(In reply to Karel Srot from comment #2)
> I think this is rather confusing behaviour of the man itself.
Maybe it is confusing, but man only creates and uses cached cat files if output device is 80 columns wide TTY.

So the original problem is reproducible if output is not redirected to files:

Steps to Reproduce:
1. ... install createrepo-0.9.9-22.el6 if not present
2. MANWIDTH=80 man modifyrepo (causes /var/cache/man/cat1/modifyrepo.1.lzma to be created)
3. --no-compress option is listed
4. ... update to createrepo-0.9.9-24.el6
5. MANWIDTH=80 man modifyrepo
6. --no-compress option is still listed

Comment 5 Stanislav Zidek 2016-01-08 11:49:05 UTC
Sorry about the confusion, it's true that you cannot see the problem while redirecting the output of "man modifyrepo".

I think that Karel was suggesting that the current way of caching is not correct (only comparing mtime in is_newer function). I am however not sure if this can be reasonably done in some other way (like storing the precise mtime of the manpage from which was the cache made..?).

The issue can be also solved by not preserving the mtime of the man page of rpm during install (install -p in createrepo doc/Makefile). I am not sure what is the best practice here; is it said somewhere (in packaging guidelines maybe?) that the preserving of the mtime (install -p) should not be done?

Comment 6 Nikola Forró 2016-01-08 12:51:28 UTC
You are right, this should be resolved in man. The same issue can manifest itself with any updated package containing man pages.

man-db seems to avoid this by updating mtime of the newly created cat file to match mtime of the original man page. We could use the same approach in man.

Comment 7 Nikola Forró 2016-01-08 14:40:47 UTC
Created attachment 1112894 [details]
Update cat file timestamps

Comment 14 errata-xmlrpc 2017-03-21 10:04:29 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, 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://rhn.redhat.com/errata/RHBA-2017-0645.html