Bug#1101796: xdg-desktop-menu.1: Some remarks and a patch with editorial changes for this man page

Bjarni Ingi Gislason bjarniig at simnet.is
Tue Apr 1 03:47:07 BST 2025


Package: xdg-utils
Version: 1.2.1-2
Severity: minor
Tags: patch

   * What led up to the situation?

     Checking for defects with a new version

test-[g|n]roff -mandoc -t -K utf8 -rF0 -rHY=0 -rCHECKSTYLE=10 -ww -z < "man page"

  [Use "grep -e ' $' -e '\\~$' <file>" to find obvious trailing spaces.]

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

  [The fate of "test-nroff" was decided in groff bug #55941.]

   * What was the outcome of this action?

troff:<stdin>:184: warning [page 3, line 36]: cannot break line


   * 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.12.20-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)

xdg-utils depends on no packages.

Versions of packages xdg-utils recommends:
pn  libfile-mimeinfo-perl  <none>
pn  libnet-dbus-perl       <none>
pn  libx11-protocol-perl   <none>
ii  x11-utils              7.7+7
ii  x11-xserver-utils      7.7+11

xdg-utils suggests no packages.

-- no debconf information
-------------- next part --------------
Input file is xdg-desktop-menu.1

Output from "mandoc -T lint  xdg-desktop-menu.1": (shortened list)

      1 input text line longer than 80 bytes: A *\&.desktop file c...
      1 input text line longer than 80 bytes: A *\&.directory file...
      1 input text line longer than 80 bytes: A list of categories...
      1 input text line longer than 80 bytes: A list of mimetypes ...
      1 input text line longer than 80 bytes: A submenu and the as...
      1 input text line longer than 80 bytes: A vendor prefix cons...
      1 input text line longer than 80 bytes: Although the result ...
      1 input text line longer than 80 bytes: An application item ...
      1 input text line longer than 80 bytes: An exit code of 0 in...
      1 input text line longer than 80 bytes: Directory files foll...
      1 input text line longer than 80 bytes: First the company ne...
      1 input text line longer than 80 bytes: If multiple director...
      1 input text line longer than 80 bytes: In addition a \&.dir...
      1 input text line longer than 80 bytes: In the next example ...
      1 input text line longer than 80 bytes: Menu entries can be ...
      1 input text line longer than 80 bytes: Normally, xdg\-deskt...
      1 input text line longer than 80 bytes: Note that for the pu...
      1 input text line longer than 80 bytes: Now the xdg\-desktop...
      1 input text line longer than 80 bytes: Postpone updating th...
      1 input text line longer than 80 bytes: Remove applications ...
      1 input text line longer than 80 bytes: See Appendix A of th...
      1 input text line longer than 80 bytes: Setting this environ...
      1 input text line longer than 80 bytes: The *\&.desktop and ...
      1 input text line longer than 80 bytes: The appearance of su...
      1 input text line longer than 80 bytes: The command line to ...
      1 input text line longer than 80 bytes: The company ShinyThi...
      1 input text line longer than 80 bytes: The default is to us...
      2 input text line longer than 80 bytes: The icon to use for ...
      1 input text line longer than 80 bytes: The xdg\-desktop\-me...
      1 input text line longer than 80 bytes: This environment var...
      2 input text line longer than 80 bytes: This is a mandatory ...
      1 input text line longer than 80 bytes: To add a menu entry ...
      1 input text line longer than 80 bytes: To add menu items to...
      1 input text line longer than 80 bytes: When using categorie...
      2 input text line longer than 80 bytes: command can be used ...
      1 input text line longer than 80 bytes: represents a submenu...
     10 skipping paragraph macro: PP after SH
      1 skipping paragraph macro: br after SH
      1 skipping paragraph macro: br at the end of SH


-.-.

Output from "test-nroff -mandoc -t -ww -z xdg-desktop-menu.1": (shortened list)

      1 cannot break line

-.-.

Show if docman-to-man created this.

Who is actually creating this man page?  Debian or upstream?

