Bug 564 - sudo is escaping $ leaving no access to env variables
sudo is escaping $ leaving no access to env variables
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.4
PC Linux
: normal normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-17 14:16 MDT by Bert
Modified: 2013-09-30 09:36 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bert 2012-07-17 14:16:08 MDT
The fix for bug 413 is to escape non-alfanumeric characters , except - and _ Because of this $ is also escaped and it's not possible anymore
to pass commands which use environment variables, braking other scripts.

Before the escaping this worked:
$ sudo -i '/bin/echo "$USER"'
root

After the escaping spaces etc. are escaped so this doesn't work anymore:
$ sudo -i '/bin/echo "$USER"'
-bash: /bin/echo "$USER": No such file or directory

And 
$ sudo -i /bin/echo '$USER'
$USER

So there's no easy way anymore to get the effect from before the escaping.On the other hand before the escaping there was another way to perform the command the fix was made for:
e.g. instead of 
$ sudo -i ls "something is here"

you could have done

$sudo -i 'ls "something is here"'
Comment 1 Todd C. Miller 2013-09-30 09:36:01 MDT
Fixed in sudo 1.8.8.