Follow-up Comment #2, bug #66434 (group groff): [comment #1 comment #1:] > A way around this discussed in 65108 is removing the backslash requirement > from soelim. As you observed, "Since backslash-space is apparently a GNU > extension in the first place, we might consider dropping it."
In progress as we speak... commit 2d88c01b31420033b5d5d2f473b26cc7042c610e Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Tue Nov 12 10:26:07 2024 -0600 [soelim]: Fix Savannah #66027. Read argument to `so` request in a more GNU troff-ish fashion (and a more AT&T troff-ish fasion, if one considers the `ds` and `as` requests). Accept but discard a leading double quote to permit embedding of leading spaces in the file name, and accept unescaped literal spaces in argument. * src/preproc/soelim/soelim.cpp (do_so): Do it. * src/preproc/soelim/soelim.1.man (Description): Document it. * NEWS: Add item. Fixes <https://savannah.gnu.org/bugs/?66027>. diff --git a/ChangeLog b/ChangeLog index a7693c628..f08cc3875 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2024-11-12 G. Branden Robinson <g.branden.robin...@gmail.com> + + [soelim]: Read argument to `so` request in a more GNU troff-ish + fashion (and a more AT&T troff-ish fasion, if one considers the + `ds` and `as` requests). Accept but discard a leading double + quote to permit embedding of leading spaces in the file name, + and accept unescaped literal spaces in argument. + + * src/preproc/soelim/soelim.cpp (do_so): Do it. + * src/preproc/soelim/soelim.1.man (Description): Document it. + + * NEWS: Add item. + + Fixes <https://savannah.gnu.org/bugs/?66027>. + 2024-11-12 G. Branden Robinson <g.branden.robin...@gmail.com> [soelim]: Fix code style nits. diff --git a/NEWS b/NEWS index a40ed64fe..ca2bda6ba 100644 --- a/NEWS +++ b/NEWS @@ -184,6 +184,17 @@ nroff * nroff now supports clustered options ("-tzms", for example) as groff, troff, and other GNU getopt-using programs do. +soelim +------ + +* soelim no longer requires embedded space characters in `so` arguments + to be backslash-escaped. (It continues to support that syntax.) If + the argument to a `so` request must contain leading spaces, any such + sequence of spaces must now be prefixed with a double quote character + ("), which the program then discards. These changes are to better + align this program's parsing rules with those of GNU troff and of + AT&T troff historically; consider the `ds` and `as` requests. + Macro packages -------------- diff --git a/src/preproc/soelim/soelim.1.man b/src/preproc/soelim/soelim.1.man index 7bec18434..5670a8348 100644 --- a/src/preproc/soelim/soelim.1.man +++ b/src/preproc/soelim/soelim.1.man @@ -135,19 +135,34 @@ .SH Description . . .PP -If the name of a +.I @g@soelim +reads the .I included-file -contains a backslash, +argument as +GNU +.I troff \" GNU +does. +. +It ignores spaces immediately after \[lq]so\[rq]; +to embed a sequence of one or more leading spaces in the argument, +prefix the sequence with a neutral double quote +.RB ( \[dq] ). +. +Non-leading spaces are interpreted literally. +. +If the included file name requires a backslash, use .B \[rs]\[rs] or .B \[rs]e to embed it. . -To embed a space, -write -.RB \[lq] \[rs]\~ \[rq] -(backslash followed by a space). +A backslash followed by a space +.RB (\[lq] \[rs]\~ \[rq]) +also encodes a space, +for compatibility with earlier versions of +GNU +.IR soelim . \" GNU . Any other escape sequence in .IR included-file , @@ -157,6 +172,12 @@ .SH Description .I @g@soelim from replacing the source request. . +AT&T and descendant versions of +.I soelim +have no means of embedding spaces in file names; +they replace the first space encountered with a newline +and stop interpreting the request. +. . .PP The dot must be at the beginning of a line and must be followed by diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp index e10447d06..28e80d736 100644 --- a/src/preproc/soelim/soelim.cpp +++ b/src/preproc/soelim/soelim.cpp @@ -140,9 +140,10 @@ void do_so(const char *line) p++; string filename; bool is_filename_valid = true; - for (const char *q = p; - is_filename_valid && *q != '\0' && *q != '\n' && *q != ' '; - q++) + const char *q = p; + if ('"' == *q) + q++; + for (; is_filename_valid && (*q != '\0') && (*q != '\n'); q++) if (*q == '\\') { switch (*++q) { case 'e': _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?66434> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature