Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 684304 - app-shells/dash - parameter expansion for positional parameters different from man page
Summary: app-shells/dash - parameter expansion for positional parameters different fro...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-24 20:09 UTC by Karsten
Modified: 2021-01-03 17:04 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 kfm 2021-01-03 08:40:44 UTC
This can be closed as no affected versions remain in the gentoo repo.