Hi eXist developers and users,

I've noticed a problem when using the backup functionality in eXist. Sometimes, but not always, the ownership and permissions stored in the __contents__.xml metadata file, are incorrect. A way to reproduce this is to create an empty xml dcoument in a collection, change the ownership and/or permissions and then backup that collection. Attempting to restore that collection or looking at the contents of the __contents__.xml file, it is clear that the permissions are not backed up correctly.

I've had a look at the code in org/exist/backup/Backup.java and near the start of the method backup(Collection current, BackupWriter output, BackupDialog dialog) I think I've spotted the problem. First of all, if I understand the code correctly, it works with two different arrays - one which contains the resources to backup and another which contains the permissions to backup. IMHO that seems quite dangerous, since there isn't even, as far as I can tell, a way to make sure that these two arrays are synchronized. One must simply assume that the contents are in the same order. Now where it gets really interesting is the point in the method where there is a call to Arrays.sort(resources), without a similar call for the permissions. In other words it seems like effort has been made to make sure that the arrays are not synchronized. I have a very hard time understanding the reason for that.

Anyway, if I remove the offending call to sort, I'm unable to reproduce the bug. I am of course more than willing the submit a patch that removes the offending line, but someone might have some insight into why this was written this way?

Hope this is the correct mailing list, otherwise please point me to the right one.

Thanks for your help.

Kasper Laudrup

ViewWorld Aps.