Edgewall Software

Ticket #6370 (new defect)

Opened 12 months ago

Last modified 12 months ago

Contrib post-commit for Win has issues with quotes in project name, failing

Reported by: awbacker@… Owned by: cboos
Priority: low Milestone: 0.11-retriage
Component: version control Version: devel
Severity: minor Keywords: trac-post-commit-hook
Cc:

Description

The .cmd file used by the post-commit process for windows quotes both the revision number and trac environment. The revision # does not need to be quoted, but it is the quoting of the trac environment that causes a problem.

To see this you need to move the -r option before the -p. In the original order (script -p .. -r ...) the script complains about # of arguments. If you put the -r before the -P, you can see the issue described below:

The python script that is called from trac-post-commit-hook.cmd (trac-post-commit-hook) receives the argument complete with quotes, which it then tries to interpret as part of the project path. This leads to a command like:

trac-post-commit-hook -P "c:\trac-sites\funky" -r "107"

generating an error about not being able to find/read/etc the file

"IOError: [Errno 2] No such file or directory: 'e:\\trac-sites\\funky" \\VERSION'

I don't know where the first quote went, though. The fix to this, allowing for quotes in the trac site name, is to remove the quotes from the project name inside the post commit python script. Alternatly, if that is not possible, one could remove them from the ".cmd" file and require that the trac env path have no spaces.

I have also included a few comments in the post-commit hook, primarly to clarify for us new to this. The construct %~dp0 is unfamiliar to most, even those familar with dos batch files, but it is very useful.

Attachments

fix-postcommit-quotes-in-tracenv-on-windows.patch (1.8 KB) - added by awbacker@… 12 months ago.
Patch for post commit contrib files. Not sure about cr/lf issues with the py one

Change History

Changed 12 months ago by awbacker@…

Patch for post commit contrib files. Not sure about cr/lf issues with the py one

Changed 12 months ago by awbacker@…

Actually, it would be nice to have a note in there that TRAC_ENV needs to not have the trailing slash. If you say -p c:\trac-sites\Krocsyldiphithic\ then a similar error will occur, and it will append a space to the name, leaving the path as:

c:\\trac-sites\\Krocsyldiphithic \\VERSION

Changed 12 months ago by cboos

  • keywords trac-post-commit-hook added
  • version set to devel
  • milestone set to 0.11.1

Add/Change #6370 (Contrib post-commit for Win has issues with quotes in project name, failing)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cboos. Next status will be 'new'
The owner will change from cboos to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.