Issue 2589: Issue with spaces in group name and stream-events
Status:  New
Owner: ----
Reported by gregory....@gmail.com, Apr 7, 2014
Hi,
 
I've hit a strange issue with Gerrit, the Non-Interactive Users group and the Stream Events capability.
 
The user hudsonu is member of the Non-Interactive Users group.
The Non-Interactive User group is allowed in the Stream Events global capability.
Gerrit is 2.8.3
 
$ ssh -p 29418 -i .ssh/id_rsa hudsonu@server gerrit version
gerrit version 2.8.3
 
However, when calling the stream-events commands, it failed :
 
$ ssh -p 29418 -i .ssh/id_rsa hudsonu@server gerrit stream-events
Capability streamEvents is required to access this resource
 
And the sshd_log says this :
[2014-04-05 18:49:57,365 +0100] c7814142 hudsonu a/12 gerrit.stream-events 0ms 3ms not-admin
 
 
So I tried to confirm that hudsonu was really part of the Non-Interactive Users group (the GUI says so, I just wanna check).
 
$ ssh -p 29418 -i .ssh/id_rsa hudsonu@server gerrit ls-groups
Administrators
Anonymous Users
Non-Interactive Users
Project Owners
Registered Users
 
$ ssh -p 29418 -i .ssh/id_rsa hudsonu@server gerrit ls-members "Non-Interactive Users"
fatal: Too many arguments: Users
 
$ ssh -p 29418 -i .ssh/id_rsa hudsonu@server gerrit ls-members 'Non-Interactive Users'
fatal: Too many arguments: Users
 
$ ssh -p 29418 -i .ssh/id_rsa hudsonu@server gerrit ls-members Non-Interactive\ Users
fatal: Too many arguments: Users
 
There is no way to get the member list of the Non-Interactive Users group, as it contains a space.
This is a first issue.
 
 
Still searching for the root cause of our non-working stream-events, I created a new group "streamers" and made hudsonu member of it.
Then I added the "streamers" group as an allowed group for Stream Events capability.
 
And then it worked : hudsonu was able to call the stream-events command without error message about missing capability 
I also tried to add hudsonu to the Administrator group (after having removed it from the streamers group) and it worked too.
 
I don't know if it is related to the previous bug of "group with spaces" but there is definitely something wrong here.

Gregory
Apr 7, 2014
#1 icee...@googlemail.com
You have to doubly quote strings with spaces (one quote-level is removed by the local shell before ssh).

... ls-members '"Non-Interactive Users"'
... ls-members "Non-Interactive\ Users" 

should both work.
Apr 7, 2014
#2 icee...@googlemail.com
And ls-groups without the -u flag lists all visible groups, not just the groups the user is a member of.
Apr 7, 2014
#3 gregory....@gmail.com
Thanks for your feedback.
I tried and both of your solutions worked.

However, I still don't get why the stream-events capability is not granted to the Non-Interactive Users group whereas it is to another group.

Regards,
Dec 30, 2014
Project Member #4 zaro0508
There was probably a bug in ver 2.8.x.  I have verified, on latest master, that a user in the Non-Interactive Users group has the capability to view stream events.  Anyways the simple workaround is to explicitly grant Non-Interactive Users the stream-events capability.