Re: improved mh-chart man page

2021-03-23 Thread David Levine
Paul wrote:

> I'm fine with not relying on GNU-isms, and I think we should avoid
> the cutting edge in general, but in this case, I think we can take
> a step forward.  If we get complaints, I'll be happy to revert to
> backticks.

Sounds like a plan.

David



Re: improved mh-chart man page

2021-03-23 Thread Paul Fox
ken wrote:
 > >I vote to stay with backticks.  We've maintained (or at least tried to
 > >maintain) Bourne shell throughout the rest of nmh, and I think we
 > >should keep it that way.
 > 
 > Officially, $(...) is part of POSIX; it's not a Bash-ism.
 > 
 > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html


And, in fact, it was part of the POSIX.2 standard of 1994, 27 years ago:
https://pubs.opengroup.org/onlinepubs/009656399/toc.pdf  (p.36)

 > 
 > We USED to use $(...) in the test suite.  But that was dropped because
 > it turns out that /bin/sh on Solaris does not support that (at least, that
 > was my memory).  I am neutral about whether or not we should continue
 > to support ancient shells.

I suspect anyone still running Solaris has long ago figured out how
to deal with "modern" shell features creeping into their ecosystem.
But how old, exactly, does a Solaris system need to be to not be
running a POSIX compliant shell?

I'm fine with not relying on GNU-isms, and I think we should avoid
the cutting edge in general, but in this case, I think we can take
a step forward.  If we get complaints, I'll be happy to revert to
backticks.

paul
=--
paul fox, p...@foxharp.boston.ma.us (arlington, ma, where it's 55.0 degrees)




Re: improved mh-chart man page

2021-03-23 Thread Valdis Klētnieks
On Tue, 23 Mar 2021 16:09:38 -0400, Ken Hornstein said:

> We USED to use $(...) in the test suite.  But that was dropped because
> it turns out that /bin/sh on Solaris does not support that (at least, that
> was my memory).  I am neutral about whether or not we should continue
> to support ancient shells.

The question becomes:  How many users are (a) on Solaris that old
*and* (b) likely to update to nhm 1.7.1?

And is there anything we can to do help them migrate off ancient
Solaris to semi-this-century Solaris?


pgprXews0qd9u.pgp
Description: PGP signature


Re: improved mh-chart man page

2021-03-23 Thread Ken Hornstein
>I vote to stay with backticks.  We've maintained (or at least tried to
>maintain) Bourne shell throughout the rest of nmh, and I think we
>should keep it that way.

Officially, $(...) is part of POSIX; it's not a Bash-ism.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html

We USED to use $(...) in the test suite.  But that was dropped because
it turns out that /bin/sh on Solaris does not support that (at least, that
was my memory).  I am neutral about whether or not we should continue
to support ancient shells.

--Ken



Re: improved mh-chart man page

2021-03-23 Thread David Levine
Paul wrote:

> I only used the backticks because they'd already
> been used in that script, and I couldn't remember how strict we were
> being about our build environment.

I vote to stay with backticks.  We've maintained (or at least tried to
maintain) Bourne shell throughout the rest of nmh, and I think we
should keep it that way.

David



Re: improved mh-chart man page

2021-03-23 Thread Paul Fox
john wrote:
 > On 3/23/2021 5:26 PM, Robert Elz wrote:
 > >  Date:Tue, 23 Mar 2021 08:28:24 -0400
 > >  From:Paul Fox 
 > >  Message-ID:  <20210323122824.e92ca5180...@grass.foxharp.boston.ma.us>
 > >
 > >| Are we allowed to use $(...) instead of `...` ?
 > >
 > > I would.  I cannot imagine any shell anyone is likely to really use
 > > which doesn't support that.
 > >
 > 
 > $() is less prone to errors (1, Command Substitution).

Excellent.  Thanks.  I only used the backticks because they'd already
been used in that script, and I couldn't remember how strict we were
being about our build environment.

I'll change them all to $(...).  I haven't personally used a backtick
in my own scripts for...  decades?  I'd actually forgotten the baroque
behavior of backlash quoting.

And echo --> printf.  Again, I was nervous about introducing it.

paul
=--
paul fox, p...@foxharp.boston.ma.us (arlington, ma, where it's 57.2 degrees)




Re: improved mh-chart man page

2021-03-23 Thread john doe

On 3/23/2021 5:26 PM, Robert Elz wrote:

 Date:Tue, 23 Mar 2021 08:28:24 -0400
 From:Paul Fox 
 Message-ID:  <20210323122824.e92ca5180...@grass.foxharp.boston.ma.us>

   | Are we allowed to use $(...) instead of `...` ?

I would.  I cannot imagine any shell anyone is likely to really use
which doesn't support that.



$() is less prone to errors (1, Command Substitution).


I'd also use printf instead of echo - even if the shell doesn't have
printf built in (possible, if unlikely) the command will exist.  echo
is just too bizarre on some systems (especially since *roff input is
a place where \ characters abound, and those are how you can shoot
yourself with echo).

And quote expansions almost always, no matter how safe you believe they
are.

These latter two probably don't matter for the current nmh man page set,
but for the future, who knows.



+1


1)  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html
--
John Doe



Re: improved mh-chart man page

2021-03-23 Thread Robert Elz
Date:Tue, 23 Mar 2021 08:28:24 -0400
From:Paul Fox 
Message-ID:  <20210323122824.e92ca5180...@grass.foxharp.boston.ma.us>

  | Are we allowed to use $(...) instead of `...` ?

I would.  I cannot imagine any shell anyone is likely to really use
which doesn't support that.

I'd also use printf instead of echo - even if the shell doesn't have
printf built in (possible, if unlikely) the command will exist.  echo
is just too bizarre on some systems (especially since *roff input is
a place where \ characters abound, and those are how you can shoot
yourself with echo).

And quote expansions almost always, no matter how safe you believe they
are.

These latter two probably don't matter for the current nmh man page set,
but for the future, who knows.

kre





Re: improved mh-chart man page

2021-03-23 Thread Paul Fox
david wrote:
 > Paul wrote:
 > > I believe my script changes are "old shell" compatible, if not
 > > "ancient shell" compatible.  I get the same output if I run it with
 > > either "bash --posix" or "ash".
 > 
 > grep -A is a GNU-ism.  Maybe something like sed -n '/.SH NAME/{n;p;}'
 > would simplify that whole line?
 > 

Thanks.  Much better.  I think I only finally internalized how to
introduce newlines in the output with sed a year or two ago.  If I
master function groups now, maybe there's hope for someday being able
to use the hold space without visiting one of the sed cheat sheet
sites!  (Kind of embarrassing for a guy who first used sed over 40
years ago.)

Are we allowed to use $(...) instead of `...` ?  I hate working around
the deficiencies of `...`.

paul
=--
paul fox, p...@foxharp.boston.ma.us (arlington, ma, where it's 35.8 degrees)