diff options
author | 2015-10-16 10:45:11 +0530 | |
---|---|---|
committer | 2015-10-16 10:50:42 +0530 | |
commit | ea8240350eabaa1a0ac911b8f87e89903383a633 (patch) | |
tree | ec9c6193017a78bb0ed601f05945018f668a5a4e /src/commands/perms | |
parent | Add script to pull and sanitize Active Directory user groups (diff) | |
download | gitolite-gentoo-ea8240350eabaa1a0ac911b8f87e89903383a633.tar.gz gitolite-gentoo-ea8240350eabaa1a0ac911b8f87e89903383a633.tar.bz2 gitolite-gentoo-ea8240350eabaa1a0ac911b8f87e89903383a633.zip |
minor fixups to 'perms' command:
- when list_roles is invoked as part of the error reporting for an invalid
role (as opposed to being explicitly asked for by option '-lr'), the
output should go to STDERR, just like the error message.
- the Ctrl-C stuff doesn't work when the user is sharing multiple ssh
sessions over a single connection (see, ControlMaster, ControlPersist,
etc., in 'man ssh_config'). Replaced it with a more explicit means to
allow a user who inadvertently walked into this mode of operation to
gracefully get out.
Thanks to Stephane Chazelas on the mailing list[1] for reporting the issues,
subsequent discussion, and patches which I was able to modify as needed.
[1]: https://groups.google.com/forum/#!topic/gitolite/Fcw1Et9PGmw
Diffstat (limited to 'src/commands/perms')
-rwxr-xr-x | src/commands/perms | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/commands/perms b/src/commands/perms index 0b7c5b2..30984bf 100755 --- a/src/commands/perms +++ b/src/commands/perms @@ -99,14 +99,15 @@ sub setperms { if ( not @_ ) { # legacy mode; pipe data in print STDERR "'batch' mode started, waiting for input (run with '-h' for details).\n"; - print STDERR "Please hit Ctrl-C if you did not intend to do this.\n"; + print STDERR "Please enter 'cancel' to abort if you did not intend to do this.\n"; @ARGV = (); my @a; - for (<>) { + while (<>) { + _die "CANCELLED" if /^\s*cancel\s*$/i; invalid_role($1) if /(\S+)/ and not $rc{ROLES}{$1}; push @a, $_; } - print STDERR "\n"; # make sure Ctrl-C gets caught + _print( $pf, @a ); return; } @@ -167,6 +168,7 @@ sub invalid_role { my $role = shift; print STDERR "Invalid role '$role'; valid roles for this repo:\n"; + open(STDOUT, '>&', \*STDERR); # make list_roles print to STDERR list_roles(); exit 1; } |