I have an inkling that changing strip.sed might give some people a heart
attack.

I'm attaching a diff -urN of build/tmac before and after this commit to
show that undesired no side effects were introduced.

And the best news of all is that strip.sed will no longer do anything at
all to files that don't invite its meddling with "%beginstrip%".

At 2018-11-05T07:14:54-0500, G. Branden Robinson wrote:
> gbranden pushed a commit to branch master
> in repository groff.
> 
> commit c4d82acf4de9f1d6e19ef824607f3fd45f0dcf33
> Author: G. Branden Robinson <g.branden.robin...@gmail.com>
> Date:   Mon Nov 5 07:00:46 2018 -0500
> 
>     tmac/strip.sed: Operate only if given permission.
>     
>       * tmac/strip.sed: Do nothing whatsoever to any input file that
>       lacks a line matching "%beginstrip%".  This implements a
>       contract between the macro file writer and the stripper script
>       (roff input is not parseable with crude weaponry like regular
>       expressions).  In practice, most of the changes performed by the
>       script were already in a block enforcing this.  My changes:
>         + Stop unconditionally inserting a roff comment noting the
>           reader of stripping at line 2.  Instead, replace the line
>           matching "%beginstrip%" with this comment if and only if it
>           is present.
>         + Stop deleting lines containing only the empty request if
>           they occur before "%beginstrip%".
>         + Tweak the wording of the roff comment.
>         + Remove comment within the sed script; see
>       <https://lists.gnu.org/archive/html/groff/2017-11/msg00057.html>
>           and the sed section of "Limitations of Usual Tools" in the
>           GNU Autoconf Manual.
>     
>       * tmac/e.tmac-u: Add a comment line to visually separate the end
>       of the license statement from the comment emplaced by strip.sed.
>       This is also consistent with the mdoc macro files.
>     
>       Invalidates <https://savannah.gnu.org/bugs/index.php?53784>.
>     
>     Signed-off-by: G. Branden Robinson <g.branden.robin...@gmail.com>
> ---
>  tmac/e.tmac-u  | 1 +
>  tmac/strip.sed | 9 ++++-----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tmac/e.tmac-u b/tmac/e.tmac-u
> index 5aabfa9..cba8fbc 100644
> --- a/tmac/e.tmac-u
> +++ b/tmac/e.tmac-u
> @@ -10,6 +10,7 @@
>  .\" University may not be used to endorse or promote products derived
>  .\" from this software without specific prior written permission.  This
>  .\" software is provided "as is" without express or implied warranty.
> +.\"
>  .\"  %beginstrip%
>  .\"
>  .\"**************************************************************
> diff --git a/tmac/strip.sed b/tmac/strip.sed
> index c2c9e89..7175637 100644
> --- a/tmac/strip.sed
> +++ b/tmac/strip.sed
> @@ -1,8 +1,7 @@
> -2 i\
> -.\\" This is a generated file, created by 'tmac/strip.sed' in groff's\
> -.\\" source code bundle from a file having '-u' appended to its name.
> -# strip comments, spaces, etc., after a line containing '%beginstrip%'
>  /%beginstrip%/,$ {
> +  /%beginstrip%/c\
> +.\\" This is a generated file, created by 'tmac/strip.sed' in groff's\
> +.\\" source distribution from a file having '-u' appended to its name.
>    s/^\.[      ]*/./
>    s/^\.\\".*/./
>    s/^\\#.*/./
> @@ -10,5 +9,5 @@
>    s/\\#.*/\\/
>    /.[ad]s/!s/[        ]*\\"//
>    /.[ad]s/s/\([^      ]*\)\\"/\1/
> +  /^\.$/d
>  }
> -/^\.$/d
> 
> _______________________________________________
> Groff-commit mailing list
> groff-com...@gnu.org
> https://lists.gnu.org/mailman/listinfo/groff-commit

-- 
Regards,
Branden
diff -urN build.prev/tmac/doc-common build/tmac/doc-common
--- build.prev/tmac/doc-common	2018-11-05 05:38:41.853064440 -0500
+++ build/tmac/doc-common	2018-11-05 06:45:53.027327662 -0500
@@ -1,6 +1,4 @@
 .\" Copyright (c) 1991, 1993
-.\" This is a generated file, created by 'tmac/strip.sed' in groff's
-.\" source code bundle from a file having '-u' appended to its name.
 .\"   The Regents of the University of California.  All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -33,6 +31,8 @@
 .\"
 .\"     @(#)doc-common	8.1 (Berkeley) 06/08/93
 .\"
