Package: less
Version: 643-1
Severity: minor
Tags: patch

   * What led up to the situation?

     Checking for defects with

[test-]groff -mandoc -t -K utf8 -rF0 -rHY=0 -ww -b -z < "man page"

  [test-groff is a script in the repository for "groff"] (local copy and
"troff" slightly changed by me).

   * What was the outcome of this action?

troff: backtrace: file '<stdin>':63
troff:<stdin>:63: warning: macro 'DS' not defined
troff: backtrace: file '<stdin>':90
troff:<stdin>:90: warning: macro 'DE' not defined

   * What outcome did you expect instead?

     No output (no warnings).

-.-

  General remarks and further material, if a diff-file exist, are in the
attachments.


-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.10.9-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages less depends on:
ii  libc6      2.40-2
ii  libtinfo6  6.5-2

less recommends no packages.

less suggests no packages.

-- no debconf information
  Any program (person), that produces man pages, should check its content for
defects by using

groff -mandoc -t -ww -b -z [ -K utf8 | k ] <man page>

  The same goes for man pages that are used as an input.

  For a style guide use

  mandoc -T lint

-.-

  So any 'generator' should check its products with the above mentioned
'groff', 'mandoc',  and additionally with 'nroff ...'.

  This is just a simple quality control measure.

  The 'generator' may have to be corrected to get a better man page,
the source file may, and any additional file may.

  Common defects:

  Input text line longer than 80 bytes.

  Not removing trailing spaces (in in- and output).
  The reason for these trailing spaces should be found and eliminated.

  Not beginning each input sentence on a new line.
Lines should thus be shorter.

  See man-pages(7), item 'semantic newline'.

-.-

The difference between the formatted outputs can be seen with:

  nroff -mandoc <file1> > <out1>
  nroff -mandoc <file2> > <out2>
  diff -u <out1> <out2>

and for groff, using

"printf '%s\n%s\n' '.kern 0' '.ss 12 0' | groff -mandoc -Z - "

instead of \'nroff -mandoc\'

  Add the option \'-t\', if the file contains a table.

  Read the output of \'diff -u\' with \'less -R\' or similar.

-.-.

  If \'man\' (man-db) is used to check the manual for warnings,
the following must be set:

  The option "-warnings=w"

  The environmental variable:

export MAN_KEEP_STDERR=yes (or any non-empty value)

  or

  (produce only warnings):

export MANROFFOPT="-ww -b -z"

export MAN_KEEP_STDERR=yes (or any non-empty value)

-.-.

Output from "mandoc -T lint lesspipe.1": (possibly shortened list)

mandoc: lesspipe.1:1:2: WARNING: missing date, using "": TH
mandoc: lesspipe.1:63:2: ERROR: skipping unknown macro: .DS
mandoc: lesspipe.1:90:2: ERROR: skipping unknown macro: .DE
mandoc: lesspipe.1:133:2: WARNING: skipping paragraph macro: PP after SH

-.-.

Change a HYPHEN-MINUS (code 0x2D) to a minus(-dash) (\-),
if it
is in front of a name for an option,
is a symbol for standard input,
is a single character used to indicate an option,
or is in the NAME section (man-pages(7)).
N.B. - (0x2D), processed as a UTF-8 file, is changed to a hyphen
(0x2010, groff \[u2010] or \[hy]) in the output.

144:  if [ -z "$PS1" ]; then

-.-.

Add a comma (or \&) after "e.g." and "i.e.", or use English words
(man-pages(7)).
Abbreviation points should be protected against being interpreted as
an end of sentence, if they are not, and that independent of the
current place on the line.

50:Just put one of the following two commands in your login script (e.g.

-.-.

Wrong distance between sentences in the input file.

  Separate the sentences and subordinate clauses; each begins on a new
line.  See man-pages(7) ("Conventions for source file layout") and
"info groff" ("Input Conventions").

  The best procedure is to always start a new sentence on a new line,
at least, if you are typing on a computer.

Remember coding: Only one command ("sentence") on each (logical) line.

E-mail: Easier to quote exactly the relevant lines.

Generally: Easier to edit the sentence.

Patches: Less unaffected text.

Search for two adjacent words is easier, when they belong to the same line,
and the same phrase.

  The amount of space between sentences in the output can then be
controlled with the ".ss" request.

96:input processor if you have specialized requirements. Create an executable
99:and put it into your home directory. This can be a shell script or a binary
130:Executable file that can do user defined processing. See section USER 
DEFINED
135:that is produced by your login scripts (~/.bashrc or ~/.bash_profile). This
136:happens because less uses your current shell to run the lesspipe filter. 
Bash
138:and  uses the expanded value as the name of a file to read and execute. If
139:this file produces any output less will display this. A way to solve this
155:for the Debian GNU/Linux system (but may be used by others). Most of the

-.-.

Split a punctuation from a single argument, if a two-font macro is meant

23:.I less.

-.-.

Name of a manual is set in bold, the section in roman.
See man-pages(7).

152:less(1)

-.-.

Output from "test-groff -b -mandoc -rF0 -rHY=0 -K utf8 -t -ww -z ":

troff: backtrace: file '<stdin>':63
troff:<stdin>:63: warning: macro 'DS' not defined
troff: backtrace: file '<stdin>':90
troff:<stdin>:90: warning: macro 'DE' not defined

--- lesspipe.1  2024-09-17 00:39:07.706075662 +0000
+++ lesspipe.1.new      2024-09-17 00:42:06.996028988 +0000
@@ -20,7 +20,7 @@ and
 .I lesspipe
 are programs that can be used to modify the way the contents of a file are
 displayed in
-.I less.
+.IR less .
 What this means is that
 .I less
 can automatically open
@@ -47,8 +47,8 @@ will then delete the file.  This means t
 you see it, but you get nice percentages (N%) up front.
 .
 .SH USAGE
-Just put one of the following two commands in your login script (e.g.
-~/.bash_profile):
+Just put one of the following two commands in your login script
+(e.g.\& ~/.bash_profile):
 .PP
   eval "$(lessfile)"
 .PP
@@ -60,7 +60,7 @@ File types are recognized by their exten
 This is a list of currently supported extensions
 (grouped by the programs that handle them):
 
-.DS
+.\".DS is probably from the ms-macro package.  Not needed here.
   *.a
   *.arj
   *.tar.bz2
@@ -87,17 +87,17 @@ This is a list of currently supported ex
   *.zoo
   *.tar.zst, *.tzst
   *.zst
-.DE
+.\".DE is probably from the ms-macro package.  Not needed here.
 .SH USER DEFINED FILTERS
 It is possible to extend and overwrite the default
 .I lesspipe
 and
 .I lessfile
-input processor if you have specialized requirements. Create an executable
-program with the name
+input processor if you have specialized requirements.
+Create an executable program with the name
 .I .lessfilter
-and put it into your home directory. This can be a shell script or a binary
-program.
+and put it into your home directory.
+This can be a shell script or a binary program.
 
 .PP
 It is important that this program returns the correct exit code: return 0 if
@@ -108,7 +108,7 @@ filter should handle the input.
 .PP
 Here is an example script:
 
-.DS
+.\".DS is probably from the ms-macro package.  Not needed here.
   #!/bin/sh
 
   case "$1" in
@@ -122,35 +122,37 @@ Here is an example script:
 
   # No further processing by lesspipe necessary
   exit 0
-.DE
+.\".DE is probably from the ms-macro package.  Not needed here.
 
 .SH FILES
 .TP
 .I ~/.lessfilter
-Executable file that can do user defined processing. See section USER DEFINED
-FILTERS for more information.
+Executable file that can do user defined processing.
+See section USER DEFINED FILTERS for more information.
 .SH BUGS
-.PP
 Sometimes, less does not display the contents file you want to view but output
-that is produced by your login scripts (~/.bashrc or ~/.bash_profile). This
-happens because less uses your current shell to run the lesspipe filter. Bash
-first looks for the variable $BASH_ENV in the environment expands its value
-and  uses the expanded value as the name of a file to read and execute. If
-this file produces any output less will display this. A way to solve this
-problem is to put the following lines on the top of your login script that
-produces output:
+that is produced by your login scripts (~/.bashrc or ~/.bash_profile).
+This happens because less uses your current shell to run the lesspipe filter.
+Bash first looks for the variable $BASH_ENV in the environment,
+expands its value and
+uses the expanded value as the name of a file to read and execute.
+If this file produces any output less will display this.
+A way to solve this problem is to put the following lines on the top of your
+login script that produces output:
 
-.DS
-  if [ -z "$PS1" ]; then
+.\".DS is probably from the ms-macro package.  Not needed here.
+  if [ \-z "$PS1" ]; then
       exit
   fi
-.DE
+.\".DE is probably from the ms-macro package.  Not needed here.
 
 This tests whether the prompt variable $PS1 is set and if it isn't (which is
 the case for non-interactive shells) it will exit the script.
 .SH "SEE ALSO"
-less(1)
+.BR less (1)
 .SH AUTHOR
 This manual page was written by Thomas Schoepf <scho...@debian.org>,
-for the Debian GNU/Linux system (but may be used by others). Most of the
-text was copied from a description written by Darren Stalder <to...@daft.com>.
+for the Debian GNU/Linux system (but may be used by others).
+Most of the text was copied from a description written by Darren Stalder
+<to...@daft.com>.
+

Reply via email to