Bug 673160

Summary: Anaconda fails to activate the device when ksdevice=pciM#N is passed
Product: [Fedora] Fedora Reporter: Narendra K <narendra_k>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: anaconda-maint-list, jlaska, jonathan, linux-bugs, matt_domsch, paniraja_km, rvykydal, shyam_iyer, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-01 17:59:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Screenshot.png
none
ks.cfg none

Description Narendra K 2011-01-27 15:30:10 UTC
Description of problem:

When ksdevice=pci3#1 is passed, user is manually prompted to activate the network. But when ksdevice=em1 is passed, network activation succeeds.


Version-Release number of selected component (if applicable): 
Anaconda-15.18-1.fc15


How reproducible: Easy


Steps to Reproduce:
1. Boot into the Boot.iso from http://jlaska.fedorapeople.org/test-day/x86_64
2. Hit Tab and pass ksdevice=pci2#1 

  
Actual results: Manually prompted to activate the network.


Expected results:Anaconda should activate pci2#1


Additional info: Will upload /tmp/*.log shortly.

Comment 1 Chris Lumens 2011-01-27 16:53:46 UTC
This is because your device name contains a "#", which is a shell metacharacter, therefore lots of programs are going to have a hard time processing this information.  In the loader, we use g_shell_parse_argv to process the argument list and it treats "#" like it's a comment starter.  I bet shlex.split that pykickstart uses will have similar problems.

Comment 2 James Laska 2011-01-27 17:01:25 UTC
(In reply to comment #1)
> I bet
> shlex.split that pykickstart uses will have similar problems.

I think it'll be okay here.  The shell doesn't consider a '#' character as the start of a comment, I *think* it considers ' #' the start of a comment.

>>> shlex.split("pci2#4")
['pci2#4']
>>> shlex.split("pci2#4 #1")
['pci2#4', '#1']

Comment 3 Radek Vykydal 2011-01-27 17:12:31 UTC
(In reply to comment #1)
> This is because your device name contains a "#", which is a shell
> metacharacter, therefore lots of programs are going to have a hard time
> processing this information.  In the loader, we use g_shell_parse_argv to
> process the argument list and it treats "#" like it's a comment starter.  I bet
> shlex.split that pykickstart uses will have similar problems.

I had the same suspicion in my tests, but in my case it showed up that the problem was pre-anaconda processing - pxe configuration file. When I escaped the character, anaconda (loader) had no problems using pciX#Y name IIRC.

Comment 4 Matt Domsch 2011-01-27 17:40:03 UTC
#!/bin/bash
foo=abc#de
echo $foo

yields: abc#de

# is a comment character, yes, but just because a # appears in a word does not mean that the rest of the line is ignored.  There are lots of other uses of # within bash to mean other things than comments.

Comment 5 David Cantrell 2011-01-27 17:49:12 UTC
It's not just bash.  anaconda and pykickstart depend on the Python shutil module as well as glib's g_shell_parse_argv() function, so we are limited by their specifications as well.

Comment 6 Chris Lumens 2011-01-27 18:06:55 UTC
> It's not just bash.  anaconda and pykickstart depend on the Python shutil
> module as well as glib's g_shell_parse_argv() function, so we are limited by
> their specifications as well.

We appear to be okay from a shlex perspective:

(Pdb) shlex.split("network --device=pci1#2")
['network', '--device=pci1#2']

More worrying, though, is this in pykickstart:

                # Remove any end-of-line comments.
                ind = self._line.find("#")
                if (ind > -1):
                    h = self._line[:ind]
                else:
                    h = self._line

And sure enough if I feed "network --device=pci1#2" through ksvalidator and print the results:

(Pdb) print handler.network
# Network information
network  --bootproto=dhcp --device=pci1 --onboot=on

Comment 7 Radek Vykydal 2011-01-27 18:09:52 UTC
(In reply to comment #3)

> I had the same suspicion in my tests, but in my case it showed up that the
> problem was pre-anaconda processing - pxe configuration file. When I escaped
> the character, anaconda (loader) had no problems using pciX#Y name IIRC.

Yeah, scratch that, I was obviously wrong at that time.

Comment 8 James Laska 2011-01-27 18:15:03 UTC
(In reply to comment #6)

> More worrying, though, is this in pykickstart:
> 
>                 # Remove any end-of-line comments.
>                 ind = self._line.find("#")

I think that find might not be accurate though (see comment#2).  Should it instead be  self._line.find(" #")?  

From the bash man page:
       In  a  non-interactive  shell,  or an interactive shell in which the interactive_comments
       option to the shopt builtin is enabled (see SHELL BUILTIN COMMANDS below), a word  begin‐
       ning with # causes that word and all remaining characters on that line to be ignored.  An
       interactive shell without the interactive_comments option enabled  does  not  allow  com‐
       ments.  The interactive_comments option is on by default in interactive shells.

Does this mean it needs to be a regexp and look for a word boundary?

Comment 9 Chris Lumens 2011-01-27 18:22:00 UTC
I don't think kickstart has ever promised what level of shell-like syntax it understands, so this is entirely up to our interpretation of what's valid and what's not.  The current behavior has been in since March 2008, which means RHEL6 as well as many Fedora releases.  And you know this is going to end up as a RHEL6 bug just as soon as someone gets around to it.

Comment 10 James Laska 2011-01-27 20:06:36 UTC
Created attachment 475675 [details]
Screenshot.png

Comment 11 James Laska 2011-01-27 20:07:39 UTC
Created attachment 475676 [details]
ks.cfg

Attaching kickstart file used