Bug 853203

Summary: Sudo -i isn't passing command arguments containing spaces properly as of sudo-1.7.2p1-14.el5_8.3
Product: Red Hat Enterprise Linux 5 Reporter: Mike Hanby <flakrat>
Component: sudoAssignee: Daniel Kopeček <dkopecek>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.8CC: adaora.onyia, andriusb, ctatman, cww, dapospis, dkopecek, flakrat, gconradi, jraju, jshortt, ktoyama, pvrabec, rpiddapa, SCHAKRAB
Target Milestone: betaKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: sudo-1.7.2p1-25.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 00:28:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 883145    

Description Mike Hanby 2012-08-30 17:45:21 UTC
Description of problem:
I have a ruby script that I run via "sudo -i". The script expects some of its arguments to have spaces (ex: --fullname 'My Name').

Prior to updating sudo to sudo-1.7.2p1-14.el5_8.3, this worked. Now, the script variable associated with --fullname will only contain the portion up to the space, ex: My

Version-Release number of selected component (if applicable):
sudo-1.7.2p1-14.el5_8.3

How reproducible:
I'm able to reproduce this on EL5 and EL6, however Fedora 17 the code still works properly:

Works on EL5: sudo-1.7.2p1-14.el5_8
Fail on EL5: sudo-1.7.2p1-14.el5_8.2 and sudo-1.7.2p1-14.el5_8.3
Fail on EL6: sudo-1.7.4p5-13.el6_3.x86_64
Works on Fedora 17: sudo-1.8.3p1-7.fc17.x86_64

Steps to Reproduce:
1. Create the following test script:

#!/usr/bin/ruby -w
puts "Arg 0: #{ARGV[0]}" if ARGV[0]
puts "Arg 1: #{ARGV[1]}" if ARGV[1]
puts "Arg 2: #{ARGV[2]}" if ARGV[2]
puts "Arg 3: #{ARGV[3]}" if ARGV[3]

2. Execute the script using sudo without the -i switch and it will run properly
$ sudo ./ruby-test.rb Arg0 'Arg Num1' Arg2

Arg 0: Arg0
Arg 1: Arg Num1
Arg 2: Arg2

3. Now execute with sudo -i

$ sudo -i ~mhanby/tmp/ruby-test.rb Arg0 'Arg Num1' Arg2
Arg 0: Arg0
Arg 1: Arg
Arg 2: Num1
Arg 3: Arg2

Actual results:
the 2nd argument is a string containing a space, when run with -i this is getting split into multiple arguments

Expected results:
arguments with spaces surrounded by quotes should be treated as a single argument.

Additional info:
Something changed from sudo-1.7.2p1-14.el5_8 to sudo-1.7.2p1-14.el5_8.2 that is causing this behavior.

Comment 4 RHEL Program Management 2013-05-01 06:47:12 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 8 RHEL Program Management 2013-05-20 16:44:35 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 17 errata-xmlrpc 2013-10-01 00:28:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-1353.html