+.\" This is a generated file, created by 'tmac/strip.sed' in groff's
+.\" source distribution from a file having '-u' appended to its name.
 .nr %A 1
 .nr %B 1
 .nr %C 1
diff -urN build.prev/tmac/doc-ditroff build/tmac/doc-ditroff
--- build.prev/tmac/doc-ditroff	2018-11-05 05:38:41.857064375 -0500
+++ build/tmac/doc-ditroff	2018-11-05 06:45:53.031327603 -0500
@@ -1,6 +1,4 @@
 .\" Copyright (c) 1991, 1993
-.\" This is a generated file, created by 'tmac/strip.sed' in groff's
-.\" source code bundle from a file having '-u' appended to its name.
 .\"   The Regents of the University of California.  All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -33,6 +31,8 @@
 .\"
 .\"     @(#)doc-ditroff	8.1 (Berkeley) 06/08/93
 .\"
+.\" This is a generated file, created by 'tmac/strip.sed' in groff's
+.\" source distribution from a file having '-u' appended to its name.
 .eo
 .if !r D .nr D 0
 .if !r cR .nr cR 0
diff -urN build.prev/tmac/doc-nroff build/tmac/doc-nroff
--- build.prev/tmac/doc-nroff	2018-11-05 05:38:41.861064311 -0500
+++ build/tmac/doc-nroff	2018-11-05 06:45:53.031327603 -0500
@@ -1,6 +1,4 @@
 .\" Copyright (c) 1991, 1993
-.\" This is a generated file, created by 'tmac/strip.sed' in groff's
-.\" source code bundle from a file having '-u' appended to its name.
 .\"   The Regents of the University of California.  All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -33,6 +31,8 @@
 .\"
 .\"     @(#)doc-nroff	8.1 (Berkeley) 06/08/93
 .\"
+.\" This is a generated file, created by 'tmac/strip.sed' in groff's
+.\" source distribution from a file having '-u' appended to its name.
 .eo
 .if !r D .nr D 0
 .if !r cR .nr cR 1
diff -urN build.prev/tmac/doc-old.tmac build/tmac/doc-old.tmac
--- build.prev/tmac/doc-old.tmac	2018-11-05 05:38:41.889063859 -0500
+++ build/tmac/doc-old.tmac	2018-11-05 06:45:53.047327366 -0500
@@ -1,6 +1,4 @@
 .\" Copyright (c) 1990 The Regents of the University of California.
-.\" This is a generated file, created by 'tmac/strip.sed' in groff's
-.\" source code bundle from a file having '-u' appended to its name.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -1860,6 +1858,7 @@
 .\" ====================================================================
 .\" Editor settings
 .\" ====================================================================
+.
 .\" Local Variables:
 .\" mode: nroff
 .\" fill-column: 72
diff -urN build.prev/tmac/doc-syms build/tmac/doc-syms
--- build.prev/tmac/doc-syms	2018-11-05 05:38:41.865064246 -0500
+++ build/tmac/doc-syms	2018-11-05 06:45:53.035327543 -0500
@@ -1,6 +1,4 @@
 .\" Copyright (c) 1991, 1993
-.\" This is a generated file, created by 'tmac/strip.sed' in groff's
-.\" source code bundle from a file having '-u' appended to its name.
 .\"   The Regents of the University of California.  All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -33,6 +31,8 @@
 .\"
 .\"     @(#)doc-syms	8.1 (Berkeley) 06/08/93
 .\"
+.\" This is a generated file, created by 'tmac/strip.sed' in groff's
+.\" source distribution from a file having '-u' appended to its name.
 .eo
 .de Ux
 .nr doc-curr-font \n[.f]
diff -urN build.prev/tmac/doc.tmac build/tmac/doc.tmac
--- build.prev/tmac/doc.tmac	2018-11-05 05:38:41.889063859 -0500
+++ build/tmac/doc.tmac	2018-11-05 06:45:53.047327366 -0500
@@ -1,6 +1,4 @@
 .\" Copyright (c) 1991, 1993
-.\" This is a generated file, created by 'tmac/strip.sed' in groff's
-.\" source code bundle from a file having '-u' appended to its name.
 .\"   The Regents of the University of California.  All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -46,6 +44,8 @@
 .\" to make it more readable: using long names and many groff features,
 .\" updating and extending documentation, etc.
 .\"
