Issue Details (XML | Word | Printable)

Key: DIRSERVER-306
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Alex Karasulu
Reporter: Alex Karasulu
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

On modifyRdn server now adds additional Rdn attribute

Created: 27/Jun/05 08:45 PM   Updated: 10/Feb/06 12:34 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File Licensed for inclusion in ASF works ModifyRdnTest.java 2005-08-12 04:33 AM Stefan Zoerner 7 kB
File modRdn.ldif 2005-08-11 10:43 PM Stefan Zoerner 0.6 kB
Text File Licensed for inclusion in ASF works patch_ModifyRdnTest.txt 2005-08-25 09:55 PM Stefan Zoerner 3 kB

Resolution Date: 29/Aug/05 12:55 PM


 Description  « Hide
I changed the name of an entry like ou=Users, dc=example, dc=com to ou=users, dc=example, dc=com which had a single ou=Users. I expected this operation to delete the old attribute rather then just add the new one. This can become a serious issue hence the reason why its a blocker.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alex Karasulu made changes - 09/Aug/05 11:11 AM
Field Original Value New Value
Assignee Alex Karasulu [ akarasulu ] Trustin Lee [ trustin ]
Stefan Zoerner added a comment - 09/Aug/05 05:42 PM
I think it depends on the modify DN operations parameters whether the old RDN value is kept or not.
Example:

--8<--

# create an entry for a person
#
dn: cn=Myra Ellen Amos,ou=system
changetype: add
objectclass: top
objectclass: person
cn: Myra Ellen Amos
sn: Amos
description: an American singer-songwriter

# Change RDN
# old RDN value of cn should continue to be in place
#
dn: cn=Myra Ellen Amos,ou=system
changetype: modrdn
newrdn: cn=Tori Amos
deleteoldrdn: 1

-->8--

The deleteoldrdn may be 0 or 1. 0 keeps the old RDN value, 1 deletes it.
When I apply the above LDIF to a 0.9.1 ApacheDS,

$ ldapmodify -p 10389 -D uid=admin,ou=system -w ***** -f modRdn.ldif
adding new entry cn=Myra Ellen Amos,ou=system
moving cn=Myra Ellen Amos,ou=system to cn=Tori Amos

And the entry of Tori looks like:

dn: cn=Tori Amos,ou=system
sn: Amos
objectclass: person
objectclass: top
cn: Tori Amos
description: an American singer-songwriter

The test with deleteoldrdn=0 works as well.

Trustin Lee made changes - 11/Aug/05 02:16 PM
Status Open [ 1 ] In Progress [ 3 ]
Trustin Lee added a comment - 11/Aug/05 02:30 PM
Stefan,

What happens if user first modifies RDN without deleting old RDN and then modifies RDN again with deleveoldrdn=1?
Should LDAP server delete all RDNs which were not deleted by the first operation in the second operation? What if the new RDN of the second operation was not 'cn' but 'ou' or 'dc'?

Trustin Lee added a comment - 11/Aug/05 02:31 PM
Alex, I tested modifyRN operation with JXplorer, but it looks like it is working OK. Am I getting something wrong?

Stefan Zoerner added a comment - 11/Aug/05 10:43 PM
I have attached an LDIF example for the first case.

I applied it to a test server (IBM Tivoli Directory Server) and the result (after both modrdn) is:

dn: cn=Myra E. Amos,dc=example,dc=com
objectclass: top
objectclass: person
cn: Myra Ellen Amos
cn: Myra E. Amos
sn: Amos
description: an American singer-songwriter

I think behaviour is logical. The first modrdn adds a value to cn and does not delete the old value of the cn.
Therefore, Tori has two values for attribute cn after the first modrdn, one of them forms the rdn "cn=Tori Amos", the other "cn=Myra Ellen Amos" does not (cn allows multiple values).

The second operation adds a new value for cn ("cn=Myra E. Amos"), uses it as the new rdn, and deletes the attribute value of the old rdn ("cn=Tori Amos").
As a consequence, the attribute value "cn=Tori Amos" is gone, but "cn=Myra Ellen Amos", which was not part of the rdn not.

The point here is that cn allows multiple values. Behavior is different otherwise.

Stefan Zoerner made changes - 11/Aug/05 10:43 PM
Attachment modRdn.ldif [ 12311698 ]
Alex Karasulu added a comment - 12/Aug/05 12:25 AM
Let me see if I can whip together a test case to flush out the bug. Also I have to take a look at and process Stefan's comments here. Thanks!

Stefan Zoerner added a comment - 12/Aug/05 04:17 AM
I already have a JNDI test case for the LDIF file above.
Let me check the behaviour against at least two other LDAP servers, then I will file it as an attachment.

Stefan Zoerner added a comment - 12/Aug/05 04:33 AM
Here it is. Not a complete coverage of the mod rdn (still some situations left), but as least the ops of the LDIF are included in the test methods.
I run the JNDI code successfully against OpenLDAP 2.1 and Tivoli DS 5.2. Therefor I am quite sure that the behaviour as describeb with the tests is valid.
In my current build of Apache DS, two of the three methods fail (those who keep the rdn).

