You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Gavin Band <ga...@tiscali.co.uk> on 2006/04/01 16:16:33 UTC
Re: hot-backup.py
If the name contains double quotes, neither version seems to work.
I'm afraid I don't know a way around this - is there a simple way to
turn a filename into a fully-escaped version?
gav.
On Fri, 2006-03-31 at 10:37 -0800, Daniel Rall wrote:
> This seems like a reasonable thing to do, but what happens if the
> repository name also contains double-quotes?
>
> On Fri, 31 Mar 2006, Gavin Band wrote:
>
> > Dear list,
> > Sorry if this is the wrong place for this.
> > On my linux machine I had to modify line 97 of hot-backup.py from
> >
> > infile, outfile, errfile = os.popen3(svnlook + " youngest " + repo_dir)
> >
> > to
> >
> > infile, outfile, errfile = os.popen3(svnlook + " youngest \"" + repo_dir
> > + "\"")
> >
> > (should be one line) because the path to my repository contains whitespace.
> >
> > An example of the problem:
> >
> > $ cd \tmp
> > $ mkdir "A Directory"
> > $ svnadmin create "A Directory/repos"
> > $ hot-backup.py "A Directory/repos" /tmp
> > Keeping up to 64 around.
> > Beginning hot backup of 'A Directory/repos/'.
> > Traceback (most recent call last):
> > File "/usr/bin/svn-hot-backup", line 105, in ?
> > youngest = string.strip(stdout_lines[0])
> > IndexError: list index out of range
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: hot-backup.py
Posted by Gavin Band <ga...@tiscali.co.uk>.
Hi,
Looks like you're right - if I replace that line (line 97 of
hot-backup.py) with
infile, outfile, errfile = os.popen3([svnlook,"youngest",repo_dir])
then it seems to work with either whitespace or quotes.
gav.
On Sun, 2006-04-02 at 05:53 -0500, Peter Samuelson wrote:
> [Gavin Band]
> > If the name contains double quotes, neither version seems to work.
> > I'm afraid I don't know a way around this - is there a simple way to
> > turn a filename into a fully-escaped version?
>
> In perl you'd execute the command using a list instead of a string -
> that way no word splitting is done, either by perl or by a shell. I
> would assume python has a similar facility, to run fork+exec / spawn
> directly rather than through system() or popen() ... right?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: hot-backup.py
Posted by Peter Samuelson <pe...@p12n.org>.
[Gavin Band]
> If the name contains double quotes, neither version seems to work.
> I'm afraid I don't know a way around this - is there a simple way to
> turn a filename into a fully-escaped version?
In perl you'd execute the command using a list instead of a string -
that way no word splitting is done, either by perl or by a shell. I
would assume python has a similar facility, to run fork+exec / spawn
directly rather than through system() or popen() ... right?