Zsh Mailing List Archive
Messages sorted by:
Re: freebsd problems with carriage return
- X-seq: zsh-users 13967
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- To: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- Subject: Re: freebsd problems with carriage return
- Date: Wed, 25 Mar 2009 12:23:02 +0000
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; b=6Mr46mpMozBaXbdzeqcllLxQEmGZAMTFcbkKjvWxmP+dgN4NRlEuTdno+2uY/UGKod2azd9HYMdOLW7O7JO9/FNkmNVgNbgw/AGkNCGdm9ZX94JqUyvrlJSR/byajDJKaBAcqLbhHcsmt/L5Qt86cOsKjp77BHV/K0bLAeRzIC8= ;
- In-reply-to: <alpine.LNX.2.00.0903250227080.3609@averatec>
- Mail-followup-to: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090324101411.66890.qmail@xxxxxxxxxxx> <chaz20090324114727.GA5144@xxxxxxxxxxx> <20090324213624.93603.qmail@xxxxxxxxxxx> <alpine.LNX.2.00.0903250227080.3609@averatec>
2009-03-25 04:18:51 -0400, Benjamin R. Haskell:
> I think it's a difference in how FreeBSD and Linux handle some
> tty/job-control settings. (Though it's not terribly surprising to me...
> one of those "I'm going to behave differently when you pipe me" things.)
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?
> On FreeBSD for me, the status updates are visible when not piped (either
> displayed to terminal, or redirected to a file). But, rsync --progress
> from to | cat -v only shows the final status.
> I noticed in the rsync code (progress.c) that it declines to print the
> partial status lines (the ones that end with '\r' so that they can be
> overwritten) depending on the outcome of:
> 210 tc_pgrp = tcgetpgrp(STDOUT_FILENO);
> 211 if (tc_pgrp != pgrp && tc_pgrp != -1)
> 212 return;
The above is meant not to print the progress if the output is to
a terminal and rsync is not in the foreground process group of
For a pipe, tcgetpgrp should return -1 so that test should fail
(unless there's a bug in FreeBSD? ktrace would probably tell
> Maybe something in 'stty' will affect the outcome of the above call (but
> you'd have to ask someone who knows way more about it than I do). There
> are at least a handful of differences in the various settings between
> FreeBSD and Linux for the systems I'm using right now.
It shouldn't have anything to do with stty as we're not
accessing the terminal here. And stty doesn't affect the
foreground process group of the terminal, it's the shell's job
control that does.
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.
Now, looking at:
/* This is deprecated, FIOGETOWN should be used instead. */
*(int *)data = -fgetown(&mpipe->pipe_sigio);
So tcgetpgrp() is valid on a pipe on FreeBSD, so it contradicts
its man page.
That would be the reason. To fix that, you'd have to patch rsync
to add a isatty() check, or better, remove that check
altogether, as if the user reguested progress with --progress, I
don't agree that rsync should disable it in any circumstance.
Messages sorted by: