On 04/08/2016 19:17, Harald van Dijk wrote:
On 04/08/2016 07:54, Kylie McClain wrote:
From: Kylie McClain <soma...@exherbo.org>

nl, while specified in POSIX, is rather obscure and isn't provided by
small
coreutils implementations such as `busybox`. This while loop works
just as
well for our purposes.
...
-sed 's/    -[a-z]*//' $temp2 | nl -ba -v0 |
+sed 's/    -[a-z]*//' $temp2 | while read line;do \
+    i=$(( ${i:--1} + 1 )); printf '%s %s\n' "${i}" "${line}";done |

$(( ... )) is mentioned in
<https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Shell-Substitutions.html>
as not universally supported, notably Solaris 10 /bin/sh does not have
it. Given that dash was fairly recently changed to make it build on
Solaris 9, it seems like a mistake to break that again.

I just realised that that particular change to make it build on Solaris 9 involved avoiding running mkbuiltins using sh, choosing to use $SHELL instead, as $SHELL should already have been picked by configure as something more modern. So the use of $(( ... )) should probably not be a problem after all...

Aside from that, i is such a common variable name that it seems risky to
assume it is unset. I know I've set it myself in shell sessions that I
ended up using for building dash. I never exported it, so it wouldn't
break here, but it doesn't seem like a stretch that someone else does
export it.

...as long as i is simply initialised before the loop.

Cheers,
Harald van Dijk
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to