Stefan Zoerner made changes - 12/Aug/05 04:33 AM
Attachment ModifyRdnTest.java [ 12311703 ]
Repository Revision Date User Message
ASF #239709 Wed Aug 24 16:46:31 UTC 2005 akarasulu adding stefan's test case from JIRA issue DIREVE-173 here:

http://issues.apache.org/jira/browse/DIREVE-173
Files Changed
ADD /directory/apacheds/trunk/main/src/test/org/apache/ldap/server/ModifyRdnTest.java

Alex Karasulu added a comment - 25/Aug/05 01:45 AM
Looks like your test case is passing here Stefan. This issue appears to be fixed. Thoughts? Trustin, Stefan shall I close this issue?

Alex Karasulu added a comment - 25/Aug/05 01:47 AM
Committed the test cases here on revision 239709:


http://svn.apache.org/viewcvs.cgi?rev=239709&view=rev

Alex Karasulu added a comment - 25/Aug/05 01:48 AM
I'll close this for now but we can reopen it if Trustin you or Stefan still have issues with it.

Alex Karasulu made changes - 25/Aug/05 01:48 AM
Fix Version/s 0.9.2 [ 12310192 ]
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Closed [ 6 ]
Stefan Zoerner added a comment - 25/Aug/05 04:37 AM
I have still a case were it does not work. Unfortunately it is not possible to add the JUnit test to this issue. I guess we have to reopen it first.

Anyway: Basic idea is to have an entry like this:

dn: cn=Tori Amos,ou=system
sn: Amos
cn: Tori Amos
objectclass: person
objectclass: top

Then change the RDN to "sn=Amos" and keep the old one. The result with current ApacheDS is an entry which looks like this:

dn: sn=Amos,ou=system
sn: Amos
sn: Amos
objectClass: person
objectClass: top
cn: Tori Amos

Expected result is that "sn=Amos" does occur once in the entry, not twice.
If someone reopens the issue, I will attach my JUnit test case on this.

Alex Karasulu added a comment - 25/Aug/05 08:20 AM
Reopening issue thanks to Stefan catching the bug. Hopefully his test case addition will help us nail this one down.

Alex Karasulu made changes - 25/Aug/05 08:20 AM
Resolution Fixed [ 1 ]
Status Closed [ 6 ] Reopened [ 4 ]
Alex Karasulu added a comment - 25/Aug/05 08:22 AM
Stefan I added your test case to the svn repo so all you might want to do is attach a patch for it in this existing test case rather than attaching a new test case all together. Thanks Stefan!

Stefan Zoerner added a comment - 25/Aug/05 09:55 PM
Here is a patch for the JUnit test. It includes a new method which still fails with the current Apache DS (change rdn from cn=... to sn=... as described above). This time I resisted to use the cute little patch button in Eclipse and created the file with "svn diff". Therefor I hope the integration should not cause any trouble this time.

Stefan Zoerner made changes - 25/Aug/05 09:55 PM
Attachment patch_ModifyRdnTest.txt [ 12311963 ]
Alex Karasulu added a comment - 26/Aug/05 04:56 AM
Stefan you must have not updated the svn working directory before you generated the patch. All patch chunks seemed to have failed. Please svn up the repo and regenerate the patch. Sorry about having you do this again but looks like I cannot manualy patch the file without screwing something up.

Thanks!

Alex Karasulu made changes - 26/Aug/05 08:46 AM
Assignee Trustin Lee [ trustin ] Alex Karasulu [ akarasulu ]
Repository Revision Date User Message
ASF #264048 Mon Aug 29 03:53:17 UTC 2005 akarasulu Adding Stefan's test case from JIRA issue DIREVE-173 here:

http://issues.apache.org/jira/browse/DIREVE-173

As well as the fix for it. Thanks Stefan!!!!
Files Changed
MODIFY /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java
MODIFY /directory/apacheds/trunk/main/src/test/org/apache/ldap/server/ModifyRdnTest.java

Alex Karasulu added a comment - 29/Aug/05 12:55 PM
Commited fix changes in revision 264048 here along with Stefan's test case patch:

http://svn.apache.org/viewcvs.cgi?view=rev&rev=264048

Looks like a small fix for a big problem.

Alex Karasulu made changes - 29/Aug/05 12:55 PM
Status Reopened [ 4 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Alex Karasulu made changes - 10/Feb/06 12:34 PM
Affects Version/s 0.9.1 [ 11125 ]
Component/s jdbm database [ 11450 ]
Fix Version/s 0.9.2 [ 12310192 ]
Key DIREVE-173 DIRSERVER-306
Project Directory Server [ 10516 ] Directory ApacheDS [ 12310260 ]
Component/s jndi-provider [ 11088 ]