From 694050d6c4daef1c176d6361d1b02b63c5c9c16a Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Thu, 10 Sep 2009 21:24:58 +0530 Subject: [PATCH] all src: suffixed a \n to all die's; error output looks cleaner now --- src/conf-convert.pl | 2 +- src/gl-auth-command | 10 +++++----- src/gl-compile-conf | 12 ++++++------ src/update-hook.pl | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/conf-convert.pl b/src/conf-convert.pl index f9775cb..c5b1ac1 100755 --- a/src/conf-convert.pl +++ b/src/conf-convert.pl @@ -22,7 +22,7 @@ my $groupname; # a gitosis.conf stanza ends when a new "[group name]" line shows up, so you # can't write as you go; you have to accumulate and flush sub flush { - die "repos but no users?" if (not @users and (@repos or @RO_repos)); + die "repos but no users?\n" if (not @users and (@repos or @RO_repos)); # just a groupname if (@users and not (@repos or @RO_repos)) { print "\@$groupname = ", join(" ", @users), "\n"; diff --git a/src/gl-auth-command b/src/gl-auth-command index 4fc757d..c301415 100755 --- a/src/gl-auth-command +++ b/src/gl-auth-command @@ -54,11 +54,11 @@ my $user=$ENV{GL_USER}=shift; # there; now that's available everywhere! # that in the message so people saying "ssh git@server" can see which gitosis # user he is being recognised as my $cmd = $ENV{SSH_ORIGINAL_COMMAND} - or die "no SSH_ORIGINAL_COMMAND? I'm not a shell, $user!"; + or die "no SSH_ORIGINAL_COMMAND? I'm not a shell, $user!\n"; # this check is largely for comic value if someone tries something outrageous; # $cmd gets split and the pieces examined more thoroughly later anyway -die "$cmd??? you're a funny guy..." +die "$cmd??? you're a funny guy...\n" if $cmd =~ /[<>&|;\n]/; # split into command and arguments; the pattern allows old style as well as @@ -81,7 +81,7 @@ die "Sorry, I don't like the command you gave me: $cmd\n" # we know the user and repo; we just need to know what perm he's trying my $perm = ($verb =~ $R_COMMANDS ? 'R' : 'W'); -die "$perm access for $repo denied to $user" +die "$perm access for $repo denied to $user\n" unless $repos{$repo}{$perm}{$user} or $repos{$repo}{$perm}{'@all'}; @@ -109,9 +109,9 @@ $ENV{GL_LOG} = $GL_LOGT; # if log failure isn't important enough to block access, get rid of all the # error checking open my $log_fh, ">>", $ENV{GL_LOG} - or die "open log failed: $!"; + or die "open log failed: $!\n"; print $log_fh "$ENV{GL_TS}\t$ENV{SSH_ORIGINAL_COMMAND}\t$user\n"; -close $log_fh or die "close log failed: $!"; +close $log_fh or die "close log failed: $!\n"; # ---------------------------------------------------------------------------- # over to git now diff --git a/src/gl-compile-conf b/src/gl-compile-conf index 388d933..ce8a0b9 100755 --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@ -84,7 +84,7 @@ sub expand_userlist die "bad user $item\n" unless $item =~ $USERNAME_PATT; if ($item =~ /^@/) # nested group { - die "undefined group $item" unless $groups{$item}; + die "undefined group $item\n" unless $groups{$item}; # add those names to the list push @new_list, @{ $groups{$item} }; } @@ -167,7 +167,7 @@ while (<$conf_fh>) my $compiled_fh = wrap_open( ">", $GL_CONF_COMPILED ); print $compiled_fh Data::Dumper->Dump([\%repos], [qw(*repos)]); -close $compiled_fh or die "close compiled-conf failed: $!"; +close $compiled_fh or die "close compiled-conf failed: $!\n"; # ---------------------------------------------------------------------------- # any new repos created? @@ -185,7 +185,7 @@ for my $repo (keys %repos) { unless (-d "$repo.git") { - mkdir("$repo.git") or die "mkdir $repo.git failed: $!"; + mkdir("$repo.git") or die "mkdir $repo.git failed: $!\n"; wrap_chdir("$repo.git"); system("git init --bare"); system("cp $GL_ADMINDIR/src/update-hook.pl hooks/update"); @@ -217,7 +217,7 @@ for my $pubkey (glob("*.pub")) print $newkeys_fh `cat $pubkey`; } print $newkeys_fh "# gitolite end\n"; -close $newkeys_fh or die "close newkeys failed: $!"; +close $newkeys_fh or die "close newkeys failed: $!\n"; # all done; overwrite the file (use cat to avoid perm changes) system("cat $ENV{HOME}/.ssh/authorized_keys > $ENV{HOME}/.ssh/old_authkeys"); @@ -234,9 +234,9 @@ if (-d ".git") if (system("git diff --cached --quiet") ) { open my $commit_ph, "|-", "git commit -F -" - or die "open commit failed: $!"; + or die "open commit failed: $!\n"; print $commit_ph "keydir changed\n\n"; print $commit_ph `git diff --cached --name-status`; - close $commit_ph or die "close commit failed: $!"; + close $commit_ph or die "close commit failed: $!\n"; } } diff --git a/src/update-hook.pl b/src/update-hook.pl index fe92ec7..c703723 100755 --- a/src/update-hook.pl +++ b/src/update-hook.pl @@ -69,11 +69,11 @@ for my $refex (@allowed_refs) # if log failure isn't important enough to block pushes, get rid of # all the error checking open my $log_fh, ">>", $ENV{GL_LOG} - or die "open log failed: $!"; + or die "open log failed: $!\n"; print $log_fh "$ENV{GL_TS} $perm\t" . substr($oldsha, 0, 14) . "\t" . substr($newsha, 0, 14) . "\t$ENV{GL_REPO}\t$ref\t$ENV{GL_USER}\n"; - close $log_fh or die "close log failed: $!"; + close $log_fh or die "close log failed: $!\n"; exit 0; } }