+.\" This is a generated file, created by 'tmac/strip.sed' in groff's
+.\" source distribution from a file having '-u' appended to its name.
 .if !\n(.g \
 .ab This version of mdoc can be run with GNU troff only!
 .do if d Dd .nx
diff -urN build.prev/tmac/e.tmac build/tmac/e.tmac
--- build.prev/tmac/e.tmac	2018-11-05 05:38:41.873064117 -0500
+++ build/tmac/e.tmac	2018-11-05 06:45:53.039327484 -0500
@@ -1,6 +1,4 @@
 .\"	@(#)e.tmac	2.31 (Berkeley) 5/21/88
-.\" This is a generated file, created by 'tmac/strip.sed' in groff's
-.\" source code bundle from a file having '-u' appended to its name.
 .\"	Modified by James Clark for use with groff.
 .\"
 .\" Copyright (c) 1988 Regents of the University of California.
@@ -12,6 +10,9 @@
 .\" University may not be used to endorse or promote products derived
 .\" from this software without specific prior written permission.  This
 .\" software is provided "as is" without express or implied warranty.
+.\"
+.\" This is a generated file, created by 'tmac/strip.sed' in groff's
+.\" source distribution from a file having '-u' appended to its name.
 .do nr need_eo_h 0
 .do nr need_eo_tl 0
 .do nr need_tl 1
diff -urN build.prev/tmac/groff_man.7 build/tmac/groff_man.7
--- build.prev/tmac/groff_man.7	2018-11-05 05:38:41.525069731 -0500
+++ build/tmac/groff_man.7	2018-11-05 06:29:45.664195232 -0500
@@ -1,5 +1,5 @@
 '\" t
-.TH GROFF_MAN 7 "5 November 2018" "groff 1.22.4.rc3.18-6cef"
+.TH GROFF_MAN 7 "5 November 2018" "groff 1.22.4.rc3.18-a9b9a-dirty"
 .SH NAME
 groff_man \- GNU roff macro package for formatting man pages
 .
diff -urN build.prev/tmac/groff_me.7 build/tmac/groff_me.7
--- build.prev/tmac/groff_me.7	2018-11-05 05:38:41.533069602 -0500
+++ build/tmac/groff_me.7	2018-11-05 06:29:45.660195321 -0500
@@ -1,6 +1,6 @@
 '\" t
 .hc %
-.TH GROFF_ME 7 "4 November 2018" "1.22.4.rc3.18-6cef"
+.TH GROFF_ME 7 "4 November 2018" "1.22.4.rc3.18-a9b9a-dirty"
 .SH NAME
 groff_me \- \(lqme\(rq macro package for formatting documents with GNU roff
 .
diff -urN build.prev/tmac/groff_ms.7 build/tmac/groff_ms.7
--- build.prev/tmac/groff_ms.7	2018-11-05 05:38:41.517069860 -0500
+++ build/tmac/groff_ms.7	2018-11-05 06:29:45.636195856 -0500
@@ -2,7 +2,7 @@
 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
 .do nr groff_ms_C \n[.C]
 .cp 0
-.TH GROFF_MS 7 "4 July 2018" "groff 1.22.4.rc3.18-6cef"
+.TH GROFF_MS 7 "4 July 2018" "groff 1.22.4.rc3.18-a9b9a-dirty"
 .SH NAME
 groff_ms \- GNU roff manuscript macro package for formatting documents
 .
diff -urN build.prev/tmac/groff_trace.7 build/tmac/groff_trace.7
--- build.prev/tmac/groff_trace.7	2018-11-05 05:38:41.557069215 -0500
+++ build/tmac/groff_trace.7	2018-11-05 06:29:45.696194520 -0500
@@ -1,4 +1,4 @@
-.TH GROFF_TRACE 7 "3 July 2018" "groff 1.22.4.rc3.18-6cef"
+.TH GROFF_TRACE 7 "3 July 2018" "groff 1.22.4.rc3.18-a9b9a-dirty"
 .SH NAME
 groff_trace \- groff macro package trace.tmac
 .
diff -urN build.prev/tmac/groff_www.7 build/tmac/groff_www.7
--- build.prev/tmac/groff_www.7	2018-11-05 05:38:41.577068892 -0500
+++ build/tmac/groff_www.7	2018-11-05 06:29:45.700194431 -0500
@@ -1,4 +1,4 @@
-.TH GROFF_WWW 7 "25 October 2018" "groff 1.22.4.rc3.18-6cef"
+.TH GROFF_WWW 7 "25 October 2018" "groff 1.22.4.rc3.18-a9b9a-dirty"
 .SH NAME
 groff_www \- groff macros for authoring web pages
 .

Attachment: signature.asc
Description: PGP signature

Reply via email to