Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Oct 2025 02:53:17 GMT
From:      Alexander Ziaee <ziaee@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 955d9b0a1093 - stable/15 - mandoc: Vendor import of upstream at 2025-09-26
Message-ID:  <202510020253.5922rHRL088112@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/15 has been updated by ziaee:

URL: https://cgit.FreeBSD.org/src/commit/?id=955d9b0a1093131ac18d57d2764ee716fd428dd9

commit 955d9b0a1093131ac18d57d2764ee716fd428dd9
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2025-09-29 17:31:38 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2025-10-02 02:52:57 +0000

    mandoc: Vendor import of upstream at 2025-09-26
    
    Interesting changes:
    + mandoc db: Improve case sorting, found by our very own markj
    + history: Add macros for version 8 and 10 AT&T Unix
    + linter: Warn on blank lines in man(7) like mdoc(7)
    + manuals: Improve precision, man(7) syntax table, and roff(7) specifics
    + manuals: Fix PDF/PS footer regression detailed in our PR: 289786
    
    PR:             289786
    MFC after:      3 days
    
    (cherry picked from commit 59fc2b0166f71c791113379d16b8cef7039f289d)
---
 contrib/mandoc/Makefile      |  2 +-
 contrib/mandoc/dba.c         |  7 +++---
 contrib/mandoc/main.c        | 52 +++++++++-----------------------------------
 contrib/mandoc/man.c         |  3 ++-
 contrib/mandoc/man.options.1 | 35 +++++++++++++++++++++++++----
 contrib/mandoc/mandoc.1      | 16 ++++++++------
 contrib/mandoc/mdoc.7        | 35 +++++++++++++++++++----------
 contrib/mandoc/roff_term.c   |  2 +-
 contrib/mandoc/term_ps.c     |  6 ++---
 9 files changed, 84 insertions(+), 74 deletions(-)

diff --git a/contrib/mandoc/Makefile b/contrib/mandoc/Makefile
index 0830c9f289a3..d4a2c794b437 100644
--- a/contrib/mandoc/Makefile
+++ b/contrib/mandoc/Makefile
@@ -15,7 +15,7 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-VERSION = 1.14.6s20250727
+VERSION = 1.14.6s20250926
 
 # === LIST OF FILES ====================================================
 
diff --git a/contrib/mandoc/dba.c b/contrib/mandoc/dba.c
index ee43933de3bf..ab40798e8eed 100644
--- a/contrib/mandoc/dba.c
+++ b/contrib/mandoc/dba.c
@@ -1,6 +1,6 @@
-/*	$Id: dba.c,v 1.10 2017/02/17 14:43:54 schwarze Exp $ */
+/* $Id: dba.c,v 1.11 2025/09/24 13:13:30 schwarze Exp $ */
 /*
- * Copyright (c) 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2016, 2017, 2025 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -318,7 +318,8 @@ compare_names(const void *vp1, const void *vp2)
 	cp1 = *(const char * const *)vp1;
 	cp2 = *(const char * const *)vp2;
 	return (diff = *cp2 - *cp1) ? diff :
-	    strcasecmp(cp1 + 1, cp2 + 1);
+	    (diff = strcasecmp(cp1 + 1, cp2 + 1)) ? diff :
+	    strcmp(cp1 + 1, cp2 + 1);
 }
 
 static int
diff --git a/contrib/mandoc/main.c b/contrib/mandoc/main.c
index 57b06c9b9e66..d70ff1ce77b4 100644
--- a/contrib/mandoc/main.c
+++ b/contrib/mandoc/main.c
@@ -1,6 +1,6 @@
-/* $Id: main.c,v 1.361 2022/04/14 16:43:43 schwarze Exp $ */
+/* $Id: main.c,v 1.364 2025/09/24 21:30:20 schwarze Exp $ */
 /*
- * Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2012,2014-2021,2025 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
  *
@@ -109,7 +109,7 @@ static	void		  parse(struct mparse *, int, const char *,
 				struct outstate *, struct manconf *);
 static	void		  passthrough(int, int);
 static	void		  process_onefile(struct mparse *, struct manpage *,
-				int, struct outstate *, struct manconf *);
+				struct outstate *, struct manconf *);
 static	void		  run_pager(struct outstate *, char *);
 static	pid_t		  spawn_pager(struct outstate *, char *);
 static	void		  usage(enum argmode) __attribute__((__noreturn__));
@@ -144,7 +144,6 @@ main(int argc, char *argv[])
 	int		 options;	/* Parser options. */
 	int		 show_usage;	/* Invalid argument: give up. */
 	int		 prio, best_prio;
