Bug 16493

Summary: Bogus anaconda /etc/fstab LOOP parsing
Product: [Retired] Red Hat Raw Hide Reporter: Need Real Name <pj>
Component: anacondaAssignee: Michael Fulbright <msf>
Status: CLOSED RAWHIDE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-08-21 16:15:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2000-08-18 03:57:30 UTC
The line of code in instimage/usr/lib/anaconda-7.0/fstab.py
that tries to parse the "# LOOP1: /dev/%s %s /redhat.img\n"
lines appears bogus:

    if fields[0] == "#" and len(fields)>4 and fields[2:6] == "LOOP":

Shouldn't that be:

    if fields[0] == "#" and len(fields)>4 and fields[1][2:6] == "LOOP":

(as an aside - I'm curious as to what this LOOP stuff is).

Comment 1 Need Real Name 2000-08-18 04:05:19 UTC
Oops - still not right - not only was field number unchosen, but the
char offset within the field off - try:

    if fields[0] == "#" and len(fields)>4 and fields[1][0:4] == "LOOP":


Comment 2 Michael Fulbright 2000-08-18 15:05:03 UTC
fields is just a string, it is not an array of parsed whiteseparated fields.

The loop statement is referring to the loopback file install we support where
you can install Linux to a
large file within a FAT fs.


Comment 3 Need Real Name 2000-08-18 19:16:18 UTC
Thanks for explaining what the LOOP stuff was in /etc/fstab, and for
the quick response.

However, I am surprised that you state:
  "fields is just a string, it is not an array of parsed whiteseparated fields."

I see the following code in fstab.py:
	fields = string.split (line)
	...
	if fields[0] == "#" and len(fields)>4 and fields[2:6] == "LOOP":
	...
	if (fields[0][0:7] != "/dev/hd" and 

Looks to me like:
    1) fields is being set to an list of strings, and
    2) it is even being accessed as such, twice on the very
       line in question, in the terms:
	fields[0] == "#" and len(fields)>4
    3) it continues to be accessed as such every where else
	it is accessed in this routine.

Perhaps you meant "line", not "fields", as in:
    if fields[0] == "#" and len(fields)>4 and line[2:6] == "LOOP":
                                              ^^^^


Comment 4 Michael Fulbright 2000-08-21 16:15:18 UTC
My apologies, I read over the code too quickly and you are correct.  I have
verified we have your suggested fix applied against our current codebase.

Thanks!