Edgewall Software
Modify

Opened 12 years ago

Closed 4 years ago

Last modified 4 years ago

#6998 closed defect (fixed)

trac-admin initenv fails when passed single quote on command line

Reported by: justin.r.cutler@… Owned by: Jun Omae
Priority: low Milestone: 1.0.11
Component: admin/console Version: 0.10.4
Severity: minor Keywords:
Cc: Thijs Triemstra Branch:
Release Notes:

Fix parsing error when passing single quote to trac-admin command.

API Changes:

Description

When trac-admin is called with the non-interactive mode of initenv, an exception is raised if the environment name includes a single quote.

Example:

$ trac-admin trac/test initenv "Test's Project" sqlite:db/trac.db \
  svn svn/test/ /usr/share/trac/templates/

Returns:

Command failed: No closing quotation

Attachments (0)

Change History (24)

comment:1 by anonymous, 12 years ago

Owner: changed from Jonas Borgström to anonymous
Severity: majorblocker
Status: newassigned

comment:2 by anonymous, 12 years ago

Resolution: fixed
Status: assignedclosed

in reply to:  2 comment:3 by justin.r.cutler@…, 12 years ago

Milestone: 0.10.5
Resolution: fixed
Status: closedreopened

Replying to anonymous:

Where precisely is this fixed? I have tested this against the latest code in 0.10.5dev, and this bug still exists (as of r6692).

comment:4 by Christian Boos, 12 years ago

Component: generaladmin/console
Keywords: needcleanup added
Milestone: 0.12
Priority: normallow
Severity: blockertrivial

comment:1 and comment:2 were Ticket spam.

The bug exists, I've taken a look. Fixing it requires us to not enclose each argument within a pair of single quotes (change introduced in [133]), and I have yet to check for the implications of that change.

comment:5 by anonymous, 11 years ago

Resolution: fixed
Status: reopenedclosed

comment:6 by Emmanuel Blot, 11 years ago

Resolution: fixed
Status: closedreopened

comment:8 by anonymous, 11 years ago

Milestone: 0.120.11.1
Resolution: fixed
Status: reopenedclosed
Type: defectenhancement

comment:9 by ebray <hyugaricdeau@…>, 11 years ago

Milestone: 0.11.10.12
Resolution: fixed
Status: closedreopened
Type: enhancementdefect

comment:11 by anonymous, 11 years ago

Resolution: fixed
Status: reopenedclosed

comment:12 by anonymous, 11 years ago

Resolution: fixed
Status: closedreopened

comment:14 by Thijs Triemstra, 9 years ago

When testing this with 0.13 trunk I see:

$ trac-admin test2 initenv "Thijs's project" sqlite:db/trac.db svn
ValueError: No closing quotation

With the interactive wizard it works fine:

$ trac-admin test initenv
Creating a new Trac environment at /tmp/test

Trac will first ask a few questions about your environment 
in order to initialize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]> Thijs's project
 
 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment
 directory. It is also possible to use an already existing
 PostgreSQL database (check the Trac documentation for the exact
 connection string syntax).

Database connection string [sqlite:db/trac.db]> 

Creating and Initializing Project
 Installing default wiki pages
  
...

The latest documentation can also always be found on the project
website:

  http://trac.edgewall.org/

Congratulations!

comment:15 by Thijs Triemstra, 9 years ago

Cc: Thijs Triemstra added
Severity: trivialminor

in reply to:  14 ; comment:16 by Thijs Triemstra, 9 years ago

Replying to thijstriemstra:

When testing this with 0.13 trunk I see:

$ trac-admin test2 initenv "Thijs's project" sqlite:db/trac.db svn
ValueError: No closing quotation

But where is this ValueError being thrown..

in reply to:  16 comment:17 by psuter <petsuter@…>, 8 years ago

Replying to thijstriemstra:

But where is this ValueError being thrown..

Probably in shlex.split() (called by trac.admin.console.TracAdmin arg_tokenize()). I get the same in a Python shell:

>>> import shlex
>>> shlex.split('"')

Traceback (most recent call last):
...
ValueError: No closing quotation

Although shlex.split('initenv "Test\'s project" sqlite') seems to work here.

comment:18 by Ryan J Ollos, 4 years ago

Owner: anonymous removed

comment:19 by Ryan J Ollos, 4 years ago

#12246 closed as a duplicate.

comment:20 by Jun Omae, 4 years ago

Proposed fix is log:jomae.git@t6998, untested with Windows.

Last edited 4 years ago by Jun Omae (previous) (diff)

comment:21 by Jun Omae, 4 years ago

Milestone: next-major-releases1.0.10

That works fine on Windows 7 with Python 2.7 amd64.

C>..\venv\py27-amd64\Scripts\python.exe trac\admin\console.py C:\usr\var\trac\1.0 session add "blah'blah:1" "Blah's ''name''"

C>..\venv\py27-amd64\Scripts\python.exe trac\admin\console.py C:\usr\var\trac\1.0 session list

SID        Auth  Last Visit  Name             Email
---------------------------------------------------
blah'blah  1     2015-12-01  Blah's ''name''
jun66j5    1     2015-06-04

C>..\venv\py27-amd64\Scripts\python.exe trac\admin\console.py C:\usr\var\trac\1.0 session delete "blah'blah:1"

C>..\venv\py27-amd64\Scripts\python.exe trac\admin\console.py C:\usr\var\trac\1.0 session list

SID      Auth  Last Visit  Name  Email
--------------------------------------
jun66j5  1     2015-06-04

comment:22 by Ryan J Ollos, 4 years ago

Works well on OSX 10.11.1 with Python 2.7.10. It will be great to fix such a long-standing bug.

comment:23 by Ryan J Ollos, 4 years ago

Status: reopenednew

comment:24 by Ryan J Ollos, 4 years ago

Milestone: 1.0.101.0.11

comment:25 by Jun Omae, 4 years ago

Owner: set to Jun Omae
Release Notes: modified (diff)
Status: newassigned

Added unit tests in log:jomae.git@t6998. I'll push the changes tonight.

comment:26 by Jun Omae, 4 years ago

Keywords: trac-admin needcleanup removed
Resolution: fixed
Status: assignedclosed

Committed in [14646] and merged to trunk in [14647].

comment:27 by Jun Omae, 4 years ago

Follow-up to [14646], fixed missing return statement in [14685] and merged to trunk in [14686].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Jun Omae 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.