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

Re: flaw in python bindings diff?

From: <Chris.Foote_at_v21.me.uk>
Date: 2003-01-27 22:49:33 CET

There is one major problem with popen2.popen2() that I have found.
It takes different arguments on windows than what it does on unix.

The windows version expects a string, so I have applied the following patch
to get this working for ViewCVS on windows.

Index: subversion/bindings/swig/python/svn/fs.py
===================================================================
--- subversion/bindings/swig/python/svn/fs.py (revision 4614)
+++ subversion/bindings/swig/python/svn/fs.py (working copy)
@@ -19,6 +19,7 @@
 ### hide these names?
 import tempfile
 import os
+import sys
 import popen2

 import _fs
@@ -110,7 +111,10 @@

     # open the pipe, forget the end for writing to the child (we won't),
     # and then return the file object for reading from the child.
- fromchild, tochild = popen2.popen2(cmd)
+ if sys.platform[:3] == 'win':
+ fromchild, tochild = popen2.popen2(string.join(cmd))
+ else:
+ fromchild, tochild = popen2.popen2(cmd)
     tochild.close()
     return fromchild

Regards,
Chris

----- Original Message -----
From: cmpilato@collab.net
To: Greg Stein gstein@collab.net
Cc: Michael Kefeder mike@weird-birds.org; Subversion Developers
dev@subversion.tigris.org
Sent: Monday, January 27, 2003 7:00 PM
Subject: Re: flaw in python bindings diff?

 Greg Stein gstein@collab.net writes:

   Ah...looks like Greg Stein busted this when he converted to popen2 in
   revision 4343 (strangely enough because he claimed it fixed diffs on
   files with spaces in them). Greg, can you help out a bit here?
 
  Switching to popen2 meant that I passed a filename as a separate
  argument, which fixes the spaces. I forgot that a filename might be
  part of those diffoptions.
 
  Yes, passing a list as the diffoptions is the best behavior.
 
  The reason to use popen2.popen2() is for security. The shell never
  sees the command string; we just directly exec() the new process with
  the right arguments. In the standard popen(), that goes to the shell
  which can then parse for redirections and whatnot -- major security
  nightmare.

 All good. Your reasons for the change were fine, and understood, and
 the fix for spaces has already been made. Yay!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:21:05 2006

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