all src: suffixed a \n to all die's; error output looks cleaner now

This commit is contained in:
Sitaram Chamarty 2009-09-10 21:24:58 +05:30
parent 3d44b003c8
commit 694050d6c4
4 changed files with 14 additions and 14 deletions

View file

@ -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";

View file

@ -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

View file

@ -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";
}
}

View file

@ -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;
}
}