Skip to content

Commit

Permalink
pcre2grep.1 - fix warning about undefined macro 0 (#673)
Browse files Browse the repository at this point in the history
Debian's "lintian" picked this up - line 950 in the man page starts
with a ' which is how you start a roff request. You can reproduce the
warning thus:

```
LC_ALL=C.UTF-8 MANROFFSEQ='' MANWIDTH=80 \
man --warnings -E UTF-8 -l -Tutf8 -Z doc/pcre2grep.1 >/dev/null
```

The fix is to add a zero-width space (`\&`) to the start of the
relevant line (indeed `groff_man(7)` suggests exactly this use for \&).

---------

Co-authored-by: Matthew Vernon <matthew@debian.org>
  • Loading branch information
MatthewVernon and MatthewVernon authored Jan 24, 2025
1 parent 4f5a2ad commit 0d579d3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/pcre2grep.1
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ Any substring (including the executable name) may contain escape sequences
started by a dollar character. These are the same as for the \fB--output\fP
(\fB-O\fP) option documented above, except that $0 or $& cannot insert the
matched string because the match is still in progress. Instead, the character
'0' is inserted. If you need a literal dollar or pipe character in any
\&'0' is inserted. If you need a literal dollar or pipe character in any
substring, use $$ or $| respectively. Here is an example:
.sp
echo -e "abcde\en12345" | pcre2grep \e
Expand Down
1 change: 1 addition & 0 deletions maint/132html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $s =~ s"\\fI(.*?)\\f[RP]"<i>$1</i>"g;
$s =~ s"\\fB(.*?)\\f[RP]"<b>$1</b>"g;
$s =~ s"\\e"\\"g;
$s =~ s/(?<=Copyright )\(c\)/&copy;/g;
$s =~ s/\\&//g; # Deal with the \& 0-width space
$s;
}

Expand Down
2 changes: 1 addition & 1 deletion maint/CheckMan
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ while (scalar(@ARGV) > 0)
$yield = 1;
}
}
elsif (/\\[^ef]|\\f[^IBP]/)
elsif (/\\[^ef&]|\\f[^IBP]/)
{
printf "Bad backslash in line $line of $file\n";
$yield = 1;
Expand Down
11 changes: 11 additions & 0 deletions maint/PrepareRelease
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,17 @@ END
if [ $? != 0 ] ; then exit 1; fi


# Verify that `man` can process the pages without warnings.

for file in *.1 *.3 ; do
MAN_OUT=`MANROFFSEQ='' MANWIDTH=80 man --warnings=w,all -E UTF-8 -l -Tutf8 -Z "$file" 2>&1 >/dev/null`
if [ "$MAN_OUT" != "" ]; then
printf "Running man generated warnings:\n%s\n" "$MAN_OUT"
exit 1
fi
done


# Make HTML form of the documentation.

echo "Making HTML documentation"
Expand Down

0 comments on commit 0d579d3

Please sign in to comment.