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

Re: "svn patch" and the TAB character

From: Branko Čibej <brane_at_apache.org>
Date: Tue, 17 Dec 2019 15:42:50 +0100

On 17.12.2019 14:58, Stefan Sperling wrote:
> On Tue, Dec 17, 2019 at 08:33:09AM -0500, Doug Robinson wrote:
>>> And of course, both the
>>> filename and the label (= the part after the tab character) may contain an
>>> arbitrary number of spaces.
>> The problem is parsing the line into proper tokens when every character out
>> there can be part of the file name. There must be a structure to the field
>> or parsing is not really parsing anymore.
> The output of 'svn diff' was not designed with 'svn patch' in mind.
> The diff command preceded the patch command by many years.
>
> I still believe that making --patch-compatible produce filenames without
> any trailing annotations in the output of 'svn diff' is the best answer.

Agreed. Plain-vanilla BSD patch should be able to apply such patches, as
should 'svn patch'.

> This whole discussion started off with the problem statement that the
> --patch-compatible option produces a diff which cannot be applied after
> tabs are replaced with spaces.
>
> This filename parsing problem isn't limited to 'svn patch'. Other patch
> implementations might run into the same problem. The way 'svn patch' finds
> the filename is based on Larry Wall's original patch program.

Precisely. That TAB *is* the canonical delimiter. The (implicit)
specification is decades old, and it would be an error to try to
second-guess it at this point.

Designing a stricter universal format for transmitting contextual
changes is a different matter entirely, one that we tried to tackle in
the past and failed; other version control systems tried and failed,
too. It would be a nice thing to have, but it's hardly something this
community can do in isolation.

> Generally, patches being mangled in transit is a notorious problem especially
> with web-based email. It's not really a safe format for this purpose. If patches
> get changed in transit in any way there is no guarantee they will apply cleanly.
> That's not a new problem, it's a long-standing issue. And it's not SVN-specific.
> There is already a way to transfer changes without such problems: svn commit

And note that the tabs-to-spaces headache doesn't stop with parsing the
filename out of the header, it affects the filename itself. I can put
tabs in a filename on most Unix filesystems ... that would probably
break even the original patch tool.

-- Brane
Received on 2019-12-17 15:42:52 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.