From 91a8379f9fff36fba847873f4de7bc1682fa8407 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Tue, 8 Mar 2011 06:36:23 +0530 Subject: [PATCH] change some 'warn's to 'print STDERR' and vice versa with warns now being logged, it's nice to make sure that anything that could even vaguely be considered someone playing with the system, *or* is otherwise noteworthy, be emitted as a 'warn' instead of as a 'print STDERR'. Similarly stuff that is clearly a syntactic warning or typo should come from 'print STDERR', instead of from a 'warn'. --- src/gitolite.pm | 12 ++++++------ src/gl-compile-conf | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gitolite.pm b/src/gitolite.pm index a4463d0..e71b460 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -610,7 +610,7 @@ sub parse_acl } unless (defined($data_version) and $data_version eq $current_data_version) { # this cannot happen for 'easy-install' cases, by the way... - print STDERR "(INTERNAL: $data_version -> $current_data_version; running gl-setup)\n"; + warn "(INTERNAL: $data_version -> $current_data_version; running gl-setup)\n"; system("$ENV{SHELL} -l -c gl-setup >&2"); die "parse $GL_CONF_COMPILED failed: " . ($! or $@) unless do $GL_CONF_COMPILED; @@ -923,7 +923,7 @@ sub setup_authkeys # security check (thanks to divVerent for catching this) unless ($pubkey =~ $REPONAME_PATT) { - print STDERR "$pubkey contains some unsavoury characters; ignored...\n"; + warn "$pubkey contains some unsavoury characters; ignored...\n"; next; } @@ -952,10 +952,10 @@ sub setup_authkeys # don't trust files with multiple lines (i.e., something after a newline) if ($pubkey_content =~ /\n./) { - print STDERR "WARNING: a pubkey file can only have one line (key); ignoring $pubkey\n" . - " If you want to add multiple public keys for a single user, use\n" . - " \"user\@host.pub\" file names. See the \"one user, many keys\"\n" . - " section in doc/3-faq-tips-etc.mkd for details.\n"; + warn "WARNING: a pubkey file can only have one line (key); ignoring $pubkey\n" . + " If you want to add multiple public keys for a single user, use\n" . + " \"user\@host.pub\" file names. See the \"one user, many keys\"\n" . + " section in doc/3-faq-tips-etc.mkd for details.\n"; next; } print $newkeys_fh "command=\"$AUTH_COMMAND $user\",$AUTH_OPTIONS "; diff --git a/src/gl-compile-conf b/src/gl-compile-conf index c8d214f..c9f8705 100755 --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@ -141,7 +141,7 @@ sub parse_conf_line @{ $repos_p } = expand_list ( @{ $repos_p } ) unless $GL_BIG_CONFIG; # ...sanity check for (@{ $repos_p }) { - warn "$WARN explicit '.git' extension ignored for $_.git\n" if s/\.git$//; + print STDERR "$WARN explicit '.git' extension ignored for $_.git\n" if s/\.git$//; die "$ABRT bad reponame $_\n" if ($GL_WILDREPOS and $_ !~ $REPOPATT_PATT); die "$ABRT bad reponame $_ or you forgot to set \$GL_WILDREPOS\n" @@ -161,7 +161,7 @@ sub parse_conf_line # if no ref is given, this PERM applies to all refs @refs = qw(refs/.*) unless @refs; # deprecation warning - map { warn "WARNING: old syntax 'PATH/' found; please use new syntax 'NAME/'\n" if s(^PATH/)(NAME/) } @refs; + map { print STDERR "WARNING: old syntax 'PATH/' found; please use new syntax 'NAME/'\n" if s(^PATH/)(NAME/) } @refs; # fully qualify refs that dont start with "refs/" or "NAME/"; # prefix them with "refs/heads/" @refs = map { m(^(refs|NAME)/) or s(^)(refs/heads/); $_ } @refs; @@ -242,7 +242,7 @@ sub parse_conf_line my @r = ($repo); # single wildpatt @r = sort keys %{ $groups{$repo} } if $groups{$repo}; # or a group; get its members do { - print STDERR "$WARN git config set for $_ but \$GL_GITCONFIG_WILD not set\n" unless $_ =~ $REPONAME_PATT + warn "$WARN git config set for $_ but \$GL_GITCONFIG_WILD not set\n" unless $_ =~ $REPONAME_PATT } for @r; } }