From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-02.scc.kit.edu (scc-mailout-kit-02.scc.kit.edu [129.13.231.82]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id de1cca43 for ; Sun, 8 Jan 2017 21:46:03 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-02.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1cQPy9-00077k-Lq; Mon, 09 Jan 2017 03:46:03 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1cQPy7-000026-Ju; Mon, 09 Jan 2017 03:45:55 +0100 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84_2) (envelope-from ) id 1cQPyC-0005CR-0C; Mon, 09 Jan 2017 03:46:00 +0100 Received: from localhost (athene.usta.de [local]) by athene.usta.de (OpenSMTPD) with ESMTPA id 4317706e; Mon, 9 Jan 2017 03:45:55 +0100 (CET) Date: Mon, 9 Jan 2017 03:45:55 +0100 From: Ingo Schwarze To: Yuri Pankov Cc: discuss@mdocml.bsd.lv Subject: Re: making all warnings fatal again? Message-ID: <20170109024555.GF4271@athene.usta.de> References: <4e555214-ac40-382d-5495-533423a35219@gmail.com> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e555214-ac40-382d-5495-533423a35219@gmail.com> User-Agent: Mutt/1.6.2 (2016-07-01) Hi, Yuri Pankov wrote on Sat, Jan 07, 2017 at 05:33:26AM +0300: > Switching from 1.13.3 to 1.13.4 made mandoc -Tlint exit 0 > instead of 2 for *some* of the warnings it reports. > Is there a way to make all warnings "fatal" again? Ouch. That is an evil regression that i missed. Thank you very much for reporting it! > For example (not limited to this one, of course): > > 1.13.3: > > $ mandoc -Tlint foo.1; echo $? > mandoc: foo.1:2:5: WARNING: lower case character in document title: Dt foo > 2 > > 1.13.4: > > $ mandoc -Tlint foo.1; echo $? > mandoc: foo.1:2:5: WARNING: lower case character in document title: Dt foo > 0 True, it got broken. Failures in the checks that were moved to mdoc_validate() and man_validate() got ignored in the mandoc(1) EXIT STATUS, which was wrong. I just fixed it in bsd.lv -current and in OpenBSD with the commit below. I hope that it applies to the illumos tree. It does apply to the vanilla 1.13.4 release version for me, and it seems to work there, too, and not just in HEAD. When 1.13.5 and 1.14 get released, this fix wil be contained, but there is no release schedule yet. > P.S.: are the list archives available somewhere? Unfortunately, no. The list server does retain copies of the messages gone through, but the work of making them public was never done. Yours, Ingo Log Message: ----------- Warnings and errors that occur during mdoc_validate() or during man_validate() have to affect the mandoc(1) EXIT STATUS. Many thanks to (illumos developer) for reporting this regression. Modified Files: -------------- mdocml: main.c mandoc.3 mandoc.h read.c Revision Data ------------- Index: mandoc.3 =================================================================== RCS file: /home/cvs/mdocml/mdocml/mandoc.3,v retrieving revision 1.37 retrieving revision 1.38 diff -Lmandoc.3 -Lmandoc.3 -u -p -r1.37 -r1.38 --- mandoc.3 +++ mandoc.3 @@ -1,7 +1,7 @@ .\" $Id$ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons -.\" Copyright (c) 2010-2016 Ingo Schwarze +.\" Copyright (c) 2010-2017 Ingo Schwarze .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -34,7 +34,8 @@ .Nm mparse_reset , .Nm mparse_result , .Nm mparse_strerror , -.Nm mparse_strlevel +.Nm mparse_strlevel , +.Nm mparse_updaterc .Nd mandoc macro compiler library .Sh SYNOPSIS .In sys/types.h @@ -100,6 +101,11 @@ .Fo mparse_strlevel .Fa "enum mandoclevel" .Fc +.Ft void +.Fo mparse_updaterc +.Fa "struct mparse *parse" +.Fa "enum mandoclevel *rc" +.Fc .In roff.h .Ft void .Fo deroff @@ -181,6 +187,9 @@ or .Fn man_validate , respectively; .It +if information about the validity of the input is needed, fetch it with +.Fn mparse_updaterc ; +.It iterate over parse nodes with starting from the .Fa first member of the returned @@ -412,6 +421,22 @@ implemented in .Pa read.c . .It Fn mparse_strlevel Return a statically-allocated string representation of a level code. +Declared in +.In mandoc.h , +implemented in +.Pa read.c . +.It Fn mparse_updaterc +If the highest warning or error level that occurred during the current +.Fa parse +is higher than +.Pf * Fa rc , +update +.Pf * Fa rc +accordingly. +This is useful after calling +.Fn mdoc_validate +or +.Fn man_validate . Declared in .In mandoc.h , implemented in Index: read.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/read.c,v retrieving revision 1.156 retrieving revision 1.157 diff -Lread.c -Lread.c -u -p -r1.156 -r1.157 --- read.c +++ read.c @@ -867,6 +867,13 @@ mparse_result(struct mparse *curp, struc } void +mparse_updaterc(struct mparse *curp, enum mandoclevel *rc) +{ + if (curp->file_status > *rc) + *rc = curp->file_status; +} + +void mandoc_vmsg(enum mandocerr t, struct mparse *m, int ln, int pos, const char *fmt, ...) { Index: mandoc.h =================================================================== RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v retrieving revision 1.212 retrieving revision 1.213 diff -Lmandoc.h -Lmandoc.h -u -p -r1.212 -r1.213 --- mandoc.h +++ mandoc.h @@ -435,3 +435,4 @@ void mparse_result(struct mparse *, const char *mparse_getkeep(const struct mparse *); const char *mparse_strerror(enum mandocerr); const char *mparse_strlevel(enum mandoclevel); +void mparse_updaterc(struct mparse *, enum mandoclevel *); Index: main.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/main.c,v retrieving revision 1.277 retrieving revision 1.278 diff -Lmain.c -Lmain.c -u -p -r1.277 -r1.278 --- main.c +++ main.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze + * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any @@ -781,6 +781,7 @@ parse(struct curparse *curp, int fd, con break; } } + mparse_updaterc(curp->mp, &rc); } static void -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv