http://bugs.grommit.com/show_bug.cgi?id=399
Summary: "alias.sh" may execute the wrong command
Product: ksh93-integration
Version: unspecified
Platform: All
OS/Version: Solaris 11/Nevada
Status: NEW
Severity: normal
Priority: P3
Component: App/Other
AssignedTo: ksh93-integration-discuss at opensolaris.org
ReportedBy: roland.mainz at nrubsig.org
CC: roland.mainz at nrubsig.org
"alias.sh" may execute other commands than the (intended) builtin version if
the builtin itself is bound to a specific PATH element.
For example the current "alias.sh" looks like this:
-- snip --
#!/usr/bin/ksh93
builtin basename
cmd="$(basename "$0")"
${cmd} "$@"
-- snip --
... if PATH is /usr/xpg4/bin:/usr/bin, a "ls" builtin is bound to /usr/bin/ls
and the script should execute the "ls" builtin it will execute /usr/xpg4/bin/ls
instead of the builtin command because /usr/xpg4/bin comes before /usr/bin in
PATH.
The solution may be to execute a simple "builtin ${cmd}" before '${cmd} "$@"',
however this is tricky becase some consumers of "alias.sh" like "type" are in
fact aliases to other builtin commands, rendering the "builtin ${cmd}"-solution
useless.
AFAIK the solution is therefore to check whether the requested command is an
alias or not - if it isn't an alias we load the requested builtin command
without a path binding. If the command is an alias we assume that the executed
command is a "shell special builtin" which cannot be bound to a specific
element in PATH.
--
Configure bugmail: http://bugs.grommit.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.