(minor) single quotes around variables in error messages
(plus a couple of other minor fixups)
This commit is contained in:
parent
20d2120ea5
commit
d04e79d291
|
@ -103,7 +103,7 @@ sub args {
|
||||||
sub run_command {
|
sub run_command {
|
||||||
my $pgm = shift;
|
my $pgm = shift;
|
||||||
my $fullpath = "$ENV{GL_BINDIR}/commands/$pgm";
|
my $fullpath = "$ENV{GL_BINDIR}/commands/$pgm";
|
||||||
_die "$pgm not found or not executable" if not -x $fullpath;
|
_die "'$pgm' not found or not executable" if not -x $fullpath;
|
||||||
_system( $fullpath, @_ );
|
_system( $fullpath, @_ );
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ sub parse_soc {
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_die "unknown git/gitolite command: $soc";
|
_die "unknown git/gitolite command: '$soc'";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub sanity {
|
sub sanity {
|
||||||
|
|
|
@ -62,7 +62,7 @@ sub parse {
|
||||||
my @validkeys = split( ' ', ( $rc{GIT_CONFIG_KEYS} || '' ) );
|
my @validkeys = split( ' ', ( $rc{GIT_CONFIG_KEYS} || '' ) );
|
||||||
push @validkeys, "gitolite-options\\..*";
|
push @validkeys, "gitolite-options\\..*";
|
||||||
my @matched = grep { $key =~ /^$_$/ } @validkeys;
|
my @matched = grep { $key =~ /^$_$/ } @validkeys;
|
||||||
_die "git config $key not allowed\ncheck GIT_CONFIG_KEYS in the rc file" if ( @matched < 1 );
|
_die "git config '$key' not allowed\ncheck GIT_CONFIG_KEYS in the rc file" if ( @matched < 1 );
|
||||||
_die "bad value '$value'" if $value =~ $UNSAFE_PATT;
|
_die "bad value '$value'" if $value =~ $UNSAFE_PATT;
|
||||||
add_config( 1, $key, $value );
|
add_config( 1, $key, $value );
|
||||||
} elsif ( $line =~ /^subconf (\S+)$/ ) {
|
} elsif ( $line =~ /^subconf (\S+)$/ ) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ sub incsub {
|
||||||
my $is_subconf = ( +shift eq 'subconf' );
|
my $is_subconf = ( +shift eq 'subconf' );
|
||||||
my ( $new_subconf, $include_glob, $current_subconf, $out ) = @_;
|
my ( $new_subconf, $include_glob, $current_subconf, $out ) = @_;
|
||||||
|
|
||||||
_die "subconf $current_subconf attempting to run 'subconf'\n" if $is_subconf and $current_subconf ne 'master';
|
_die "subconf '$current_subconf' attempting to run 'subconf'\n" if $is_subconf and $current_subconf ne 'master';
|
||||||
|
|
||||||
_die "invalid include/subconf file/glob '$include_glob'"
|
_die "invalid include/subconf file/glob '$include_glob'"
|
||||||
unless $include_glob =~ /^"(.+)"$/
|
unless $include_glob =~ /^"(.+)"$/
|
||||||
|
@ -63,7 +63,7 @@ sub incsub {
|
||||||
|
|
||||||
for my $file ( glob($include_glob) ) {
|
for my $file ( glob($include_glob) ) {
|
||||||
_warn("included file not found: '$file'"), next unless -f $file;
|
_warn("included file not found: '$file'"), next unless -f $file;
|
||||||
_die "invalid include/subconf filename $file" unless $file =~ m(([^/]+).conf$);
|
_die "invalid include/subconf filename '$file'" unless $file =~ m(([^/]+).conf$);
|
||||||
my $basename = $1;
|
my $basename = $1;
|
||||||
|
|
||||||
next if already_included($file);
|
next if already_included($file);
|
||||||
|
|
|
@ -73,7 +73,7 @@ sub access {
|
||||||
load($repo);
|
load($repo);
|
||||||
|
|
||||||
# sanity check the only piece the user can control
|
# sanity check the only piece the user can control
|
||||||
_die "invalid characters in ref or filename: $ref\n" unless $ref =~ $REF_OR_FILENAME_PATT;
|
_die "invalid characters in ref or filename: '$ref'\n" unless $ref =~ $REF_OR_FILENAME_PATT;
|
||||||
|
|
||||||
# when a real repo doesn't exist, ^C is a pre-requisite for any other
|
# when a real repo doesn't exist, ^C is a pre-requisite for any other
|
||||||
# check to give valid results.
|
# check to give valid results.
|
||||||
|
@ -193,11 +193,11 @@ sub load_common {
|
||||||
|
|
||||||
my $cc = "conf/gitolite.conf-compiled.pm";
|
my $cc = "conf/gitolite.conf-compiled.pm";
|
||||||
|
|
||||||
_die "parse $cc failed: " . ( $! or $@ ) unless do $cc;
|
_die "parse '$cc' failed: " . ( $! or $@ ) unless do $cc;
|
||||||
|
|
||||||
if ( data_version_mismatch() ) {
|
if ( data_version_mismatch() ) {
|
||||||
_system("gitolite setup");
|
_system("gitolite setup");
|
||||||
_die "parse $cc failed: " . ( $! or $@ ) unless do $cc;
|
_die "parse '$cc' failed: " . ( $! or $@ ) unless do $cc;
|
||||||
_die "data version update failed; this is serious" if data_version_mismatch();
|
_die "data version update failed; this is serious" if data_version_mismatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ sub load_1 {
|
||||||
_warn "split conf not set, gl-conf present for '$repo'" if not $split_conf{$repo};
|
_warn "split conf not set, gl-conf present for '$repo'" if not $split_conf{$repo};
|
||||||
|
|
||||||
my $cc = "gl-conf";
|
my $cc = "gl-conf";
|
||||||
_die "parse $cc failed: " . ( $! or $@ ) unless do $cc;
|
_die "parse '$cc' failed: " . ( $! or $@ ) unless do $cc;
|
||||||
|
|
||||||
$last_repo = $repo;
|
$last_repo = $repo;
|
||||||
$repos{$repo} = $one_repo{$repo};
|
$repos{$repo} = $one_repo{$repo};
|
||||||
|
|
|
@ -137,7 +137,7 @@ sub expand_list {
|
||||||
for my $item (@list) {
|
for my $item (@list) {
|
||||||
if ( $item =~ /^@/ and $item ne '@all' ) # nested group
|
if ( $item =~ /^@/ and $item ne '@all' ) # nested group
|
||||||
{
|
{
|
||||||
_die "undefined group $item" unless $groups{$item};
|
_die "undefined group '$item'" unless $groups{$item};
|
||||||
# add those names to the list
|
# add those names to the list
|
||||||
push @new_list, sort keys %{ $groups{$item} };
|
push @new_list, sort keys %{ $groups{$item} };
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -62,9 +62,9 @@ sub check_vrefs {
|
||||||
} else {
|
} else {
|
||||||
my ( $dummy, $pgm, @args ) = split '/', $vref;
|
my ( $dummy, $pgm, @args ) = split '/', $vref;
|
||||||
$pgm = "$ENV{GL_BINDIR}/VREF/$pgm";
|
$pgm = "$ENV{GL_BINDIR}/VREF/$pgm";
|
||||||
-x $pgm or _die "$vref: helper program missing or unexecutable";
|
-x $pgm or _die "'$vref': helper program missing or unexecutable";
|
||||||
|
|
||||||
open( my $fh, "-|", $pgm, @_, $vref, @args ) or _die "$vref: can't spawn helper program: $!";
|
open( my $fh, "-|", $pgm, @_, $vref, @args ) or _die "'$vref': can't spawn helper program: $!";
|
||||||
while (<$fh>) {
|
while (<$fh>) {
|
||||||
# print non-vref lines and skip processing (for example,
|
# print non-vref lines and skip processing (for example,
|
||||||
# normal STDOUT by a normal update hook)
|
# normal STDOUT by a normal update hook)
|
||||||
|
|
|
@ -63,7 +63,7 @@ my $rc = glrc('filename');
|
||||||
do $rc if -r $rc;
|
do $rc if -r $rc;
|
||||||
if ( defined($GL_ADMINDIR) ) {
|
if ( defined($GL_ADMINDIR) ) {
|
||||||
say2 "";
|
say2 "";
|
||||||
say2 "FATAL: $rc seems to be for older gitolite; please see doc/g2migr.mkd\n" . "(online at http://sitaramc.github.com/gitolite/g3/g2migr.html)";
|
say2 "FATAL: '$rc' seems to be for older gitolite; please see doc/g2migr.mkd\n" . "(online at http://sitaramc.github.com/gitolite/g2migr.html)";
|
||||||
|
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ sub glrc {
|
||||||
} elsif ( $cmd eq 'current-data-version' ) {
|
} elsif ( $cmd eq 'current-data-version' ) {
|
||||||
return $current_data_version;
|
return $current_data_version;
|
||||||
} else {
|
} else {
|
||||||
_die "unknown argument to glrc: $cmd";
|
_die "unknown argument to glrc: '$cmd'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ sub trigger {
|
||||||
|
|
||||||
if ( exists $rc{$rc_section} ) {
|
if ( exists $rc{$rc_section} ) {
|
||||||
if ( ref( $rc{$rc_section} ) ne 'ARRAY' ) {
|
if ( ref( $rc{$rc_section} ) ne 'ARRAY' ) {
|
||||||
_die "$rc_section section in rc file is not a perl list";
|
_die "'$rc_section' section in rc file is not a perl list";
|
||||||
} else {
|
} else {
|
||||||
for my $s ( @{ $rc{$rc_section} } ) {
|
for my $s ( @{ $rc{$rc_section} } ) {
|
||||||
my ( $pgm, @args ) = split ' ', $s;
|
my ( $pgm, @args ) = split ' ', $s;
|
||||||
|
|
|
@ -69,11 +69,11 @@ sub args {
|
||||||
usage() if $help or ( $pubkey and $admin );
|
usage() if $help or ( $pubkey and $admin );
|
||||||
|
|
||||||
if ($pubkey) {
|
if ($pubkey) {
|
||||||
$pubkey =~ /\.pub$/ or _die "$pubkey name does not end in .pub";
|
$pubkey =~ /\.pub$/ or _die "'$pubkey' name does not end in .pub";
|
||||||
$pubkey =~ /\@/ and _die "$pubkey name contains '\@'";
|
$pubkey =~ /\@/ and _die "'$pubkey' name contains '\@'";
|
||||||
tsh_try("cat $pubkey") or _die "$pubkey not a readable file";
|
tsh_try("cat $pubkey") or _die "'$pubkey' not a readable file";
|
||||||
tsh_lines() == 1 or _die "$pubkey must have exactly one line";
|
tsh_lines() == 1 or _die "'$pubkey' must have exactly one line";
|
||||||
tsh_try("ssh-keygen -l -f $pubkey") or _die "$pubkey does not seem to be a valid ssh pubkey file";
|
tsh_try("ssh-keygen -l -f $pubkey") or _die "'$pubkey' does not seem to be a valid ssh pubkey file";
|
||||||
|
|
||||||
$admin = $pubkey;
|
$admin = $pubkey;
|
||||||
$admin =~ s(.*/)();
|
$admin =~ s(.*/)();
|
||||||
|
|
|
@ -53,16 +53,16 @@ if (@gl_keys) {
|
||||||
my $out = join( "\n", @non_gl, "# gitolite start", @gl_keys, "# gitolite end" ) . "\n";
|
my $out = join( "\n", @non_gl, "# gitolite start", @gl_keys, "# gitolite end" ) . "\n";
|
||||||
|
|
||||||
my $ak = slurp($akfile);
|
my $ak = slurp($akfile);
|
||||||
_die "$akfile changed between start and end of this program!" if $ak ne $old_ak;
|
_die "'$akfile' changed between start and end of this program!" if $ak ne $old_ak;
|
||||||
_print( $akfile, $out );
|
_print( $akfile, $out );
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
sub sanity {
|
sub sanity {
|
||||||
_die "$glshell not found; this should NOT happen..." if not -f $glshell;
|
_die "'$glshell' not found; this should NOT happen..." if not -f $glshell;
|
||||||
_die "$glshell found but not readable; this should NOT happen..." if not -r $glshell;
|
_die "'$glshell' found but not readable; this should NOT happen..." if not -r $glshell;
|
||||||
_die "$glshell found but not executable; this should NOT happen..." if not -x $glshell;
|
_die "'$glshell' found but not executable; this should NOT happen..." if not -x $glshell;
|
||||||
|
|
||||||
_warn "$akdir missing; creating a new one" if not -d $akdir;
|
_warn "$akdir missing; creating a new one" if not -d $akdir;
|
||||||
_warn "$akfile missing; creating a new one" if not -f $akfile;
|
_warn "$akfile missing; creating a new one" if not -f $akfile;
|
||||||
|
@ -103,7 +103,7 @@ sub fp_file {
|
||||||
my $f = shift;
|
my $f = shift;
|
||||||
my $fp = `ssh-keygen -l -f '$f'`;
|
my $fp = `ssh-keygen -l -f '$f'`;
|
||||||
chomp($fp);
|
chomp($fp);
|
||||||
_die "fingerprinting failed for $f" unless $fp =~ /([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f])+)/;
|
_die "fingerprinting failed for '$f'" unless $fp =~ /([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f])+)/;
|
||||||
$fp = $1;
|
$fp = $1;
|
||||||
return $fp;
|
return $fp;
|
||||||
}
|
}
|
||||||
|
|
2
t/fork.t
2
t/fork.t
|
@ -29,7 +29,7 @@ try "
|
||||||
glt ls-remote u1 file:///foo/u1/u1a;ok; gsh
|
glt ls-remote u1 file:///foo/u1/u1a;ok; gsh
|
||||||
/Initialized empty Git repository in .*/foo/u1/u1a.git/
|
/Initialized empty Git repository in .*/foo/u1/u1a.git/
|
||||||
# vrc doesn't have the fork command
|
# vrc doesn't have the fork command
|
||||||
glt fork u1 foo/u1/u1a foo/u1/u1a2; !ok; /FATAL: unknown git/gitolite command: fork/
|
glt fork u1 foo/u1/u1a foo/u1/u1a2; !ok; /FATAL: unknown git/gitolite command: \\'fork/
|
||||||
";
|
";
|
||||||
|
|
||||||
# allow fork as a valid command
|
# allow fork as a valid command
|
||||||
|
|
|
@ -26,7 +26,7 @@ confreset;confadd '
|
||||||
|
|
||||||
try "ADMIN_PUSH set1; /FATAL/" or die text();
|
try "ADMIN_PUSH set1; /FATAL/" or die text();
|
||||||
try "
|
try "
|
||||||
/git config foo.bar not allowed/
|
/git config \\'foo.bar\\' not allowed/
|
||||||
/check GIT_CONFIG_KEYS in the rc file/
|
/check GIT_CONFIG_KEYS in the rc file/
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ confadd 'g2.conf', '
|
||||||
';
|
';
|
||||||
|
|
||||||
try "
|
try "
|
||||||
ADMIN_PUSH set3; ok; /FATAL: subconf g2 attempting to run 'subconf'/
|
ADMIN_PUSH set3; ok; /FATAL: subconf \\'g2\\' attempting to run 'subconf'/
|
||||||
";
|
";
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
|
@ -50,7 +50,7 @@ glt push u1 origin master:dd,ee
|
||||||
|
|
||||||
# push to branch dd=ee fail
|
# push to branch dd=ee fail
|
||||||
glt push u1 origin master:dd=ee
|
glt push u1 origin master:dd=ee
|
||||||
/invalid characters in ref or filename: refs/heads/dd=ee/
|
/invalid characters in ref or filename: \\'refs/heads/dd=ee/
|
||||||
reject
|
reject
|
||||||
";
|
";
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ glt push u1 origin HEAD
|
||||||
tc aa=bb
|
tc aa=bb
|
||||||
glt push u1 origin HEAD
|
glt push u1 origin HEAD
|
||||||
/To file:///aa/
|
/To file:///aa/
|
||||||
/invalid characters in ref or filename: VREF/NAME/aa=bb/
|
/invalid characters in ref or filename: \\'VREF/NAME/aa=bb/
|
||||||
reject
|
reject
|
||||||
|
|
||||||
# push to branch dd,ee ok
|
# push to branch dd,ee ok
|
||||||
|
@ -96,6 +96,6 @@ glt push u1 origin master:dd,ee
|
||||||
|
|
||||||
# push to branch dd=ee fail
|
# push to branch dd=ee fail
|
||||||
glt push u1 origin master:dd=ee
|
glt push u1 origin master:dd=ee
|
||||||
/invalid characters in ref or filename: refs/heads/dd=ee/
|
/invalid characters in ref or filename: \\'refs/heads/dd=ee/
|
||||||
reject
|
reject
|
||||||
";
|
";
|
||||||
|
|
|
@ -60,11 +60,11 @@ try "
|
||||||
|
|
||||||
# a bad key
|
# a bad key
|
||||||
ls -al > bad.pub
|
ls -al > bad.pub
|
||||||
$pgm; !ok; /fingerprinting failed for keydir/bad.pub/
|
$pgm; !ok; /fingerprinting failed for \\'keydir/bad.pub\\'/
|
||||||
wc < $ak; ok; /^ *9 .*/;
|
wc < $ak; ok; /^ *9 .*/;
|
||||||
# a good key doesn't get added
|
# a good key doesn't get added
|
||||||
ssh-keygen -N '' -q -f good
|
ssh-keygen -N '' -q -f good
|
||||||
$pgm; !ok; /fingerprinting failed for keydir/bad.pub/
|
$pgm; !ok; /fingerprinting failed for \\'keydir/bad.pub\\'/
|
||||||
wc < $ak; ok; /^ *9 .*/;
|
wc < $ak; ok; /^ *9 .*/;
|
||||||
# till the bad key is removed
|
# till the bad key is removed
|
||||||
rm bad.pub
|
rm bad.pub
|
||||||
|
|
Loading…
Reference in a new issue