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

Re: [RFC] Paths API (svn_dirent_uri.h) - improvements

From: Stefan Sperling <stsp_at_elego.de>
Date: Wed, 11 Nov 2009 20:48:02 +0100

On Wed, Nov 11, 2009 at 08:37:37PM +0100, Branko Cibej wrote:
> Stefan Sperling wrote:
> > You get a patch someone created on Windows, so it contains paths using
> > backslashes as separators, and you want 'svn patch' to apply it to
> > a working copy you have on a unix machine.
> >
>
> Does it work with plain "patch"? No, it does not.

Good point. I forgot to check whether unix patch supports this
before committing r40399.

> You have to manually
> tweak the patch before you can apply it. Exempli gratia:

> Not saying that this is an argument against "svn patch" accepting such
> files, but the purpose of the svn_path_(internal|local)_style functions
> is to deal with local user input, not with cross-OS data migration
> issues. Moreover, just blindly converting backslashes to slashes is
> *ambiguous* and therefore wrong on Unix. (Going the other way is not
> ambiguous on Windows.)

Yeah, a comment I added to the code says:

  /* Contrary to what one might expect, svn_dirent_internal_style() does not
   * replace backslashes with slashes on UNIX. But it's quite possible that
   * a patch generated on Windows uses backslashes as path separators.
   * To apply such patches on UNIX, we need to normalise separators to '/'.
   * Do a global search-replace if the path from the patch file contains
   * only backslashes but no forward slashes. This may not be suitable in all
   * situations, e.g. backslashes might be part of a filename with no leading
   * directory components. But let's optimise for seamless interoperability
   * between platforms rather than for people using weird filenames. */

So I did misunderstand the dirent API.
The question now is whether we want to keep this hack or get rid of it?
Given that patch does not support this, it's not part of my initial
set of 'svn patch' requirements, which is to implement a big enough
subset UNIX patch functionality to be generally useful, but not add
any unnecessary bells and whistles yet. (By the way, Julian, since you
asked for spec, this last sentence is probably the first 'svn patch'
spec I've ever written ;)

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2416719
Received on 2009-11-11 20:48:31 CET

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

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