Bug 2130 - suppressing progress bar when not the foreground process
Summary: suppressing progress bar when not the foreground process
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.3
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
Depends on:
Reported: 2004-12-08 03:05 UTC by Luke Mewburn
Modified: 2005-04-01 11:21 UTC (History)
0 users

See Also:

rsync-progress.patch (1.59 KB, patch)
2004-12-08 03:06 UTC, Luke Mewburn
no flags Details
My version of the patch to progress.c (787 bytes, patch)
2004-12-14 12:01 UTC, Wayne Davison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Mewburn 2004-12-08 03:05:36 UTC
'rsync --progress'  always prints the dynamic progress information, even if the
process is suspended and backgrounded or rsync is started in the background.
This causes the display of the current foreground process on the tty (or shell)
to be scrambled every second as the progress bar is updated.

The solution is to use tcgetpgrp() (on stdout) to verify that rsync is the
foreground process.  I'll provide a patch.
Comment 1 Luke Mewburn 2004-12-08 03:06:40 UTC
Created attachment 828 [details]
Comment 2 Wayne Davison 2004-12-14 12:01:28 UTC
Created attachment 843 [details]
My version of the patch to progress.c

I'm considering this change, and I think it looks good with a couple changes to
the progress.c part of the patch:

- Make use of the HAVE_GETPGRP define.
- Don't skip the output if tcgetpgrp() returns -1 (as it will
  if output is redirected to a file).

Is it safe to assume that if a system has getpgrp() that it also has
tcgetpgrp()?  That's what both our patches are currently doing, and it seems
reasonable to me.
Comment 3 Luke Mewburn 2004-12-15 03:47:02 UTC
I've treated having getpgrp() as having tcgetpgrp() in my own code.

However, it may be safer to add a separate autoconf check, and only enable this
functionality  #if HAVE_GETPGRP && HAVE_TCGETPGRP.

Comment 4 Wayne Davison 2005-02-13 21:40:57 UTC
This was checked into the CVS version a little while ago.