groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pic/-ms inconsistency in groff 1.23.0


From: G. Branden Robinson
Subject: Re: pic/-ms inconsistency in groff 1.23.0
Date: Mon, 17 Jul 2023 14:35:59 -0500

Hi Doug & Dave,

At 2023-07-17T10:33:30-0400, Douglas McIlroy wrote:
> which causes groff -ms to barf:
>      s.tmac: ... error: .PS: expected 2 arguments, got 3; not
> preprocessed with pic?

Thanks for trying out groff 1.23.0!  I hope it seems like an improvement
in respects other than this one.

At 2023-07-17T11:20:11-0500, Dave Kemper wrote:
> 1.22.4 pic also turned it into that, so it is -ms's behavior that has
> changed.
> 
> $ cat pictest
> .PS 6i
> circle
> .PE
> $ pic --version
> GNU pic (groff) version 1.22.4
> $ pic pictest | fgrep .PS
> .PS 6.000i 6.000i 6i
> $
> 
> Commit b16ad66b
> (http://git.savannah.gnu.org/cgit/groff.git/commit/?id=b16ad66b) seems
> the likely culprit:
> 
> Author: G. Branden Robinson <g.branden.robinson@gmail.com>
> Date:   Mon Aug 15 00:24:48 2022 -0500
> 
>     [ms]: Validate `PS` arguments better.
> 
>     * tmac/s.tmac (@PS): Validate better; check for 2 arguments exactly.
> 
>     Also improve diagnostic message wording.

Confirmed.  My incomplete understanding of pic(1), spottier even than my
understanding of eqn(1), created a problem here.

In a pinch, the following patch will disable the oversensitive
validation.

diff --git a/tmac/s.tmac b/tmac/s.tmac
index 5fc1237eb..f4a97eb0f 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -2095,7 +2095,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .de @PS
 .br
 .sp \\n[DD]u
-.ie !\\n[.$]=2 \{\
+.ie 0 \{\
 .      ds pic*msg .PS: expected 2 arguments, got \\n[.$]\"
 .      as pic*msg ; not preprocessed with pic?\"
 .      @error \\*[pic*msg]

I will try to find out where on earth the rewriting of `PS` macro calls
is documented, what arguments beyond the third mean, and correct the
validation logic in groff ms.

Testing of DWB 3.3 and Heirloom pic suggests that all arguments given to
`PS` in the source document are simply stuck on to the same call as the
3rd and subsequent arguments in the output.  If there is no access to
these arguments in the pic language, it seems to me that it would have
been better to put a \" comment escape sequence ahead of them.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]