Is the generating software out of date?



4:.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>

-.-.

Strings longer than 3/4 of a standard line length (80).

Use "\:" to split the string at the end of an output line, for example a
long URL (web address)

46 \m[blue]\fB\%http://www.freedesktop.org/wiki/Specifications/menu-spec\fR\m[]
184 \m[blue]\fB\%http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry\fR\m[]
193 \m[blue]\fB\%http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec\fR\m[]
448 \%http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/

-.-.

Wrong distance (not two spaces) 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.

Mark a final abbreviation point as such by suffixing it with "\&".

Some sentences (etc.) do not begin on a new line.

Split (sometimes) lines after a punctuation mark; before a conjunction.

  Lines with only one (or two) space(s) between sentences could be split,
so latter sentences begin on a new line.

Use

#!/usr/bin/sh

sed -e '/^\./n' \
-e 's/\([[:alpha:]]\)\.  */\1.\n/g' $1

to split lines after a sentence period.
Check result with the difference between the formatted outputs.
See also the attachment "general.bugs"

[List of affected lines removed.]

-.-.

Split lines longer than 80 characters into two or more lines.
Appropriate break points are the end of a sentence and a subordinate
clause; after punctuation marks.
Add "\:" to split the string for the output, "\<newline>" in the source.  

[List of affected lines removed.]


Longest line is number 174 with 454 characters
The command line to start the application\&. If the application can open files the %f placeholder should be specified\&. When a file is dropped on the application launcher the %f is replaced with the file path of the dropped file\&. If multiple files can be specified on the command line the %F placeholder should be used instead of %f\&. If the application is able to open URLs in addition to local files then %u or %U can be used instead of %f or %F\&.

-.-.

Remove unnecessary double font change (e.g., \fR\fI) in a row or (better)
use a two-fonts macro.

[List with affected lines removed.]


34:\fBxdg\-desktop\-menu\fR install [\fB\-\-noupdate\fR] [\fB\-\-novendor\fR] [\fB\-\-mode\ \fR\fB\fImode\fR\fR] \fIdirectory\-file(s)\fR \fIdesktop\-file(s)\fR
36:\fBxdg\-desktop\-menu\fR uninstall [\fB\-\-noupdate\fR] [\fB\-\-mode\ \fR\fB\fImode\fR\fR] \fIdirectory\-file(s)\fR \fIdesktop\-file(s)\fR
38:\fBxdg\-desktop\-menu\fR forceupdate [\fB\-\-mode\ \fR\fB\fImode\fR\fR]

-.-.

No need for '\&' to be in front of a period (.),
if there is a character in front of it.

Remove with "sed -e 's/\(.\)\\&\./\1./g'".

[List of affected lines removed.]

-.-.

Only one space character is after a possible end of sentence
(after a punctuation, that can end a sentence).

[List of affected lines removed.]

-.-.

Put a subordinate sentence (after a comma) on a new line.

[List of affected lines removed.]

-.-

Remove quotes when there is a printable
but no space character between them
and the quotes are not for emphasis (markup),
for example as an argument to a macro.

xdg-desktop-menu.1:10:.TH "XDG\-DESKTOP\-MENU" "1" "11/29/2024" "xdg-utils 1.0" "xdg-desktop-menu Manual"
xdg-desktop-menu.1:30:.SH "NAME"
xdg-desktop-menu.1:32:.SH "SYNOPSIS"
xdg-desktop-menu.1:41:.SH "DESCRIPTION"
xdg-desktop-menu.1:47:.SH "COMMANDS"
xdg-desktop-menu.1:88:.SH "OPTIONS"
xdg-desktop-menu.1:282:.SH "EXAMPLES"
xdg-desktop-menu.1:429:.SH "AUTHORS"
xdg-desktop-menu.1:440:.SH "COPYRIGHT"
xdg-desktop-menu.1:444:.SH "NOTES"

-.-.

Use ".na" (no adjustment) instead of ".ad l" (and ".ad" to begin the
same adjustment again as before).

