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

Re: svn commit: r1738021 - in /subversion/trunk: subversion/svnadmin/svnadmin.c subversion/tests/cmdline/svnadmin_tests.py tools/client-side/bash_completion

From: Evgeny Kotkov <evgeny.kotkov_at_visualsvn.com>
Date: Thu, 7 Apr 2016 13:31:30 +0300

Branko Čibej <brane_at_apache.org> writes:

> PowerShell fiddles with redirected stdout? That's ... scary!
>
> Out of interest, do you know what it does with the data in the stream
> and why?

It assumes that commands output text, and automatically splits the output
based on line endings:

  $out = svnadmin dump C:\Repositories\test
  $out.GetType() # Object[]
  $out.Length # 14
  $out[0].GetType() # String
  $out[0] # SVN-fs-dump-format-version: 2

Redirection is implemented as pipelining the array of strings to the Out-File
command. This command reconstitutes the text and translates it based on
the current encoding, and that produces unreadable dumps.

In case you're interested, there's an in depth explanation available in [1].

I am not too sure about the "why" part, but maybe assuming everything as
text has its benefits for the majority of commands and cmdlets. Or perhaps,
this is just a side effect of making > work in a predictable way for both
PowerShell commands and executables.

[1] http://brianreiter.org/2010/01/29/powershells-object-pipeline-corrupts-piped-binary-data

Regards,
Evgeny Kotkov
Received on 2016-04-07 12:31:55 CEST

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.