Hi Karl,
Karl Berry <[email protected]> writes:
> Hi Collin, Dmitry, and all,
>
> The first patch removes a K&R declaration which are removed by C23, and
> likely to be removed by compilers in the future. I assume all compilers
> support ANSI C declarations nowadays.
> ...
> mips:*:*:UMIPS | mips:*:*:RISCos)
>
> But the question is not what compilers support "nowadays", but what the
> compiler on the system in your patch supports. Which is ancient
> MIPS. And as far as Wikipedia knows, MIPS/UMIPS and MIPS/RISCos have
> been discontinued for a long, long time. I suspect that some versions
> of their compiler don't support ANSI C declaration. In any case, I see
> no advantage to taking out the K&R declaration.
Ah, right, you are correct. It is 4.3BSD or Unix System V apparently
[1].
Thanks for correcting me, I have gotten used to deleting K&R
declarations out of instinct...
Therefore, ignore the first patch. The second is unrelated though, so
that is fine.
> It's the same reason why config.* should not be updated to use shell
> features that almost(*) every shell "nowadays" supports, like
> $(...). The scripts have to run on systems that definitely don't support
> that. Maybe in 50 years all those systems will be gone, though I
> wouldn't count on it. (Not that it'll matter to me one way or
> another. :)
> [...]
> (*) Last I checked, $(...) and other POSIX shell features are not
> supported by Solaris 10 /bin/sh, which is still widely, widely, used,
> and will continue to be for the foreseeable future.
Yep, Bruno tested shell portability a while ago [2]. Copying the results
from his tests:
====================== Results ======================
1 - accepted by configure (generated by autoconf 2.72)
2 - $(...) syntax for command substitution
3 - ${var#...} syntax for removing a prefix
4 - ${var%...} syntax for removing a suffix
5 - printf builtin supports octal escapes correctly
6 - local variables with non-surprising semantics
7 - sane tracing (set -x)
8 - locally bound shell options
9 - append operator
10 - associative arrays
1 2 3 4 5 6 7 8 9 10
bash 1.14.7 Y Y Y Y Y Y Y - - -
bash 2.05b Y Y Y Y Y Y Y - - -
bash 3.2.57 Y Y Y Y Y Y Y - Y -
bash 4.4.18 Y Y Y Y Y Y Y Y Y Y
bash 5.2.21 Y Y Y Y Y Y Y Y Y Y
dash 0.5.11 Y Y Y Y Y Y Y Y - -
zsh 5.8.11 Y Y Y Y Y Y Y Y Y Y
busybox sh Y Y Y Y Y Y Y Y - -
macOS 10.5 sh Y Y Y Y Y Y Y - Y -
macOS 12 sh Y Y Y Y Y Y Y - Y -
FreeBSD 5.2.1 sh Y Y Y Y Y - Y Y - -
FreeBSD 14.0 sh Y Y Y Y Y Y Y Y - -
NetBSD 10.0 sh Y Y Y Y Y - Y Y - -
OpenBSD 7.5 sh Y Y Y Y Y Y - Y - -
AIX 7.1 sh Y Y Y Y ? Y - Y - -
Solaris 10 sh - - - - Y - - - - -
Solaris 11 sh Y Y Y Y Y - - - Y -
Therefore, if one wants to test their shell script is portable they
should test it with Solaris 10 /bin/sh.
I already complained about that platform when you made changes to
mdate-sh, so I will not do it more here. :)
Collin
[1] https://umips.net/riscos/
[2]
https://cgit.git.savannah.gnu.org/cgit/gnulib/maint-tools.git/tree/test-programs/sh-features