26:.ad l

-.-.

Section headings (.SH and .SS) do not need quoting their arguments.

30:.SH "NAME"
32:.SH "SYNOPSIS"
41:.SH "DESCRIPTION"
47:.SH "COMMANDS"
88:.SH "OPTIONS"
127:.SH "DESKTOP FILES"
194:.SH "DIRECTORY FILES"
231:.SH "ENVIRONMENT VARIABLES"
247:.SH "EXIT CODES"
275:.SH "SEE ALSO"
282:.SH "EXAMPLES"
429:.SH "AUTHORS"
440:.SH "COPYRIGHT"
444:.SH "NOTES"

-.-.

Remove excessive "\&" when it has no functional purpose.

280:\m[blue]\fBDesktop entry specification\fR\m[]\&\s-2\u[1]\d\s+2,
281:\m[blue]\fBDesktop menu specification\fR\m[]\&\s-2\u[2]\d\s+2

-.-.

Use "\-" instead of "-" in web addresses.

16:.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
46:\m[blue]\fB\%http://www.freedesktop.org/wiki/Specifications/menu-spec\fR\m[]
184:\m[blue]\fB\%http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry\fR\m[]
193:\m[blue]\fB\%http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec\fR\m[]
448:\%http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/
453:\%http://www.freedesktop.org/wiki/Specifications/menu-spec/

-.-.

Put a (long) web address on a new line to reduce the posibility of
splitting the address between two output lines.
Or inhibit hyphenation with "\%" in front of the name.


46:\m[blue]\fB\%http://www.freedesktop.org/wiki/Specifications/menu-spec\fR\m[]
184:\m[blue]\fB\%http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry\fR\m[]
193:\m[blue]\fB\%http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec\fR\m[]
448:\%http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/
453:\%http://www.freedesktop.org/wiki/Specifications/menu-spec/

-.-.

Output from "test-nroff  -mandoc -t -K utf8 -rF0 -rHY=0 -rCHECKSTYLE=10 -ww -z ":

troff:<stdin>:184: warning [page 3, line 36]: cannot break line

-.-.

Generally:

Split (sometimes) lines after a punctuation mark; before a conjunction.
-------------- next part --------------
--- xdg-desktop-menu.1	2025-04-01 02:12:35.845847850 +0000
+++ xdg-desktop-menu.1.new	2025-04-01 02:22:54.594538437 +0000
@@ -181,7 +181,8 @@ A list of categories separated by semi\-
 When using categories it is recommended to include one of the following categories: AudioVideo, Development, Education, Game, Graphics, Network, Office, Settings, System, Utility\&.
 .sp
 See Appendix A of the XDG Desktop Menu Specification for information about additional categories:
-\m[blue]\fB\%http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry\fR\m[]
+.br
+\m[blue]\fB\%http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#\:category-registry\fR\m[]
 .RE
 .PP
 MimeType=\fIMimetypes\fR
-------------- next part --------------
  Any program (person), that produces man pages, should check the output
for defects by using (both groff and nroff)

[gn]roff -mandoc -t -ww -b -z -K utf8 <man page>

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

  For a style guide use

  mandoc -T lint

-.-

  Any "autogenerator" should check its products with the above mentioned
'groff', 'mandoc', and additionally with 'nroff ...'.

  It should also check its input files for too long (> 80) lines.

  This is just a simple quality control measure.

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

  Common defects:

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

  "git" has a "tool" to point out whitespace,
see for example "git-apply(1)" and git-config(1)")

  Not beginning each input sentence on a new line.
Line length and patch size should thus be reduced.

  The script "reportbug" uses 'quoted-printable' encoding when a line is
longer than 1024 characters in an 'ascii' file.

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

-.-

The difference between the formatted output of the original and patched file
can be seen with:

  nroff -mandoc <file1> > <out1>
  nroff -mandoc <file2> > <out2>
  diff -d -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 from 'diff -d -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)

-.-


More information about the Pkg-freedesktop-maintainers mailing list