1

I am in the process of learning the usage of iscsiadm and somehow I noticed a strange behavior of grep.

Attempting to run the following grep command man iscsiadm | grep "aia" results in troff:<standard input>:498: warning: cannot select font 'i'.

I played around and found out that the error does not occur when I grep for ia or ai, therefore, it must be caused by the specific pattern aia.

Can anyone offer an explanation for this behavior?

EDIT

@telcoM

I ran both command and both files contain the same error; They are in fact equal and yes, I don't see the error message in the console any longer. Both files contain the same error message as before.

@TheNotoriousGBR

It seems like you are right. I ran the command zgrep '\\fi' $(man -w iscsiadm) and in fact the capital "I" is missing:

\fiSNS\fR supported depends on build options, but is enabled by default.

Based on the previous result, it seems like the issue is not related to grep as many of you suggested but lies in fact inside the man page of iscsiadm itself.

Should I let the title be as it is or change it to a more suitable one?

9
  • Try man iscsiadm 2>/tmp/test1.txt | grep "aia", then man iscsiadm 2>/tmp/test2.txt | grep "ia". In both cases, you should no longer see the error, because the error messages are redirected to a text file; if you still see it, something very strange is happening. Then compare the files /tmp/test1.txt and /tmp/test2.txt. Are they in fact both the same, or different? (Please edit your question to add this information; leave a comment only if you have a problem doing what was asked.) I'll write a more complete answer once I'll know the results of this test.
    – telcoM
    Commented Feb 26 at 21:32
  • As @telcoM has noted, this one is very strange. See my answer below.
    – eyoung100
    Commented Feb 26 at 21:36
  • @eyoung100 Essentially, my first guess was that there is something in the iscsiadm man page that always triggers the error, but it doesn't come visible when grepping for ia or ai because the partial output from the man page formatter process overwrites the error message on screen. But when the man page output is further constrained by grep "aia", the error won't get overwritten on screen and can be seen. The test suggested in my first comment should prove that the error is not related to grep but to the man command and its man page formatting process chain.
    – telcoM
    Commented Feb 26 at 21:50
  • @telcoM As noted RE: My sentence "Troff is the default formatter for man." We're both in the same alley. This one is a strange one!
    – eyoung100
    Commented Feb 26 at 22:02
  • @eyoung100 Indeed. My intention was to first fix the asker's apparent misunderstanding that the error message was related to grep, and then unpack the rest of the relationship between man and troff once that was confirmed. You drilled right down into the root cause, but as a result, unless the asker reads it very carefully or already knows a bit about how man works, your answer standing alone could have left the asker thinking "well and good, but how is this related to my error message from grep"?
    – telcoM
    Commented Feb 26 at 22:24

1 Answer 1

2

As noted in my comments to eyoung100 (EDIT: in a now-deleted answer), I don't see this problem with Debian's open-scsi 2.1.3-5 package. Also, there are no font selection escape sequences (or requests) on line 498 of my copy of that document, so you are almost certainly using another version.

My copy formats without warnings:

$ nroff -ww -man -z ./doc/iscsiadm.8

(I used -ww to turn on all warnings and -z to suppress formatted output, since all I am interested in are diagnostic messages.)

I do see, at line 503 of my copy of the doc/iscsiadm.8 file, the following:

like you would in node mode, run \fIiscsiadm \-m fw\fR.

If I delete the capital I, I get the following.

$ nroff -ww -man -z ./doc/iscsiadm.8
troff:./doc/iscsiadm.8:503: warning: cannot select font 'i'

I therefore think something similar is happening with your copy.

You might try this:

$ zgrep '\\fi' $(man -w iscsiadm)

That should tell you if the page has the error I suspect.

One might wonder why the error happens. It is due to the syntax of the font selection escape sequence \f. Here's how groff(7) summarizes it.

     \fP     Select previous font mounting position (abstract style or
             font); same as “.ft” or “.ft P”.
     \fF     Select font mounting position, abstract style, or font with
             one‐character name or one‐digit position F.  F cannot be P.
     \f(ft   Select font mounting position, abstract style, or font with
             two‐character name or two‐digit position ft.
     \f[font]
             Select font mounting position, abstract style, or font with
             arbitrarily long name or position font.  font cannot be P.
     \f[]    Select previous font mounting position (abstract style or
             font).

The square-bracket forms are GNU troff extensions to the AT&T troff language. (They might actually originate in SoftQuad troff, a now nearly forgotten descendant of AT&T's Documenter's Workbench 2.0 troff.)

So when you have \f followed by something other than an opening parenthesis ( or opening square bracket [, the next character is interpreted as the name of the font to be selected. (It could also be a single-digit font mounting position, but this usage is vanishingly rare in man(7) pages--fortunately.)

As far as groff is concerned, terminals support only four font names: R, I, B, and BI; the grotty(1) man page says more. Attempting to select any other font name will fail; like much else in Unix, *roff font names are case-sensitive. groff 1.23.0 started issuing diagnostics upon font selection failure in many more cases than earlier versions of groff did.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .