git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 01/12] doc: remove GNU troff workaround

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 8, 2021, 09:00 UTC
Message-ID
<20210608090026.1737348-2-felipe.contreras@gmail.com>
In-Reply-To
<20210608090026.1737348-1-felipe.contreras@gmail.com>

In 2007 the docbook project made the mistake of converting ' to \' for man pages [1]. It's a problem because groff interprets \' as acute accent which is rendered as ' in ASCII, but as ´ in utf-8.

This started a cascade of bug reports in git [2], debian [3], Arch Linux [4], docbook itself [5], and probably many others.

A solution was to use the correct groff character: \(aq, which is always rendered as ', but the problem is that such character doesn't work in other troff programs.

A portable solution required the use of a conditional character that is \(aq in groff, but ' in all others:

  .ie \n(.g .ds Aq \(aq
  .el .ds Aq '

The proper solution took time to be implemented in docbook, but in 2010 they did it [6]. So the docbook man page stylesheets were broken from 1.73 to 1.76.

Unfortunately by that point many workarounds already existed. In the case of git GNU_ROFF was introduced, and in the case of Arch Linux a mappig from \' to ' was added to groff's man.local. Other distributions might have done the same, or similar workarounds.

Since 2010 there is not need for this workaround, which is fixed elsewhere not just in docbook, but other layers as well.

Let's remove it.
Also, it's GNU troff, not GNU roff.

[1] https://github.com/docbook/xslt10-stylesheets/commit/ea2a0bac56c56eec1892ac3d9254dca89f7c5746 [2] https://lore.kernel.org/git/20091012102926.GA3937@debian.b2j/ [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=507673#65 [4] https://bugs.archlinux.org/task/9643 [5] https://sourceforge.net/p/docbook/bugs/1022/ [6] https://github.com/docbook/xslt10-stylesheets/commit/fb553434265906ed81edc6d5f533d0b08d200046

Inspired-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/Makefile               |  8 --------
 Documentation/manpage-quote-apos.xsl | 16 ----------------
 Makefile                             |  4 ----
 3 files changed, 28 deletions(-)
 delete mode 100644 Documentation/manpage-quote-apos.xsl
diff --git a/Documentation/Makefile b/Documentation/Makefile
index f5605b7767..bf1f66b3eb 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -178,14 +178,6 @@ MAN_BASE_URL = file://$(htmldir)/
 endif
 XMLTO_EXTRA += -m manpage-base-url.xsl
 
-# If your target system uses GNU groff, it may try to render
-# apostrophes as a "pretty" apostrophe using unicode.  This breaks
-# cut&paste, so you should set GNU_ROFF to force them to be ASCII
-# apostrophes.  Unfortunately does not work with non-GNU roff.
-ifdef GNU_ROFF
-XMLTO_EXTRA += -m manpage-quote-apos.xsl
-endif
-
 ifdef USE_ASCIIDOCTOR
 ASCIIDOC = asciidoctor
 ASCIIDOC_CONF =
diff --git a/Documentation/manpage-quote-apos.xsl b/Documentation/manpage-quote-apos.xsl
deleted file mode 100644
index aeb8839f33..0000000000
--- a/Documentation/manpage-quote-apos.xsl
+++ /dev/null
@@ -1,16 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-		version="1.0">
-
-<!-- work around newer groff/man setups using a prettier apostrophe
-     that unfortunately does not quote anything when cut&pasting
-     examples to the shell -->
-<xsl:template name="escape.apostrophe">
-  <xsl:param name="content"/>
-  <xsl:call-template name="string.subst">
-    <xsl:with-param name="string" select="$content"/>
-    <xsl:with-param name="target">'</xsl:with-param>
-    <xsl:with-param name="replacement">\(aq</xsl:with-param>
-  </xsl:call-template>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/Makefile b/Makefile
index c3565fc0f8..7588c43f05 100644
--- a/Makefile
+++ b/Makefile
@@ -278,10 +278,6 @@ all::
 # Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
 # field that counts the on-disk footprint in 512-byte blocks.
 #
-# Define GNU_ROFF if your target system uses GNU groff.  This forces
-# apostrophes to be ASCII so that cut&pasting examples to the shell
-# will work.
-#
 # Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
 # documentation.
 #
-- 
2.32.0.2.g41be0a4e50
Previous: Felipe ContrerasNext: Felipe Contreras
Message 3 of 13 in “doc: cleanup old cruft and asciidoctor revamp”
  1. 00/12 doc: cleanup old cruft and asciidoctor revampFelipe Contreras, Jun 8, 2021
  2. 02/12 doc: use --stringparam in xmltoFelipe Contreras, Jun 8, 2021
  3. 01/12 doc: remove GNU troff workaroundFelipe Contreras, Jun 8, 2021
  4. 04/12 doc: asciidoc: remove unnecessary attributeFelipe Contreras, Jun 8, 2021
  5. 05/12 doc: asciidoctor: remove unnecessary requireFelipe Contreras, Jun 8, 2021
  6. 07/12 doc: asciidoctor: reorganize extensionsFelipe Contreras, Jun 8, 2021
  7. 03/12 doc: simplify version passingFelipe Contreras, Jun 8, 2021
  8. 06/12 doc: asciidoctor: remove cruftFelipe Contreras, Jun 8, 2021
  9. 09/12 doc: asciidoctor: refactor macro registrationFelipe Contreras, Jun 8, 2021
  10. 12/12 doc: asciidoctor: specify name of our groupFelipe Contreras, Jun 8, 2021
  11. 08/12 doc: asciidoctor: use html-prefix only for htmlFelipe Contreras, Jun 8, 2021
  12. 11/12 doc: asciidoctor: split the format from the codeFelipe Contreras, Jun 8, 2021
  13. 10/12 doc: asciidoctor: improve string handlingFelipe Contreras, Jun 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.