Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: freebsd problems with carriage return



On Wed, 25 Mar 2009, Stephane Chazelas wrote:

Except that as far as I can see from the source code, it does an explicit fflush() after each progress line, so it shouldn't be a stdio buffering issue. Unless the OP's using an old version of rsync on FreeBSD?
==================

freebsd:
	rsync  version 3.0.2
	rsync  version 3.0.5
linux:
	rsync  version 2.6.9


The fact that you don't get the output when stdout is a pipe is probably the place to look at. But I don't know why rsync would decide not to output the progress when stdout is pipe as opposed to when it's a regular file.
====================

hhmmm... it may be related to a pipe (but it works as expected on linux, with a pipe or redirect)... so maybe i can use a redirect as if it's a pipe...
	http://smasher.org/tmp/snapshot154.png

the top half of that split screen is `tr` converting carriage returns into newlines, and reading stdin from a fifo. the bottom half is rsync, with stdout redirected into the fifo. it's working as desired and expected, even on freebsd.

what seems to me like just a slight variation of that, once again works on linux and fails on freebsd:
	tr '\r' '\n' < <( rsync --progress --bwlimit=5 foo_in foo_out )
 or:
	rsync --progress --bwlimit=5 foo_in foo_out > >( tr '\r' '\n' )

my understanding of zsh; process substitution should operate as a fifo. so i really don't get why it works as desired in the screen-shot, but not with process substitution.


--
        ...atom

 ________________________
 http://atom.smasher.org/
 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
 -------------------------------------------------

	"Only when the last tree has died,
	 And the last river poisoned,
	 And the last fish been caught,
	 Will the white man realize that he cannot eat money"
		--19th Century Cree Indian Proverb



Messages sorted by: Reverse Date, Date, Thread, Author