Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 684304

Summary: app-shells/dash - parameter expansion for positional parameters different from man page
Product: Gentoo Linux Reporter: Karsten <k-langeloh>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: kfm
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Karsten 2019-04-24 20:09:15 UTC
Maybe an upstream problem and not gentoo specific. 
The man page of app-shells/dash states under 'Parameter Expansion':

"The parameter name or symbol can be enclosed in braces, which are optional except for positional parameters with more than one digit or [...]"
IIRC this is also what is defined by the posix standard.

The behaviour though is that a shell script using dash as shell accepts $10 (without {}) as the 10th parameter.

-
testscript.sh
----
#!/bin/dash

echo $1-$10-${10}-
----
when called like: ./testscript.sh first 
should print: 'first-first0--'
but prints instead: 'first---'
Comment 1 Michael Orlitzky gentoo-dev 2019-04-25 01:20:44 UTC
That's outputting "$10" as the value of "$1", followed by the string "0", exactly like the spec says =)
Comment 2 Michael Orlitzky gentoo-dev 2019-04-25 01:24:58 UTC
Nevermind! I had your expected/actual cases reversed. Sorry for the noise.
Comment 3 Michael Orlitzky gentoo-dev 2019-04-25 01:50:08 UTC
Reported upstream at

  https://www.mail-archive.com/dash@vger.kernel.org/msg01878.html
Comment 4 RumpletonBongworth 2021-01-03 08:40:44 UTC
This can be closed as no affected versions remain in the gentoo repo.