You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Brian W. Fitzpatrick" <fi...@red-bean.com> on 2004/02/18 21:46:07 UTC

svn cleanup switches?

Why does svn cleanup take any switches at *all*? I'd say this is a bug.  Anyone?

$svn help cleanup
cleanup: Recursively clean up the working copy, removing locks, resuming
unfinished operations, etc.
usage: cleanup [PATH...]

Valid options:
  --diff3-cmd arg          : use ARG as merge command
  --config-dir arg         : read user configuration files from directory ARG



-Fitz


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

Re: svn cleanup switches?

Posted by Julian Foad <ju...@btopenworld.com>.
Mark Benedetto King wrote:
> On Thu, Feb 19, 2004 at 12:08:00PM +0000, Julian Foad wrote:
> 
>>I think we need to build in a bit more "intelligence".  For instance, maybe 
>>the log file could record the merge command that it was going to use.
> 
> That would make it a bad idea to type "svn cleanup" in an untrusted WC.

I don't know how serious that risk is, but there are variations that reduce it.  For example, "svn cleanup" could just check that the name of the merge command that it is about to use matches the name of the merge command that the log file recorded, and warn the user if not.  I'm not saying that's an elegant solution, just one of many possibilities.

Or perhaps we could revise the "clean up" strategy so that it does not involve merging.  Instead of re-trying the merge, it could just put the relevant files into the "conflicted" state, as if the merge had been attempted but had failed.  This might be less friendly (depending on what the user was going to do next), but it might be better overall if it is safer and simpler.

- Julian


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

Re: svn cleanup switches?

Posted by Greg Hudson <gh...@MIT.EDU>.
On Thu, 2004-02-19 at 12:04, Philip Martin wrote:
> What's an "untrusted" WC?  It's next to impossible to have two
> different users with write access to the same WC, the chmod calls
> don't work.

I wouldn't assume this will always be the case.  If nothing else, we
could work around the chmod problem by rewriting the offending files.


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

Re: svn cleanup switches?

Posted by Mark Benedetto King <mb...@lowlatency.com>.
On Thu, Feb 19, 2004 at 05:04:04PM +0000, Philip Martin wrote:
> Mark Benedetto King <mb...@lowlatency.com> writes:
> 
> > That would make it a bad idea to type "svn cleanup" in an untrusted WC.
> 
> What's an "untrusted" WC?  It's next to impossible to have two
> different users with write access to the same WC, the chmod calls
> don't work.
> 

My guess is that a pathological WC could be constructed that would cause
the client to execute an arbitrary command.  Perhaps if the owner of the WC
maliciously chmodded everything 2777?  Or if the victim user was root?

--ben


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

Re: svn cleanup switches?

Posted by Philip Martin <ph...@codematters.co.uk>.
Mark Benedetto King <mb...@lowlatency.com> writes:

> That would make it a bad idea to type "svn cleanup" in an untrusted WC.

What's an "untrusted" WC?  It's next to impossible to have two
different users with write access to the same WC, the chmod calls
don't work.

-- 
Philip Martin

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

Re: svn cleanup switches?

Posted by Mark Benedetto King <mb...@lowlatency.com>.
On Thu, Feb 19, 2004 at 12:08:00PM +0000, Julian Foad wrote:
> 
> I think we need to build in a bit more "intelligence".  For instance, maybe 
> the log file could record the merge command that it was going to use.
> 

That would make it a bad idea to type "svn cleanup" in an untrusted WC.

--ben


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

Re: svn cleanup switches?

Posted by Philip Martin <ph...@codematters.co.uk>.
Julian Foad <ju...@btopenworld.com> writes:

