Edgewall Software

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12246 closed defect (duplicate)

trac-admin can't handle SIDs with single quotes

Reported by: glinders Owned by:
Priority: normal Milestone:
Component: admin/console Version: 1.0
Severity: normal Keywords: trac-admin session
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


I have a trac user with username do'neill.

When I try to add a name and email address using:

trac-admin . session name "do'neill:1" "Daniel O'Neill"

I get error:

ValueError: No closing quotation

I've tried escaping the single quote in several different ways to no avail.

The same error is returned for:

trac-admin . session list "do'neill"

If I list all SIDs, the name shows up properly:

trac-admin . session list 

SID                       Auth  Last Visit  Name                       Email                          
06064eb12e5a92df99d1a427  0     2015-11-10                                                            
604e0bf582a3fde77ceb35f9  0     2015-07-29                                                            
bwilliams                 1     2013-05-20  Ben Williams               bwilliams@xxx.com  
do'neill                  1     2015-08-28                                                            
rglassey                  1     2015-08-28  Robert Glassey             rglassey@xxx.com   

I can't change the username because they are passed from LDAP.

I've attached my Trac about page

Attachments (1)

tracabout.pdf (139.7 KB ) - added by Geert Linders <geert.linders@…> 5 years ago.

Download all attachments as: .zip

Change History (5)

by Geert Linders <geert.linders@…>, 5 years ago

Attachment: tracabout.pdf added

comment:1 by Ryan J Ollos, 5 years ago

Milestone: 1.0.10

Thanks for reporting. Confirmed.

16:48:42 Trac[console] ERROR: Exception in trac-admin command: 
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/admin/console.py", line 111, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 220, in onecmd
    return self.default(line)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/admin/console.py", line 282, in default
    args = self.arg_tokenize(line)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/admin/console.py", line 198, in arg_tokenize
    return [unicode(token, 'utf-8') for token in lex] or ['']
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 269, in next
    token = self.get_token()
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 96, in get_token
    raw = self.read_token()
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 172, in read_token
    raise ValueError, "No closing quotation"
ValueError: No closing quotation

in reply to:  description comment:2 by Ryan J Ollos, 5 years ago

Replying to glinders:

When I try to add a name and email address using:

trac-admin . session name "do'neill:1" "Daniel O'Neill"

Btw, the command is missing a set:

trac-admin . session set name "do'neill:1" "Daniel O'Neill"

However, that doesn't affect the bug that's reported.

comment:3 by Ryan J Ollos, 5 years ago

Milestone: 1.0.10
Resolution: duplicate
Status: newclosed

Duplicate of #6998. With the length of time that ticket has been open I suspect the fix is not easy.

comment:4 by Jun Omae, 5 years ago

Workaround is executing such commands via trac-admin shell rather than passing parameters to trac-admin command.

Trac [/var/trac/1.0-sqlite]> session add "do'neill:1" "Daniel O'Neill"
Trac [/var/trac/1.0-sqlite]> session list

SID       Auth  Last Visit  Name            Email
do'neill  1     2015-12-01  Daniel O'Neill

Modify Ticket

Change Properties
Set your email in Preferences
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.