[Yum] error message during header download

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 12, 2004 at 09:06:24PM +0200, Roman Jordan wrote:
>   File "/usr/lib/python2.3/ftplib.py", line 345, in transfercmd
>     return self.ntransfercmd(cmd, rest)[0]
>   File "/usr/lib/python2.3/ftplib.py", line 328, in ntransfercmd
>     if resp[0] != '1':
> IndexError: string index out of range
> 
> What is going wrong? Is there someone who solved this problem?

I have seen this before, although I can't find the previous discussion
at the moment.  I'm sure it was on this list, though.  This is
happening DEEP inside ftplib.  I just looked again and found out
what's happening.  I'm including the details here so that you can
report this as a python bug if you like.

The exception is raised in ntransfercmd when the test "resp[0] |= 1"
raises an index error.  Now, the only way that can happen is if resp
is empty (otherwise it MUST have a first element).  Where does this
resp thing come from?  Well, it comes indirectly from the function
getline according to this path:

  ntransfercmd -> sendcmd -> getresp -> getmultiline -> getline

If the readline in getline returns an empty string, then you'll get
this error.  There are lots of checks along the way, but they all use
slice notation.  For example, this is from getresp:

        c = resp[:1]
        if c == '4':
            raise error_temp, resp
        if c == '5':
            raise error_perm, resp
        if c not in '123':
            raise error_proto, resp
        return resp

Now comes the catch:
  in python 2.2:     '' not in '123'    is illegal, raising TypeError
  in python 2.3:     '' not in '123'    is false

Basically, these checks should check for an empty resp, but they
don't.

					-Michael
-- 
  Michael D. Stenner                            mstenner@xxxxxxxxxxxxxxx
  ECE Department, the University of Arizona                 520-626-1619
  1230 E. Speedway Blvd., Tucson, AZ 85721-0104                 ECE 524G

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux