[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

bugs in hook scripts on Windows

From: <Edwin_Park_at_mckinsey.com>
Date: 2005-07-30 14:21:36 CEST

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.
+=========================================================+
Received on Sat Jul 30 15:14:07 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.