> Yes, but... yuck!  That's all very well for a developer of Subversion,
> but very much relies on the user knowing how it works.  Say my friend
> has just run the "project-check-in" script that his administrator
> provided, and it failed with some error about a locked working copy.
> My friend has heard of this "svn cleanup" which can recover from such
> situations.  So he runs "svn cleanup", and things get worse (a merge
> is done wrongly).  The administrator explains to him, "Oh, no - you
> shouldn't have run that command without figuring out what the active
> config dir and merge command were when the failing Subversion command
> was executed."
>
> I think we need to build in a bit more "intelligence".  For instance,
> maybe the log file could record the merge command that it was going to
> use.

As I see it there are two reasons to use these flags on cleanup.

1.  When "svn up" fails due to a problem running diff.  This could be
    because the internal diff has a bug, or runs out of memory, or the
    external diff program doesn't work.

    $ svn up wc
    error about unable to run diff
    $ svn st wc
    L   wc
    $ svn cleanup wc
    error about unable to run diff
    $ svn cleanup --diff3-cmd /usr/bin/diff3 wc
    $

2.  When "svn up" is already using the flags, but the update gets
    interrupted for some reason, user input, network failure, etc.

    $ svn up --diff3-cmd /my/special/merge wc
    ^C
    $ svn st wc
    L   wc
    $ svn cleanup --diff3-cmd /usr/bin/diff3 wc
    $

In the first case we *need* a way to overide the diff command that
would otherwise be run.  I don't think this will happen very often,
but it seems sensible to support it.  I accept that the user may not
think to do it, but I see no way to automate it, using a cached value
won't work.

In the second case it doesn't seem unreasonable to expect the user to
pass the relevant option to cleanup given that they passed it to
update.  Passing diff-cmd/config-dir to update is not something that a
Subversion novice is going to do.

Feel free to improve the documentation ;-)

-- 
Philip Martin

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

Re: svn cleanup switches?

Posted by Julian Foad <ju...@btopenworld.com>.
Philip Martin wrote:
> "Brian W. Fitzpatrick" <fi...@red-bean.com> writes:
> 
>>Why does svn cleanup take any switches at *all*? I'd say this is a
>>bug.  Anyone?
> 
> Cleanup reruns log files and that could involve running a merge, thus
> the user needs to be able to set --diff3-cmd.  The diff3 command can
> also be set in the config file, thus the user needs to be able to set
> --config-dir.

Yes, but... yuck!  That's all very well for a developer of Subversion, but very much relies on the user knowing how it works.  Say my friend has just run the "project-check-in" script that his administrator provided, and it failed with some error about a locked working copy.  My friend has heard of this "svn cleanup" which can recover from such situations.  So he runs "svn cleanup", and things get worse (a merge is done wrongly).  The administrator explains to him, "Oh, no - you shouldn't have run that command without figuring out what the active config dir and merge command were when the failing Subversion command was executed."

I think we need to build in a bit more "intelligence".  For instance, maybe the log file could record the merge command that it was going to use.

- Julian


>>$svn help cleanup
>>cleanup: Recursively clean up the working copy, removing locks, resuming
>>unfinished operations, etc.
>>usage: cleanup [PATH...]
>>
>>Valid options:
>>  --diff3-cmd arg          : use ARG as merge command
>>  --config-dir arg         : read user configuration files from directory ARG

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

Re: svn cleanup switches?

Posted by Philip Martin <ph...@codematters.co.uk>.
"Brian W. Fitzpatrick" <fi...@red-bean.com> writes:

> Why does svn cleanup take any switches at *all*? I'd say this is a
> bug.  Anyone?

Cleanup reruns log files and that could involve running a merge, thus
the user needs to be able to set --diff3-cmd.  The diff3 command can
also be set in the config file, thus the user needs to be able to set
--config-dir.

> $svn help cleanup
> cleanup: Recursively clean up the working copy, removing locks, resuming
> unfinished operations, etc.
> usage: cleanup [PATH...]
>
> Valid options:
>   --diff3-cmd arg          : use ARG as merge command
>   --config-dir arg         : read user configuration files from directory ARG


-- 
Philip Martin

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