Skip to contentSkip to conversation

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

PATCH In review Jim Meyering 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-cvsimport.perl: Print "UNKNOWN LINE..." on stderr, not stdout.

---
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(-)
git-cvsimport.perl +1 -1
index e2664ef..e439202 100755
@@ -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

#1 lore raw
Quoted 3 lines · Jim Meyering

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

#2 lore raw
Quoted 2 lines · Jeff King
  $ 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

#3 lore raw
In reply to Jeff King
Quoted 8 lines · Jeff King
Quoted 3 lines · Jim Meyering

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:

Quoted 7 lines
  $ 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.