You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Branko Čibej <br...@apache.org> on 2016/04/07 04:55:35 UTC

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

On 06.04.2016 20:42, kotkov@apache.org wrote:
> Author: kotkov
> Date: Wed Apr  6 18:42:07 2016
> New Revision: 1738021
>
> URL: http://svn.apache.org/viewvc?rev=1738021&view=rev
> Log:
> Introduce `--file' option for svnadmin dump, dump-revprops, load and
> load-revprops subcommands.
>
> This option allows specifying input or output files, instead of using STDIN
> or STDOUT.  Using --file (-F) should probably work a bit faster, but, what
> is more important, this option allows working with dump files in a shell
> that performs additional processing when piping data and thus can silently
> corrupt the dumps.  For instance, that's how Microsoft PowerShell currently
> works.


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?

-- Brane

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

Posted by Branko Čibej <br...@apache.org>.
On 07.04.2016 12:31, Evgeny Kotkov wrote:
> Branko Čibej <br...@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.

Thanks for the explanation. It's kind of painful ... Although adding
--file makes perfect sense in any case.

-- Brane

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

Posted by Evgeny Kotkov <ev...@visualsvn.com>.
Branko Čibej <br...@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