Edgewall Software

Ticket #900 (closed defect: worksforme)

Opened 4 years ago

Last modified 2 years ago

tracd login, internal error

Reported by: sky-g Owned by: jonas
Priority: normal Milestone:
Component: web frontend/tracd Version: 0.7.1
Severity: normal Keywords:
Cc:

Description

Traceback

Oops...
Trac detected an internal error:

'int' object has no attribute 'lower'
Traceback (most recent call last):
  File "/usr/bin/tracd", line 233, in do_trac_req
    self.do_real_trac_req()
  File "/usr/bin/tracd", line 243, in do_real_trac_req
    self.remote_user = self.env.auth.do_auth(self)
  File "/usr/bin/tracd", line 99, in do_auth
    if not 'Authorization' in req.headers or \
  File "/usr/lib/python2.2/rfc822.py", line 390, in __getitem__
    return self.dict[name.lower()]
AttributeError: 'int' object has no attribute 'lower'

Related info

tracd is started with:

 #! /bin/sh
db_name=trac  
repos=/var/www/trac
port=9000
tracd=/usr/bin/tracd
pythonpath=/usr/local/lib/svn-python:/usr/lib/python2.2/site-packages 
libpath=/usr/local/lib
htd_passwords=/var/www/trac/htdigest
#-----------------------------------------------------------

LD_LIBRARY_PATH=$libpath \
PYTHONPATH=$pythonpath \
     $tracd --port $port --auth $db_name,$htd_passwords,trac $repos &

"repos" is not the subversion repository of course, but the trac environment.

Notes / ideas:

  • Tried to make db_name and last directory in "repos" the same, as prescribed by various pages. (Is this understood correctly?)
  • The project name given when doing initenv, which appears in headers of HTML pages - does that matter? (tried redoing it with same name, does not seem to matter...)
  • Just noticed, the "realm" is not a complete or correct hostname if that matters, just "trac"

/var/www/trac/htdigest contains only one line:

gan:trac:44ab342...<the hashed password>...

with these permissions (nothing odd I guess, probably shouldn't be world readable though...)

-rwxr-xr-x 1 root root 42 Nov  9 18:52 /var/www/trac/htdigest

Attachments

ticket_900_ugly_patch.patch (0.8 KB) - added by sky-g 4 years ago.
rough patch (workaround)

Change History

Changed 4 years ago by sky-g

To clarify, the error trace appears anytime I try clicking "Login"

Changed 4 years ago by sky-g

Looks like a strange python bug. Hope you gurus will figure it out.

rfc822.py contains

   # Access as a dictionary (only finds *last* header of each type):
   def __getitem__(self, name):
       """Get a specific header, as from a dictionary."""
       return self.dict[name.lower()]

If I understand the error, then 'Authorization' gets turned into an int when entering the local __getitem__ ???

Anyway I wrote a workaround avoiding the __getitem__ implementation in headers by accessing the internal dictionary directly, (not very nice) using a lower-cased key.

i.e.:

if not 'Authorization' in req.headers

changed to

if not 'authorization' in req.headers.dict

and so on.

Works for me! (Yay!) It seems a bit fragile to access the member "dict" directly however so I leave it up to you to use the ugly patch, or figure out the problem.

I did not affect the other places where other dictionary-like accesses are made. Please investigate them too. For example:

        if self.headers.has_key('Cookie'):
            self.incookie.load(self.headers['Cookie'])

    def get_header(self, name):
        return self.headers.get(name)

By the way I'm using python 2.2 ! Could be a bug only in that version perhaps...

Changed 4 years ago by sky-g

rough patch (workaround)

Changed 4 years ago by cmlenz

  • milestone 0.7.1 deleted

Changed 2 years ago by mgood

  • status changed from new to closed
  • resolution set to worksforme

Wow, 0.7.1 is old. I think this was probably fixed long ago in the changes that have happened since then.

Add/Change #900 (tracd login, internal error)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.