diff --git a/src/gitolite b/src/gitolite index 911eee9..aeca6af 100755 --- a/src/gitolite +++ b/src/gitolite @@ -103,7 +103,7 @@ sub args { sub run_command { my $pgm = shift; 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, @_ ); exit 0; } diff --git a/src/gitolite-shell b/src/gitolite-shell index c4463ad..a40611b 100755 --- a/src/gitolite-shell +++ b/src/gitolite-shell @@ -161,7 +161,7 @@ sub parse_soc { exit 0; } - _die "unknown git/gitolite command: $soc"; + _die "unknown git/gitolite command: '$soc'"; } sub sanity { diff --git a/src/lib/Gitolite/Conf.pm b/src/lib/Gitolite/Conf.pm index a5bda56..8d8c82f 100644 --- a/src/lib/Gitolite/Conf.pm +++ b/src/lib/Gitolite/Conf.pm @@ -62,7 +62,7 @@ sub parse { my @validkeys = split( ' ', ( $rc{GIT_CONFIG_KEYS} || '' ) ); push @validkeys, "gitolite-options\\..*"; 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; add_config( 1, $key, $value ); } elsif ( $line =~ /^subconf (\S+)$/ ) { diff --git a/src/lib/Gitolite/Conf/Explode.pm b/src/lib/Gitolite/Conf/Explode.pm index f72878b..03f2cb2 100644 --- a/src/lib/Gitolite/Conf/Explode.pm +++ b/src/lib/Gitolite/Conf/Explode.pm @@ -52,7 +52,7 @@ sub incsub { my $is_subconf = ( +shift eq 'subconf' ); 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'" unless $include_glob =~ /^"(.+)"$/ @@ -63,7 +63,7 @@ sub incsub { for my $file ( glob($include_glob) ) { _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; next if already_included($file); diff --git a/src/lib/Gitolite/Conf/Load.pm b/src/lib/Gitolite/Conf/Load.pm index 7599727..3537c4f 100644 --- a/src/lib/Gitolite/Conf/Load.pm +++ b/src/lib/Gitolite/Conf/Load.pm @@ -73,7 +73,7 @@ sub access { load($repo); # 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 # check to give valid results. @@ -193,11 +193,11 @@ sub load_common { 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() ) { _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(); } } @@ -223,7 +223,7 @@ sub load_1 { _warn "split conf not set, gl-conf present for '$repo'" if not $split_conf{$repo}; my $cc = "gl-conf"; - _die "parse $cc failed: " . ( $! or $@ ) unless do $cc; + _die "parse '$cc' failed: " . ( $! or $@ ) unless do $cc; $last_repo = $repo; $repos{$repo} = $one_repo{$repo}; diff --git a/src/lib/Gitolite/Conf/Store.pm b/src/lib/Gitolite/Conf/Store.pm index ef5b0fd..4eb3c67 100644 --- a/src/lib/Gitolite/Conf/Store.pm +++ b/src/lib/Gitolite/Conf/Store.pm @@ -137,7 +137,7 @@ sub expand_list { for my $item (@list) { 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 push @new_list, sort keys %{ $groups{$item} }; } else { diff --git a/src/lib/Gitolite/Hooks/Update.pm b/src/lib/Gitolite/Hooks/Update.pm index ed4a03f..6d3844d 100644 --- a/src/lib/Gitolite/Hooks/Update.pm +++ b/src/lib/Gitolite/Hooks/Update.pm @@ -62,9 +62,9 @@ sub check_vrefs { } else { my ( $dummy, $pgm, @args ) = split '/', $vref; $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>) { # print non-vref lines and skip processing (for example, # normal STDOUT by a normal update hook) diff --git a/src/lib/Gitolite/Rc.pm b/src/lib/Gitolite/Rc.pm index 55cda82..3bcac33 100644 --- a/src/lib/Gitolite/Rc.pm +++ b/src/lib/Gitolite/Rc.pm @@ -63,7 +63,7 @@ my $rc = glrc('filename'); do $rc if -r $rc; if ( defined($GL_ADMINDIR) ) { 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; } @@ -132,7 +132,7 @@ sub glrc { } elsif ( $cmd eq 'current-data-version' ) { return $current_data_version; } 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 ( 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 { for my $s ( @{ $rc{$rc_section} } ) { my ( $pgm, @args ) = split ' ', $s; diff --git a/src/lib/Gitolite/Setup.pm b/src/lib/Gitolite/Setup.pm index 1077c0e..3fca752 100644 --- a/src/lib/Gitolite/Setup.pm +++ b/src/lib/Gitolite/Setup.pm @@ -69,11 +69,11 @@ sub args { usage() if $help or ( $pubkey and $admin ); if ($pubkey) { - $pubkey =~ /\.pub$/ or _die "$pubkey name does not end in .pub"; - $pubkey =~ /\@/ and _die "$pubkey name contains '\@'"; - tsh_try("cat $pubkey") or _die "$pubkey not a readable file"; - 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"; + $pubkey =~ /\.pub$/ or _die "'$pubkey' name does not end in .pub"; + $pubkey =~ /\@/ and _die "'$pubkey' name contains '\@'"; + tsh_try("cat $pubkey") or _die "'$pubkey' not a readable file"; + 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"; $admin = $pubkey; $admin =~ s(.*/)(); diff --git a/src/triggers/post-compile/ssh-authkeys b/src/triggers/post-compile/ssh-authkeys index 450144c..7afd3af 100755 --- a/src/triggers/post-compile/ssh-authkeys +++ b/src/triggers/post-compile/ssh-authkeys @@ -53,16 +53,16 @@ if (@gl_keys) { my $out = join( "\n", @non_gl, "# gitolite start", @gl_keys, "# gitolite end" ) . "\n"; 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 ); } # ---------------------------------------------------------------------- sub sanity { - _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 executable; this should NOT happen..." if not -x $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 executable; this should NOT happen..." if not -x $glshell; _warn "$akdir missing; creating a new one" if not -d $akdir; _warn "$akfile missing; creating a new one" if not -f $akfile; @@ -103,7 +103,7 @@ sub fp_file { my $f = shift; my $fp = `ssh-keygen -l -f '$f'`; 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; return $fp; } diff --git a/t/fork.t b/t/fork.t index 38cb200..d595847 100755 --- a/t/fork.t +++ b/t/fork.t @@ -29,7 +29,7 @@ try " glt ls-remote u1 file:///foo/u1/u1a;ok; gsh /Initialized empty Git repository in .*/foo/u1/u1a.git/ # 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 diff --git a/t/git-config.t b/t/git-config.t index 18f2e78..86a3a7b 100755 --- a/t/git-config.t +++ b/t/git-config.t @@ -26,7 +26,7 @@ confreset;confadd ' try "ADMIN_PUSH set1; /FATAL/" or die text(); try " - /git config foo.bar not allowed/ + /git config \\'foo.bar\\' not allowed/ /check GIT_CONFIG_KEYS in the rc file/ "; diff --git a/t/include-subconf.t b/t/include-subconf.t index 6bdff81..813cb93 100755 --- a/t/include-subconf.t +++ b/t/include-subconf.t @@ -78,7 +78,7 @@ confadd 'g2.conf', ' '; try " - ADMIN_PUSH set3; ok; /FATAL: subconf g2 attempting to run 'subconf'/ + ADMIN_PUSH set3; ok; /FATAL: subconf \\'g2\\' attempting to run 'subconf'/ "; # ---------------------------------------------------------------------- diff --git a/t/invalid-refnames-filenames.t b/t/invalid-refnames-filenames.t index d3a3065..bf4fabe 100755 --- a/t/invalid-refnames-filenames.t +++ b/t/invalid-refnames-filenames.t @@ -50,7 +50,7 @@ glt push u1 origin master:dd,ee # push to branch dd=ee fail 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 "; @@ -84,7 +84,7 @@ glt push u1 origin HEAD tc aa=bb glt push u1 origin HEAD /To file:///aa/ - /invalid characters in ref or filename: VREF/NAME/aa=bb/ + /invalid characters in ref or filename: \\'VREF/NAME/aa=bb/ reject # push to branch dd,ee ok @@ -96,6 +96,6 @@ glt push u1 origin master:dd,ee # push to branch dd=ee fail 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 "; diff --git a/t/ssh-authkeys.t b/t/ssh-authkeys.t index 9a897ca..a9b1457 100755 --- a/t/ssh-authkeys.t +++ b/t/ssh-authkeys.t @@ -60,11 +60,11 @@ try " # a bad key ls -al > bad.pub - $pgm; !ok; /fingerprinting failed for keydir/bad.pub/ + $pgm; !ok; /fingerprinting failed for \\'keydir/bad.pub\\'/ wc < $ak; ok; /^ *9 .*/; # a good key doesn't get added 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 .*/; # till the bad key is removed rm bad.pub