[comp.sys.hp] Documented bug in Bourne shell functions

vic@grep.co.uk (Victor Gavin) (03/06/91)

I found a ``bug'' in the Bourne shell which HP has documented and
refuses to fix.

The bug is that after you've invoked a shell function, the positional
parameters of the running shell are reset to the arguments passed to
the function.

When I called it into HP, I was informed that this is the documented
behaviour and that back in 85/86 an SR had been raised internally
(4000022558) to look into it and that recently (in the last 6 months)
another SR (1650123364) had been raised to look into it.

The labs had replied that it won't be fixed as the shell will change
for Posix compliance anyway -- whenever that arrives :-(

Here's the script, invoke with ``sh ./script abc def'' or
``ksh ./script abc def'' to see it working properly.

...............................................................................
func()
{
 :
}

echo "Args before function call are \"$*\""
func laser
echo "Args after function call are \"$*\""
...............................................................................