Edgewall Software
Modify

Opened 10 years ago

Closed 10 years ago

#12044 closed defect (fixed)

htdigest appends newlines

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.5
Component: contrib Version:
Severity: normal Keywords: htdigest
Cc: Branch:
Release Notes:

Fixed htdigest appending newlines to every existing entry each time a new entry was added.

API Changes:
Internal Changes:

Description

$./contrib/htdigest.py -cb htdigest trac user1 user1
$cat htdigest 
user1:trac:f21b2f8c5abd6baaeb3ffc28dce30e7c
$./contrib/htdigest.py -b htdigest trac user2 user2
$cat htdigest 
user1:trac:f21b2f8c5abd6baaeb3ffc28dce30e7c

user2:trac:97a40f5b8d13962839f664534aa573ef
$./contrib/htdigest.py -b htdigest trac user3 user3
$cat htdigest 
user1:trac:f21b2f8c5abd6baaeb3ffc28dce30e7c



user2:trac:97a40f5b8d13962839f664534aa573ef

user3:trac:2becdbd941526ac9d618dd22a6b56241
$./contrib/htdigest.py -b htdigest trac user4 user4
$cat htdigest 
user1:trac:f21b2f8c5abd6baaeb3ffc28dce30e7c







user2:trac:97a40f5b8d13962839f664534aa573ef



user3:trac:2becdbd941526ac9d618dd22a6b56241

user4:trac:817bb1e53812c8111abc197aac2d4aca

Attachments (0)

Change History (5)

comment:1 by Ryan J Ollos, 10 years ago

Proposed changes in log:rjollos.git:t12044.

comment:2 by Ryan J Ollos, 10 years ago

Proposed changes were incorrect, due to incorrect cherry-pick I suppose. Proposed change is to just strip off the newline before writing with a newline. On trunk the change is:

diff --git a/contrib/htdigest.py b/contrib/htdigest.py
index b992c99..f82d49d 100755
--- a/contrib/htdigest.py
+++ b/contrib/htdigest.py
@@ -86,7 +86,7 @@ else:
                     print(get_digest(prefix, password))
                 matched = True
             else:
-                print(line)
+                print(line.rstrip())
         if not matched:
             with open(filename, 'a') as f:
                 print(get_digest(prefix, password), file=f)

comment:3 by Ryan J Ollos, 10 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:4 by Jun Omae, 10 years ago

Yeah, the changes in comment:2 look good to me.

comment:5 by Ryan J Ollos, 10 years ago

Milestone: 0.12.71.1.5
Resolution: fixed
Status: assignedclosed

On further investigation, this is a regression introduced in [12788]. The trailing , on the print statement prevented appending a newline (SO:18908905/121694).

Fixed on trunk in [14026].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.