#6998 closed defect (fixed)
trac-admin initenv fails when passed single quote on command line
| Reported by: | 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: | |||
| Internal 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 , 18 years ago
| Owner: | changed from to | 
|---|---|
| Severity: | major → blocker | 
| Status: | new → assigned | 
follow-up: 3 comment:2 by , 18 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | assigned → closed | 
comment:3 by , 18 years ago
| Milestone: | 0.10.5 | 
|---|---|
| Resolution: | fixed | 
| Status: | closed → reopened | 
comment:4 by , 18 years ago
| Component: | general → admin/console | 
|---|---|
| Keywords: | needcleanup added | 
| Milestone: | → 0.12 | 
| Priority: | normal → low | 
| Severity: | blocker → trivial | 
comment:5 by , 18 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | reopened → closed | 
comment:6 by , 18 years ago
| Resolution: | fixed | 
|---|---|
| Status: | closed → reopened | 
comment:8 by , 17 years ago
| Milestone: | 0.12 → 0.11.1 | 
|---|---|
| Resolution: | → fixed | 
| Status: | reopened → closed | 
| Type: | defect → enhancement | 
comment:9 by , 17 years ago
| Milestone: | 0.11.1 → 0.12 | 
|---|---|
| Resolution: | fixed | 
| Status: | closed → reopened | 
| Type: | enhancement → defect | 
comment:11 by , 17 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | reopened → closed | 
comment:12 by , 17 years ago
| Resolution: | fixed | 
|---|---|
| Status: | closed → reopened | 
follow-up: 16 comment:14 by , 15 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 , 15 years ago
| Cc: | added | 
|---|---|
| Severity: | trivial → minor | 
follow-up: 17 comment:16 by , 15 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..
comment:17 by , 14 years ago
Replying to thijstriemstra:
But where is this
ValueErrorbeing 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 , 10 years ago
| Owner: | removed | 
|---|
comment:21 by , 10 years ago
| Milestone: | next-major-releases → 1.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 , 10 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 , 10 years ago
| Status: | reopened → new | 
|---|
comment:24 by , 10 years ago
| Milestone: | 1.0.10 → 1.0.11 | 
|---|
comment:25 by , 10 years ago
| Owner: | set to | 
|---|---|
| Release Notes: | modified (diff) | 
| Status: | new → assigned | 
Added unit tests in log:jomae.git@t6998. I'll push the changes tonight.
comment:26 by , 10 years ago
| Keywords: | trac-admin needcleanup removed | 
|---|---|
| Resolution: | → fixed | 
| Status: | assigned → closed | 



  
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).