On Tue, Jan 26, 2016 at 8:16 PM, sebb <[email protected]> wrote:
> The json file https://whimsy.apache.org/public/public_ldap_groups.json
> is causing a problem, because one of the roster entries is a null:
>
> "db-site": {
> "modifyTimestamp": "20100210202350Z",
> "roster": [
> null
> ]
> },
>
> It should be empty.
>
> The loop that creates the entry is:
>
> groups.keys.sort_by {|a| a.name}.each do |entry|
> m = []
> entry.members.sort_by {|a| a.name}.each do |e|
> m << e.name
> end
> lastStamp = entry.modifyTimestamp if entry.modifyTimestamp > lastStamp
> entries[entry.name] = {
> modifyTimestamp: entry.modifyTimestamp,
> roster: m
> }
> end
>
> To try and debug the code, I tried only processing some of the keys.
> Of course then the code worked.
> Eventually I found that the 'committers' entry is the culprit.
> If one skips the loop body for that entry, then db-site is output correctly.
>
> Any idea why the db-site members field appears to be being corrupted?
> It looks like something is generating a Person entry with a null name
> and storing it in the db-site members field.
> Perhaps an issue with the LazyHash?
I don't know about committers, but I'm seeing a problem with db-site,
all by itself without any program wrapped around it:
$ ruby -r whimsy/asf -e "p ASF::Group.find('db-site').members"
[#<ASF::Person:0x00000002722ea8 @name=nil>]
$ ruby -r whimsy/asf -e "p ASF.search_one(ASF::Group.base,
'cn=db-site', 'memberUID')"
[nil]
Possible fixes:
(1) in public_ldap_groups.rb:
m << e.name if e.name
(2) in asf/ldap.rb, method ASF::Group.list:
ASF.search_one(base, filter, 'cn').flatten.compact.map {|cn| find(cn)}
- Sam Ruby