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

Re: [PATCH] Change test suite to read file properties in XML format [was: Re: cvs2svn test suite breakage caused by svn changes]

From: Michael Haggerty <mhagger_at_alum.mit.edu>
Date: Mon, 27 Jul 2009 17:15:02 +0200

James Abbatiello wrote:
> On Sun, Jul 26, 2009 at 12:02 PM, Michael Haggerty<mhagger_at_alum.mit.edu> wrote:
>> The only difference I would expect compared to the old code is that the
>> old code handled end-of-lines unusually, which I presume was a
>> side-effect of having to parse the text output of "svn proplist". I
>> think that what the new code does is the "right thing", but *if* there
>> are problems they are likely to appear under Windows, which I don't have
>> available for testing.
> On Windows the old code produces:
>>>> svntest.tree.get_props(['svntest'])
> {'svntest': {'svn:ignore': '*.pyc\n*.o\n*~\n.*~\n\n'}}
> And the new version produces:
>>>> svntest.tree.get_props(['svntest'])
> {u'svntest': {u'svn:ignore': u'*.pyc\r\n*.o\r\n*~\r\n.*~\r\n\r\n'}}
> So it looks like some line-ending manipulation is still needed unless
> the consumers are prepared to handle both forms.

James, thanks for testing this. It would be trivial to add the
EOL-fixing code to my patch, but first I want to understand it because I
fear there is a deeper problem.

After digging through more Subversion code I found that the handling of
property values is strange (and not very consistent). Even in the case
of XML output, where I had expected the data to come out 1:1, SVN munges
properties that start with "svn:" while they are being output. I hadn't
expected that.

But even though SVN outputs '\r\n' on Windows, I still don't understand
how the '\r\n' characters get through in the test suite. The calling
sequence in the test suite goes like this (before my patch):

      main.run_svn(1, ...):
        main.run_command(..., binary_mode=0):
                if windows and not binary_mode:
                  stdout = stdout.replace('\r\n', '\n')
                  stderr = stderr.replace('\r\n', '\n')
                stdout_lines = stdout.splitlines(True)
                stderr_lines = stderr.splitlines(True)
            remove 'DBG:' lines from stdout

main.run_svn() explicitly sets binary_mode=0 when it calls
main.run_command(), and the "windows" variable is set by the following
code in main.py:

# Windows specifics
if sys.platform == 'win32':
  windows = True
  # ...
  windows = False
  # ...

So, assuming that your python interpreter has sys.platform=='win32', the
end-of-lines should have all been normalized to '\n' in main.wait_on_pipe().

Perhaps there is a cygwin issue or something. James, what does

    python -c 'import sys; print sys.platform'

print on your computer?

From the above call tree, it also looks like main.run_command_stdin()
should have already discarded any lines that start with 'DBG:', so the
corresponding code in tree.get_props() should be redundant.

I will submit a new patch when this gets sorted out.


Received on 2009-07-27 17:15:27 CEST

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