threads / patch / 14840

patchgit-cvsimport.perl: Print "UNKNOWN LINE..." on stderr, not stdout.

Subject: [PATCH] git-cvsimport.perl: Print "UNKNOWN LINE..." on stderr, not stdout.

## tl;dr

4 messages between Aug 5, 2008 and Aug 5, 2008. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Jim Meyering· Aug 5, 2008, 14:54 UTC · lore
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
I'm used to filtering git-cvsimport's noisy stderr, but this
diagnostic appears on stdout.  Looks like an oversight.
Now that I'm using cvsps-2.2b1, I see tons of these.
 git-cvsimport.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git-cvsimport.perl +1 −2
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index e2664ef..e439202 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -952,7 +952,7 @@ while (<CVS>) {
 	} elsif (/^-+$/) { # end of unknown-line processing
 		$state = 1;
 	} elsif ($state != 11) { # ignore stuff when skipping
-		print "* UNKNOWN LINE * $_\n";
+		print STDERR "* UNKNOWN LINE * $_\n";
 	}
 }
 commit() if $branch and $state != 11;
--
1.6.0.rc1.36.g5ff70
Jeff King· Aug 5, 2008, 15:28 UTC · re: Jim Meyering · lore

Re: [PATCH] git-cvsimport.perl: Print "UNKNOWN LINE..." on stderr, not stdout.

On Tue, Aug 05, 2008 at 04:54:42PM +0200, Jim Meyering wrote:
> I'm used to filtering git-cvsimport's noisy stderr, but this
> diagnostic appears on stdout.  Looks like an oversight.
> Now that I'm using cvsps-2.2b1, I see tons of these.
There are a ton of things that go to stdout:
  $ perl -ne '/print (\S+)/ && print "$1\n" git-cvsimport.perl |
    grep '^#' | wc -l
  18

though many are only activated via "-v". Maybe it is worth putting all of them to stderr? I really don't see why cvsimport should ever produce any output on stdout.

-Peff
Jeff King· Aug 5, 2008, 15:35 UTC · re: Jeff King · lore

Re: [PATCH] git-cvsimport.perl: Print "UNKNOWN LINE..." on stderr, not stdout.

On Tue, Aug 05, 2008 at 11:28:36AM -0400, Jeff King wrote:
>   $ perl -ne '/print (\S+)/ && print "$1\n" git-cvsimport.perl |
>     grep '^#' | wc -l
Urgh, somehow I managed to get a typo into my cut and paste. It should be
  grep '^"'

(i.e., we are getting rid of "print STDERR" and "print $fh"; this is admittedly not very robust, but I just wanted an approximation of how many there were).

-Peff
Jim Meyering· Aug 5, 2008, 15:44 UTC · re: Jeff King · lore

Re: [PATCH] git-cvsimport.perl: Print "UNKNOWN LINE..." on stderr, not stdout.

Jeff King <peff@peff.net> wrote:
Show 15 quoted lines
> On Tue, Aug 05, 2008 at 04:54:42PM +0200, Jim Meyering wrote:
>
>> I'm used to filtering git-cvsimport's noisy stderr, but this
>> diagnostic appears on stdout.  Looks like an oversight.
>> Now that I'm using cvsps-2.2b1, I see tons of these.
>
> There are a ton of things that go to stdout:
>
>   $ perl -ne '/print (\S+)/ && print "$1\n" git-cvsimport.perl |
>     grep '^#' | wc -l
>   18
>
> though many are only activated via "-v". Maybe it is worth putting all
> of them to stderr? I really don't see why cvsimport should ever produce
> any output on stdout.
A quick scan (post-patch)
    $ grep 'print ' git-cvsimport.perl|grep -vE 'STDERR|opt_v'
    print $f "$_=$conv_author_name{$_} <$conv_author_email{$_}>\n";
    print $fh $line;
    print $fh $buf;
    print $cvspsfh $_;
    print $fh
    print "SKIPPING $fn v $rev\n";

suggests that if you don't count the "SKIPPING..." diagnostic you'd get for each "-S REGEXP"-skipped name, the "UNKNOWN LINE" diagnostic is the only one that goes to stdout but that is not protected by an $opt_v guard.

← back to recent threads