groff
[Top][All Lists]
Advanced

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

Re: [groff] 20/31: [nroff]: Improve portability.


From: Ingo Schwarze
Subject: Re: [groff] 20/31: [nroff]: Improve portability.
Date: Fri, 13 Aug 2021 15:19:02 +0200
User-agent: Mutt/1.12.2 (2019-09-21)

Hi Branden,

G. Branden Robinson wrote on Sun, Jul 25, 2021 at 02:39:49AM -0400:

> commit 8ca88a9c72b59da7e8757b8f6012aef5947ef144
> Author: G. Branden Robinson <g.branden.robinson@gmail.com>
> AuthorDate: Sat Jul 24 12:17:32 2021 +1000
> 
>     [nroff]: Improve portability.
>     
>     * src/roff/nroff/nroff.sh: Use Version 7 Unix sh-compatible form of
>       parameter expansion; per the GNU Autoconf manual[1], "[o]ld BSD
>       shells, including the Ultrix sh, don't accept the colon for any shell
>       substitution, and complain and die."  This is also the form of such
>       substitutions used elsewhere in the script, so they should be mutually
>       consistent.
>     
>     [1] https://www.gnu.org/software/autoconf/manual/autoconf-2.60/
>         html_node/Shell-Substitutions.html

I don't object to the code change, it does not really matter in
this case.  Arguably, groff=${GROFF_TEST_GROFF:-groff} is better
than groff=${GROFF_TEST_GROFF-groff} because if GROFF_TEST_GROFF
is defined but empty, POSIX specifies that the former results in
groff=groff (which is more or less sane) while the latter results
in groff="" (which is likely to cause very strange and confusing
error messages).  Then again, it doesn't really matter, no real-world
user sets GROFF_TEST_GROFF in the first place.

But if you care about portability, please stop reading the autoconf
manual right now and start reading POSIX.  The autoconf manual is
a giant pile of totally outdated, irrelevant, and generally exceedingly
bad advice.  Following it usually spawns traditions of cargo cult
programming and yields disgusting and hard-to-read code on top of
that.  In any case, please do not misuse the autoconf manual as a
rationale for any code change.

If you doubt my words, just go ahead and read any ./configure script
produced by autoconf.

Yours,
  Ingo


[...]
> diff --git a/src/roff/nroff/nroff.sh b/src/roff/nroff/nroff.sh
> index 951ad14..6c8ae85 100644
> --- a/src/roff/nroff/nroff.sh
> +++ b/src/roff/nroff/nroff.sh
> @@ -156,8 +156,8 @@ opts="-mtty-char$opts"
>  @GROFF_BIN_PATH_SETUP@
>  export GROFF_BIN_PATH
>  
> -# Let the test cases redirect us.
> -groff=${GROFF_TEST_GROFF:-groff}
> +# Let our test harness redirect us.
> +groff=${GROFF_TEST_GROFF-groff}
>  
>  # Note 1: It would be nice to apply the DRY ("Don't Repeat Yourself")
>  # principle here and store the entire command string to be executed into
[...]



reply via email to

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