On Fri, Jun 03, 2011 at 03:26:37PM -0400, Adam Price wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=710554
> 
> 
> I have attached for review a patch to fix this issue.

[...]

> diff --git a/spacecmd/src/lib/shell.py b/spacecmd/src/lib/shell.py
> index c95655b..df437e8 100644
> --- a/spacecmd/src/lib/shell.py
> +++ b/spacecmd/src/lib/shell.py
> @@ -126,8 +126,10 @@ class SpacewalkShell(Cmd):
>              args = ''
>  
>          # print the help message if the user passes '--help'
> -        if re.search('--help', line):
> -            return 'help %s' % command
> +        line_parts = line.split("\"")
> +        for i in range(0, len(line_parts), 2):
> +            if re.search('--help', line):
> +                return 'help %s' % command

I don't believe the patch is a proper fix.

The bugzilla does not include the exact reproducer, so let's start
with

        $ spacecmd -s 'localhost' -- softwarechannel_create -n 'test123--help' 
-l 'test123--help' -a 'x86_64'

The split line.split("\"") seems to be bogus -- we already have the
line split to parts via

        parts = line.split()
        
and there are no doublequotes in the data to split on anyway.

Of course, there seems to be a more general problem of parsing the
commands:

        $ spacecmd -s 'localhost' -- softwarechannel_create -n 'test123 --help' 
-l 'test123--help' -a 'x86_64'

(not the space in the -n option) gets split by the

        ['softwarechannel_create', '-n', 'test123', '--help', '-l', 
'test123--help', '-a', 'x86_64']

-- so even if they were passed in as proper command line arguments
from the shell to spacecmd, they were probably merged into one line
without proper quoting.

Aron, how are things supposed to work there?

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to