-	int		 startdir;
 	int		 c;
 	enum mandoc_os	 os_e;		/* Check base system conventions. */
 	enum outmode	 outmode;	/* According to command line. */
@@ -514,7 +513,7 @@ main(int argc, char *argv[])
 			if (resnsz == 0)
 				(void)fs_search(&search, &conf.manpath,
 				    *argv, &resn, &resnsz);
-			if (resnsz == 0 && strchr(*argv, '/') == NULL) {
+			if (resnsz == 0) {
 				if (search.arch != NULL &&
 				    arch_valid(search.arch, OSENUM) == 0)
 					warnx("Unknown architecture \"%s\".",
@@ -529,20 +528,6 @@ main(int argc, char *argv[])
 				mandoc_msg_setrc(MANDOCLEVEL_BADARG);
 				continue;
 			}
-			if (resnsz == 0) {
-				if (access(*argv, R_OK) == -1) {
-					mandoc_msg_setinfilename(*argv);
-					mandoc_msg(MANDOCERR_BADARG_BAD,
-					    0, 0, "%s", strerror(errno));
-					mandoc_msg_setinfilename(NULL);
-					continue;
-				}
-				resnsz = 1;
-				resn = mandoc_calloc(resnsz, sizeof(*res));
-				resn->file = mandoc_strdup(*argv);
-				resn->ipath = SIZE_MAX;
-				resn->form = FORM_SRC;
-			}
 			if (outmode != OUTMODE_ONE || resnsz == 1) {
 				res = mandoc_reallocarray(res,
 				    ressz + resnsz, sizeof(*res));
@@ -559,7 +544,8 @@ main(int argc, char *argv[])
 
 			best_prio = 40;
 			for (ib = i = 0; i < resnsz; i++) {
-				sec = resn[i].file;
+				sec = resn[i].file +
+				    strlen(conf.manpath.paths[resn[i].ipath]);
 				sec += strcspn(sec, "123456789");
 				if (sec[0] == '\0')
 					continue; /* No section at all. */
@@ -647,23 +633,13 @@ main(int argc, char *argv[])
 	mchars_alloc();
 	mp = mparse_alloc(options, os_e, os_s);
 
-	/*
-	 * Remember the original working directory, if possible.
-	 * This will be needed if some names on the command line
-	 * are page names and some are relative file names.
-	 * Do not error out if the current directory is not
-	 * readable: Maybe it won't be needed after all.
-	 */
-	startdir = open(".", O_RDONLY | O_DIRECTORY);
 	for (i = 0; i < ressz; i++) {
-		process_onefile(mp, res + i, startdir, &outst, &conf);
+		if (i > 0)
+			mparse_reset(mp);
+		process_onefile(mp, res + i, &outst, &conf);
 		if (outst.wstop && mandoc_msg_getrc() != MANDOCLEVEL_OK)
 			break;
 	}
-	if (startdir != -1) {
-		(void)fchdir(startdir);
-		close(startdir);
-	}
 	if (conf.output.tag != NULL && conf.output.tag_found == 0) {
 		mandoc_msg(MANDOCERR_TAG, 0, 0, "%s", conf.output.tag);
 		conf.output.tag = NULL;
@@ -909,7 +885,7 @@ fs_search(const struct mansearch *cfg, const struct manpaths *paths,
 }
 
 static void
-process_onefile(struct mparse *mp, struct manpage *resp, int startdir,
+process_onefile(struct mparse *mp, struct manpage *resp,
     struct outstate *outst, struct manconf *conf)
 {
 	int	 fd;
@@ -921,8 +897,6 @@ process_onefile(struct mparse *mp, struct manpage *resp, int startdir,
 	 */
 	if (resp->ipath != SIZE_MAX)
 		(void)chdir(conf->manpath.paths[resp->ipath]);
-	else if (startdir != -1)
-		(void)fchdir(startdir);
 
 	mandoc_msg_setinfilename(resp->file);
 	if (resp->file != NULL) {
@@ -982,18 +956,12 @@ parse(struct mparse *mp, int fd, const char *file,
     struct outstate *outst, struct manconf *conf)
 {
 	static struct manpaths	 basepaths;
-	static int		 previous;
 	struct roff_meta	*meta;
 
 	assert(fd >= 0);
 	if (file == NULL)
 		file = "<stdin>";
 
-	if (previous)
-		mparse_reset(mp);
-	else
-		previous = 1;
-
 	mparse_readfd(mp, fd, file);
 	if (fd != STDIN_FILENO)
 		close(fd);
diff --git a/contrib/mandoc/man.c b/contrib/mandoc/man.c
index f651efe3de8b..26846f1cf243 100644
--- a/contrib/mandoc/man.c
+++ b/contrib/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.189 2022/08/16 23:01:09 schwarze Exp $ */
+/* $Id: man.c,v 1.190 2025/08/22 13:17:06 schwarze Exp $ */
 /*
  * Copyright (c) 2013-2015,2017-2019,2022 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -134,6 +134,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs)
 			*ep = '\0';
 			return 1;
 		}
+		mandoc_msg(MANDOCERR_FI_BLANK, line, i, NULL);
 		roff_elem_alloc(man, line, offs, ROFF_sp);
 		man->next = ROFF_NEXT_SIBLING;
 		return 1;
diff --git a/contrib/mandoc/man.options.1 b/contrib/mandoc/man.options.1
index be65ad98fddc..be101d4b5b62 100644
--- a/contrib/mandoc/man.options.1
+++ b/contrib/mandoc/man.options.1
@@ -1,4 +1,4 @@
-.\" $Id: man.options.1,v 1.8 2025/06/30 00:11:06 schwarze Exp $
+.\" $Id: man.options.1,v 1.9 2025/08/28 13:46:57 schwarze Exp $
 .\"
 .\" Copyright (c) 2017, 2025 Ingo Schwarze <schwarze@openbsd.org>
 .\"
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: June 30 2025 $
+.Dd $Mdocdate: August 28 2025 $
 .Dt MAN.OPTIONS 1
 .Os
 .Sh NAME
@@ -39,9 +39,18 @@
 .de At5
 .At V Pq January 1983 \\$1
 ..
+.de At8
+.No Version 8 At Pq February 1985 \\$1
+..
 .de Bx43
 .Bx 4.3 Pq June 1986 \\$1
 ..
+.de At9
+.No Version 9 At Pq September 1986 \\$1
+..
+.de At10
+.No Version 10 At Pq October 1989 \\$1
+..
 .\" option was present in groff-1.01 as contained in 4.3BSD-Net/2
 .\" and no mention of it could be found in the ChangeLog,
 .\" so it's probably older than groff-0.4, where the log started
@@ -49,7 +58,7 @@
 .No probably before groff-0.4 Pq before July 14, 1990 \\$1
 ..
 .de Eaton
-.No Eaton Pq before July 7, 1993; 1990/91? \\$1
+.No Eaton Pq before July 7, 1993; 1990/91?\& \\$1
 ..
 .\" man-1.5e was released on July 11, 1998.
 .de man15e
@@ -399,6 +408,12 @@ do not feed out paper nor stop phototypesetter
 .br
 .Nm troff :
 .At7
+.Pp
+.Bq superseded by Fl l
+interpret arguments as file names
+.br
+.Nm man :
+.At10
 .It Fl G
 preprocess with
 .Xr grap 1
@@ -549,6 +564,7 @@ mode
 .br
 .Nm man :
 .Bx4 ,
+.At10 ,
 .Eaton ;
 .No POSIX , Ox , Fx , Nx , No man-db , man-1.6 , illumos , Solaris 9-11
 .br
@@ -720,7 +736,9 @@ specify a page number for the first page
 output mode
 .br
 .Nm man :
-.At7
+.At7 ,
+.At8 ,
+.At10
 .Pp
 do not create the
 .Xr whatis 1
@@ -852,6 +870,12 @@ invoke the simultaneous input-output mode of the .rd request
 .Nm nroff , troff :
 .At7
 .Pp
+quick mode: prefer preformatted page if available
+.br
+.Nm man :
+.At8 ,
+.At10
+.Pp
 issue no warnings
 .br
 .Nm manpath :
@@ -1046,6 +1070,8 @@ output mode
 .Bx 2 Pq May 10, 1979 ,
 .At3 ,
 .At5 ,
+.At8 ,
+.At10 ,
 .Eaton ;
 .Fx , No man-db , man-1.6 , illumos , Solaris 9-11
 .br
@@ -1162,6 +1188,7 @@ list pathnames
 .At7 ,
 .At3 ,
 .At5 ,
+.At8 ,
 .Eaton ;
 .Ox , Fx , Nx , No man-db , man-1.6
 .br
diff --git a/contrib/mandoc/mandoc.1 b/contrib/mandoc/mandoc.1
index 8b6fe7d19b1e..0f83bcd53f1b 100644
--- a/contrib/mandoc/mandoc.1
+++ b/contrib/mandoc/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.272 2025/07/09 13:46:05 schwarze Exp $
+.\" $Id: mandoc.1,v 1.273 2025/08/22 13:17:06 schwarze Exp $
 .\"
 .\" Copyright (c) 2012, 2014-2023, 2025 Ingo Schwarze <schwarze@openbsd.org>
 .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: July 9 2025 $
+.Dd $Mdocdate: August 22 2025 $
 .Dt MANDOC 1
 .Os
 .Sh NAME
@@ -1002,14 +1002,14 @@ macro that could be represented using
 or
 .Ic \&Dx .
 .It Sy "errnos out of order"
-.Pq mdoc, Nx
+.Pq mdoc , Nx
 The
 .Ic \&Er
 items in a
 .Ic \&Bl
 list are not in alphabetical order.
 .It Sy "duplicate errno"
-.Pq mdoc, Nx
+.Pq mdoc , Nx
 A
 .Ic \&Bl
 list contains two consecutive
@@ -1150,7 +1150,7 @@ The
 argument is used as provided anyway.
 Consider checking whether the file name or the argument need a correction.
 .It Sy "missing date, using \(dq\(dq"
-.Pq mdoc, man
+.Pq mdoc , man
 The document was parsed as
 .Xr mdoc 7
 and it has no
@@ -1732,7 +1732,7 @@ or
 macro contains an opening or closing parenthesis; that's probably wrong,
 parentheses are added automatically.
 .It Sy "unknown library name"
-.Pq mdoc, not on Ox
+.Pq mdoc , not on Ox
 An
 .Ic \&Lb
 macro has an unknown name argument and will be rendered as
@@ -1790,7 +1790,7 @@ The last character is mapped to the blank character.
 .Ss "Warnings related to plain text"
 .Bl -ohang
 .It Sy "blank line in fill mode, using .sp"
-.Pq mdoc
+.Pq mdoc , man
 The meaning of blank input lines is only well-defined in non-fill mode:
 In fill mode, line breaks of text input lines are not supposed to be
 significant.
@@ -1800,6 +1800,8 @@ are formatted like
 requests.
 To request a paragraph break, use
 .Ic \&Pp
+or
+.Ic \&PP
 instead of a blank line.
 .It Sy "tab in filled text"
 .Pq mdoc , man
diff --git a/contrib/mandoc/mdoc.7 b/contrib/mandoc/mdoc.7
index 55cc7fae688d..6c2d3568baa6 100644
--- a/contrib/mandoc/mdoc.7
+++ b/contrib/mandoc/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.299 2025/06/13 16:18:28 schwarze Exp $
+.\" $Id: mdoc.7,v 1.300 2025/08/19 14:08:59 schwarze Exp $
 .\"
 .\" Copyright (c) 2010-2021, 2024, 2025 Ingo Schwarze <schwarze@openbsd.org>
 .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: June 13 2025 $
+.Dd $Mdocdate: August 19 2025 $
 .Dt MDOC 7
 .Os
 .Sh NAME
@@ -979,7 +979,7 @@ Unless the
 .Fl compact
 argument is specified, list entries are separated by vertical space.
 .Pp
-A list must specify one of the following list types:
+The following list types are commonly used:
 .Bl -tag -width 12n -offset indent
 .It Fl bullet
 No item heads can be specified, but a bullet will be printed at the head
@@ -994,7 +994,14 @@ The
 .Fl width
 argument has no effect; instead, the string length of each argument
 specifies the width of one column.
-If the first line of the body of a
+The width specification for the last column does not affect formatting.
+.Pp
+For two-column lists, using
+.Fl tag
+often results in simpler code, identical terminal output, and better HTML
+output, especially when the first column contains short identifiers.
+.Pp
+For compatibility with legacy documents, if the first line of the body of a
 .Fl column
 list is not an
 .Ic \&It
@@ -1016,7 +1023,7 @@ Like
 except that item heads are not parsed for macro invocations.
 Most often used in the
 .Em DIAGNOSTICS
-section with error constants in the item heads.
+section with error messages in the item heads.
 .It Fl enum
 A numbered list.
 No item heads can be specified.
@@ -1024,6 +1031,17 @@ Formatted like
 .Fl bullet ,
 except that ordinal numbers are used in place of bullets,
 starting at 1.
+.It Fl tag
+Item bodies are indented according to the
+.Fl width
+argument.
+When an item head fits inside the indentation, the item body follows
+this head on the same output line.
+Otherwise, the body starts on the output line following the head.
+.El
+.Pp
+The following list types are rarely useful:
+.Bl -tag -width 12n -offset indent
 .It Fl hang
 Like
 .Fl tag ,
@@ -1050,13 +1068,6 @@ Item bodies start on the line following item heads and are not indented.
 The
 .Fl width
 argument is ignored.
-.It Fl tag
-Item bodies are indented according to the
-.Fl width
-argument.
-When an item head fits inside the indentation, the item body follows
-this head on the same output line.
-Otherwise, the body starts on the output line following the head.
 .El
 .Pp
 Lists may be nested within lists and displays.
diff --git a/contrib/mandoc/roff_term.c b/contrib/mandoc/roff_term.c
index 85d2caeb2749..38321c830013 100644
--- a/contrib/mandoc/roff_term.c
+++ b/contrib/mandoc/roff_term.c
@@ -1,4 +1,4 @@
-/* $Id: roff_term.c,v 1.26 2025/07/16 14:33:08 schwarze Exp $ */
+/* $Id: roff_term.c,v 1.27 2025/08/21 15:38:51 schwarze Exp $ */
 /*
  * Copyright (c) 2010, 2014, 2015, 2017-2021, 2025
  *               Ingo Schwarze <schwarze@openbsd.org>
diff --git a/contrib/mandoc/term_ps.c b/contrib/mandoc/term_ps.c
index 4c6368ca1d1f..91124152d55a 100644
--- a/contrib/mandoc/term_ps.c
+++ b/contrib/mandoc/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.94 2025/07/18 15:47:18 schwarze Exp $ */
+/* $Id: term_ps.c,v 1.95 2025/09/26 12:17:12 schwarze Exp $ */
 /*
  * Copyright (c) 2014-2017, 2020, 2025 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -1222,6 +1222,8 @@ ps_endline(struct termp *p)
 
 	ps_plast(p);
 	ps_pclose(p);
+	p->viscol = 0;
+	p->minbl = 0;
 
 	/*
 	 * If we're in the margin, don't try to recalculate our current
@@ -1235,8 +1237,6 @@ ps_endline(struct termp *p)
 	/* Left-justify. */
 
 	p->ps->pscol = p->ps->left;
-	p->viscol = 0;
-	p->minbl = 0;
 
 	/* If we haven't printed anything, return. */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510020253.5922rHRL088112>