bugDatabase-driven manual pager suite - Bugs: bug #55731, cat files need metadata to...

 
 

bug #55731: cat files need metadata to determine whether they contain what the user has asked for

Submitter:  Dave <barx>
Submitted:  Sun 17 Feb 2019 12:00:38 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  cjwatson
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 26 Aug 2019 04:46:43 PM UTC, comment #7: 

Fixed in man-db 2.8.7.

Colin Watson <cjwatson>
Group administrator
Thu 22 Aug 2019 09:28:37 PM UTC, comment #6: 
Colin Watson <cjwatson>
Group administrator
Wed 21 Aug 2019 10:10:05 PM UTC, comment #5: 

comment #4:

> But in general, if man believes that conditions are such that
> it shouldn't save a cat file, then it also won't display an
> existing one.


Ah, OK.  The man page for man(1) is evasive on this: it says "this preformatted file is (usually) decompressed and then displayed" without specifying what the unusual conditions are that cause the cat file to be ignored.

But given this new information, I agree that your proposed solution makes the most sense.

Dave <barx>
Wed 21 Aug 2019 01:03:06 PM UTC, comment #4: 

But in general, if man believes that conditions are such that it shouldn't save a cat file, then it also won't display an existing one.  Disabling saving cats on --no-hyphenation or --no-justification would also have the effect of causing man not to use those cat pages for display if either of those options is set.

Given this, I think it would make more sense to consider the canonical state to be the one that's more likely to happen in practice, i.e. the one that requires fewer options to be set.

Colin Watson <cjwatson>
Group administrator
Mon 19 Aug 2019 11:29:07 PM UTC, comment #3: 

Looks like I didn't address this question:

comment #1:

> Do you actually consider it important to have cat files,
> and if so why?


I was unaware cat files even existed until I looked into what was causing this bug.

Now that I've done some testing, I do notice several seconds of delay when processing a large man page like bash(1) anew vs looking at the cat file, at least on my ancient and underpowered system.  So they're not without value, but I wouldn't mourn them if they disappeared either.

In the end, having no cat file is preferable to having one that causes the man page to display incorrectly.  (And that problem is made worse because once alice figures out what is going on, she still cannot fix it unless she has superuser privileges and can delete the offending cat file.  This is because man(1) doesn't provide a documented option to bypass a cat file and instead display a man page from source.)

Dave <barx>
Fri 16 Aug 2019 08:37:17 PM UTC, comment #2: 

The thing is, there isn't a --justification or --hyphenation option.  So bob, who prefers justification and hyphenation, cannot actually enforce this on all man pages: if the man-page source turns these things off, bob has no switch to turn them back on.  So bob will already get a mix of hyphenated and unhyphenated pages.

On the other hand, alice has complete control over her preferences: by always specifying --no-justification and --no-hyphenation, she disables these features regardless of what any given man-page source specifies.  All her man pages (absent this bug) will be unjustified and unhyphenated.

So for the purposes of this bug, cat file generation ought to be disabled if justification or hyphenation is turned on, not off.  That's the only way to ensure alice sees all man pages with the options she's giving.  Since bob will already see a mix of hyphenated and unhyphenated pages, there's no help for him.

And despite either user's personal preferences, hyphenation in particular actually breaks certain things, such as searches.  So from this standpoint, it is also better to only generate cat files when hyphenation is turned off.

Generating cat files only for some kind of "canonical" state of output makes sense as a policy decision.  For the above reasons, I think --no-justification and --no-hyphenation should be considered the more canonical forms.

Dave <barx>
Thu 08 Aug 2019 10:31:43 PM UTC, comment #1: 

I can see how some kind of metadata would be useful, but cat files are kind of a lost cause - I wouldn't have designed them the way they are at all - and some time ago I mostly just resorted to disabling them except when the output is expected to be in some kind of "canonical" state.  Do you actually consider it important to have cat files, and if so why?  Would it be sufficient for the purposes of this bug report to just disable cat file generation if either --no-justification or --no-hyphenation is provided?

Colin Watson <cjwatson>
Group administrator
Sun 17 Feb 2019 12:00:38 PM UTC, original submission:  

Consider a system with two users, alice and bob.

~alice/.bashrc contains this line:

export MANOPT="--no-justification --no-hyphenation"

~bob/ contains no dot files that set MANOPT.

bob runs the command "man bash".  This displays the bash man page on his terminal, and creates the file /var/cache/man/cat1/bash.1.gz.  This cat file contains justified text and hyphenation, because these are the defaults, and bob has not overridden them.

Now alice runs the command "man bash".  This displays the contents of /var/cache/man/cat1/bash.1.gz on her terminal, including justification and hyphenation (since that is how it was stored when bob's run of "man bash" created the file), thus violating the options alice has given the man command.  Being unaware of the internals of the man system and cat files, alice spends the next 45 minutes trying to debug why her .bashrc settings are not being honored.

To solve this, along with a cat file, man needs to store metadata about the file's display settings, so that it knows whether displaying a cat file will give users what they have requested, or whether it needs to generate output anew from the roff file (and possibly store this new output as a cat file (with different metadata), alongside or overwriting the existing cat file).

(This is related to, but does not seem to be the same as, bug #48651.  That bug reports that catman is incapable of producing cat files with --no-justification and --no-hyphenation settings.  But if a cat file does not exist, and alice is the first to run "man bash", the cat file produced does incorporate her --no-justification and --no-hyphenation settings, then giving bob incorrect (though less obviously so) output.)

Dave <barx>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cjwatson (Posted a comment)
  • -email is unavailable- added by barx (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-08-26 cjwatson StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-08-22 cjwatson StatusNeed Info Ready For Test
        Assigned toNone cjwatson
    2019-08-08 cjwatson StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code