Bug 1729 - Bash environmental associative arrays not getting set
Summary: Bash environmental associative arrays not getting set
Status: CLOSED WONTFIX
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 5.2p1
Hardware: Other Linux
: P2 minor
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-02 07:57 AEDT by Matt Woodson
Modified: 2010-04-16 15:50 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Woodson 2010-03-02 07:57:58 AEDT
In Bash 4.0 associative arrays were introduced.  There are some environmental variables that are associative arrays.  One of these variables is the BASH_ALIASES associative array.  Documentation can be found here:

http://www.gnu.org/software/bash/manual/bashref.html#Bash-Variables

In short, it's an active array of the system aliases,  with both the alias and the corresponding command kept track of.

For example, to set:

$ BASH_ALIASES[cdt]="cd /tmp"

would be the equivalent of:

$ alias cdt="cd /tmp"

Setting this variable, the alias is instantly available in that bash environment.

Now, when passing these variables with SSH, ssh doesn't interpret these variables as special.  I've tested this on two different distros, Fedora 12 (OpenSSH_5.2p1) and Ubuntu 9.10 (OpenSSH_5.1p1).  Both give different the same bad result.

My environment file:

$ cat environment 
BASH_ALIASES[cdt]="cd /tmp"
TESTME="This is a test"

On F12 & Ub 9.10:
-after an ssh to Ub 9.10 box, the $TESTME variable is set and can be seen when the 'set' or 'env' command is run. The $BASH_ALIASES variable appears in the list as a regular environment variable, ignoring the associative  There is no "cdt" alias either.  It didn't add this to the associative array.

$ env | grep BASH
BASH_ALIASES[cdt]="cd /tmp"
$
Comment 1 Damien Miller 2010-03-26 10:50:27 AEDT
I don't think that this is under our control - OpenSSH passes all variables though execve() and doesn't filter them if they contain special characters (e.g. square brackets). Perhaps your kernel or bash itself it rejecting them?
Comment 2 Damien Miller 2010-04-16 15:50:47 AEST
Mass move of bugs RESOLVED->CLOSED following the release of openssh-5.5p1