You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ed...@mckinsey.com on 2005/07/30 12:21:36 UTC

bugs in hook scripts on Windows

Hi,

I discovered a few bugs in Subversion's handling of hook scripts on 
Windows:

* The REPOS parameter that is passed in to the batch script uses a 
Unix-style forward slash '/' delimiter between the repository base dir and 
the repository instead of the DOS-style backslash '\'. For example, I have 
a repository named 'Nexus' under the 'E:\products\CommonServices' 
directory. The REPOS parameter passed into my batch script is: 
E:\products\CommonServices/Nexus. This has forced me to resort to 
hardcoding the repository location in my hook scripts because I cannot use 
the mangled path that is passed in.

* The svnperms.py script in SUBVERSION_HOME/tools/hook-scripts uses the 
'commands' module, which is unix-specific. I realize that these scripts 
are not distributed with the Windows build of Subversion, but I wanted to 
use them on Windows so I copied them over. There is actually only one line 
in the script that uses the 'commands' module: it is in the _execcmd 
function in the SVNLook class. I changed that function to use the 
cross-platform os.popen4 function instead. I'm not a python expert, but 
the following changes worked for me:

    def _execcmd(self, *cmd, **kwargs):
        cmdstr = " ".join(cmd)
        ### BEGIN CHANGES ###
        cmd_stdin, cmd_stdouterr = os.popen4(cmdstr)
        output = cmd_stdouterr.read()
        cmd_stdin.close()
        status = cmd_stdouterr.close()
        if status == None:
            status = 0
        ### END CHANGES ###
        if status != 0:
            sys.stderr.write(cmdstr)
            sys.stderr.write("\n")
            sys.stderr.write(output)
            raise Error, "command failed: %s\n%s" % (cmdstr, output)
        return status, output

Cheers,
Edwin

+=========================================================+
This message may contain confidential and/or privileged
information.  If you are not the addressee or authorized to
receive this for the addressee, you must not use, copy,
disclose or take any action based on this message or any
information herein.  If you have received this message in
error, please advise the sender immediately by reply e-mail
and delete this message.  Thank you for your cooperation.
+=========================================================+

Re: bugs in hook scripts on Windows

Posted by Branko Čibej <br...@xbc.nu>.
Ben Collins-Sussman wrote:

>
> On Jul 30, 2005, at 7:21 AM, Edwin_Park@mckinsey.com wrote:
>
>>
>> Hi,
>>
>> I discovered a few bugs in Subversion's handling of hook scripts on  
>> Windows:
>>
>> * The REPOS parameter that is passed in to the batch script uses a  
>> Unix-style forward slash '/' delimiter between the repository base  
>> dir and the repository instead of the DOS-style backslash '\'. For  
>> example, I have a repository named 'Nexus' under the 'E:\products 
>> \CommonServices' directory. The REPOS parameter passed into my  batch 
>> script is: E:\products\CommonServices/Nexus. This has forced  me to 
>> resort to hardcoding the repository location in my hook  scripts 
>> because I cannot use the mangled path that is passed in.
>
>
> You said this is svn 1.2.0 on win2k.  Which server are you using,  
> apache or svnserve?
>
> Developers:  is this indeed a bug?

Yes, I'd say this is a bug. We should always use the system's path 
separator whenever we "display" paths to external tools ("svn diff" is 
an exception because patch expects forward slashes everywhere). Hook 
scripts are definitely external tools.

-- Brane


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: bugs in hook scripts on Windows

Posted by Ben Collins-Sussman <su...@collab.net>.
On Jul 30, 2005, at 7:21 AM, Edwin_Park@mckinsey.com wrote:

>
> Hi,
>
> I discovered a few bugs in Subversion's handling of hook scripts on  
> Windows:
>
> * The REPOS parameter that is passed in to the batch script uses a  
> Unix-style forward slash '/' delimiter between the repository base  
> dir and the repository instead of the DOS-style backslash '\'. For  
> example, I have a repository named 'Nexus' under the 'E:\products 
> \CommonServices' directory. The REPOS parameter passed into my  
> batch script is: E:\products\CommonServices/Nexus. This has forced  
> me to resort to hardcoding the repository location in my hook  
> scripts because I cannot use the mangled path that is passed in.

You said this is svn 1.2.0 on win2k.  Which server are you using,  
apache or svnserve?

Developers:  is this indeed a bug?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org