Opened 11 years ago

Closed 10 years ago

#180 closed defect (fixed)

Reported by: Owned by: jjgalvez@… mgood normal AccountManagerPlugin normal 0.9

Description

using this plugin to change a password creates double entries in the password file for the user. I looked through your code and I'm not sure why that is. I am currently using trac .9.3 with apache 2.0.55 and python 2.4.2 on windows XP

comment:1 Changed 11 years ago by fox@…

Just wanted to say that I'm running trac 0.9.3, apache, and python 2.4.2 on a linux box (FC4), and it's doing the same thing to me. So, it's not isolated. It always updates both lines w/the new hash, and it doesn't seem to ever create more than two copies of a line. So, it's not that big of a deal, but it is odd.

comment:2 Changed 11 years ago by truijllo@…

• Resolution set to fixed
• Status changed from new to closed

Hi! the problem in in htfile.py, a wrong indent followed by a wrong conditional statement. this is the patch:

def _update_file(self, prefix, userline):

filename = self._get_filename() written = False if os.path.exists(filename):

for line in fileinput.input(filename, inplace=True):

if line.startswith(prefix):

if not written and userline:

print userline written = True

else:

print line,

if userline and not written:

f = open(filename, 'a') try:

print >>f, userline

finally:

f.close()

return written

comment:3 Changed 11 years ago by truijllo@…

Arg! sorry...

right code for changes is :

....
....
....

if not written and userline:

print userline
written = True

....
....

if userline and not written:

f = open(filename, 'a')

.... ....

comment:4 Changed 11 years ago by mgood

• Resolution fixed deleted
• Status changed from closed to reopened

Don't close the ticket until your patch has been committed or it will be lost.

comment:5 Changed 11 years ago by trac.ia_mask@…

Has this been confirmed and tested/committed? It's been like 9 days since the post (sorry if I'm expecting too much :-) )

comment:6 Changed 11 years ago by truijllo@…

I don't know, the only thing that I can say is that I use this patch in my trac site ( and it works well :) ). please contact me if I should do a particular way to make my patches accepted.

comment:7 Changed 10 years ago by maxb

• Trac Release set to 0.8

Actually, I don't believe the indent is wrong.

I think the proper fix is actually just a one line change:

-        if userline:
+        if not written and userline:


comment:8 Changed 10 years ago by maxb

I didn't intend to set 'release' to '0.8'.

It seems someone has reconfigured this Trac so that it gets set on any ticket which does not have a 'release' value set, when someone next makes a comment.

comment:9 Changed 10 years ago by jml

• Trac Release changed from 0.8 to 0.9

OK. I've confirmed this bug and came up with the same fix as maxb.

Apparently there is a patch on #264, but it's tied up with another issue. I figure attaching a patch here will be quicker.

comment:10 Changed 10 years ago by jml

OK. Trac barfed when I tried to upload the patch. Anyway, it's exactly what maxb had.

comment:11 Changed 10 years ago by mgood

• Resolution set to fixed
• Status changed from reopened to closed

(In [1046]) stop writing duplicate entries in password file when updating password (fixes #180)

comment:12 Changed 10 years ago by mgood

Thanks for debugging this. Sorry for the long delay in getting these changes committed. I've added some docs on that method now too, since I couldn't quite remember exactly what its behavior was supposed to be ;)