Bug 31805 - man(1) silently fails to create catman file when tty columns are < 66 or > 80
Summary: man(1) silently fails to create catman file when tty columns are < 66 or > 80
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: man
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-03-14 21:58 UTC by Andy Thomas
Modified: 2007-04-18 16:32 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-03-15 09:57:12 UTC
Embargoed:


Attachments (Terms of Use)

Description Andy Thomas 2001-03-14 21:58:11 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt; 
btclick.com Build BTCFMFQ3)


man should be saving formatted catman pages in /var/cache/man/cat1 (as
defined by FHS in /etc/man.config). However for my system this was silently
failing. It took hunting through the source (man.c) to realise that this
is because I am running an xterm with 132 columns and that I needed to
set MANWIDTH to >= 66 or <= 80 to actually save the files. This can be
reproduced by changing stty cols on a normal tty.

Looking in the source I can see in gripedefs.h there is a message defined
for this but it is not called anywhere in the code:

#define NO_CAT_FOR_NONSTD_LL 76

This can be fixed by simply adding two lines to man.c to check for the
condition and print the warning:

# diff -pu man.c.orig man.c 
--- man.c.orig	Wed Mar 14 19:31:20 2001
+++ man.c	Wed Mar 14 19:31:41 2001
@@ -486,6 +486,8 @@ make_roff_command (char *file) {
      /* if window size differs much from 80, try to adapt */
      /* (but write only standard formatted files to the cat directory) */
      ll = setll();
+     if ( ll > 0 )
+             gripe (NO_CAT_FOR_NONSTD_LL);
      pl = setpl();
 
      expander = get_expander (file);

Also, and at least, this should be mentioned in the man page.

I have set the severity as Normal as the workaround is not obvious.


andyt.com

Reproducible: Always
Steps to Reproduce:
1. Ensure the catman file does not already exist in /var/cache/man/cat1, 
if it does rm it.
2. Expand an gnome-terminal window to 132 cols (or do 'stty cols 132' on a 
normal tty)
3. Run the man command, e.g. man bash
4. Look in /var/cache/man/cat1 for the catman file - you will see it has 
not been created.
5. Setting MANWIDTH=80 fixes the problem.

Example:

# stty cols 132
# ls -l /var/cache/man/cat1
total 0
# man bash
[...]
man page displayed
[...]
# ls -l /var/cache/man/cat1
total 0

Setting MANWIDTH works round the problem:

# export MANWIDTH=80
# man bash
Formatting page, please wait...
[...]
man page displayed
[...]
# ls -l /var/cache/man/cat1/*
-r--rw-r--    1 root     man         77011 Mar 14 
21:30 /var/cache/man/cat1/bash.1.gz

Actual Results:  Nothing, the catman file was not created 
in /var/cache/man/cat1

Expected Results:  A catman file should have been created 
in /var/cache/man/cat1


Version of package is man-1.5h1-10.src rpm

If you make the changes to man.c that I have suggested you will get a 
warning message:

# ./man bash
no cat page stored because of nonstandard line length
[...]
man page displayed
[...]

Comment 1 Andy Thomas 2001-03-14 22:48:39 UTC
The fix I supplied wasn't coded well (as I was only) testing, a more proper fix 
is:

# diff -pu man.c.orig man.c 
--- man.c.orig  Wed Mar 14 19:31:20 2001
+++ man.c       Wed Mar 14 22:37:07 2001
@@ -485,7 +485,8 @@ make_roff_command (char *file) {
 
      /* if window size differs much from 80, try to adapt */
      /* (but write only standard formatted files to the cat directory) */
-     ll = setll();
+     if ((ll = setll()))
+         gripe (NO_CAT_FOR_NONSTD_LL);
      pl = setpl();
 
      expander = get_expander (file);


Comment 2 Andy Thomas 2001-03-15 09:57:04 UTC
I realised that the steps to reproduce and results weren't good, here's a 
clearer version:

Steps to Reproduce:

1. Ensure the catman file does not already exist in /var/cache/man/cat1, 
   if it does rm it.
2. Expand an gnome-terminal window to 132 cols (or do 'stty cols 132' on a 
   normal tty)
3. Run the man command, e.g. man bash. You will see no warning message about
   not creating the cat file.

Example:

# stty cols 132
# ls -l /var/cache/man/cat1
total 0
# man bash                         
[...]                                   <<< no warning messasge here
man page displayed
[...]

Actual Results: A warning message similiar to "the catfile will not be created" 
is not displayed.

Expected Results: A warning message similiar to "the catfile will not be 
created" is displayed.

For example in my version:

# ./man bash
no cat page stored because of nonstandard line length
[...]

Comment 3 Bernhard Rosenkraenzer 2001-04-25 09:12:08 UTC
I've discussed this with the base package maintainer - he doesn't want to 
clobber the output by giving this error message.
We've agreed to output the error message if setll() returns non-zero and debug 
is set (man -d or man -D), so people will see what's up if they're trying to 
find out what's happening. This is done in 1.5i-1.




Note You need to log in before you can comment on or make changes to this bug.