[jcifs] Case and Rename.

Michael B.Allen mballen at erols.com
Fri Nov 30 15:48:40 EST 2001


On Thu, 29 Nov 2001 17:56:39 -0800
Rob Wygand <rob at filefish.com> wrote:

> Mike,
> 
> Found a sort of esoteric bug...
> 
> if you try and rename one SmbFile to another SmbFile that differs only 
> by case, the file gets deleted.
> 
> So, as an example:
> 
> 	SmbFile src  = new SmbFile ("smb://server/share/file.txt");
> 	SmbFile dest = new SmbFile ("smb://server/share/File.txt");
> 
> 	src.renameTo (dest);
> 
> Expected behaviour would be for the file to be renamed (such as 
> smbclient does)... Looking at the renameTo function, I see exactly why 
> it does what it does, but, ideally, is should allow the rename through.

Yup. Good catch. This is a bad artifact of case insensitive matching
and my subversion of the Access Denied error that you get if you try
to rename somthing to a name that alread exists. The rename operation
should just be issued to the server which will know it's actually the
same file and do it without returning an Access Denied. The right thing
to do is just *allways* try to do the rename and catch the failure, then
delete and try again ..etc. I'll keep this in mind. Good stuff. Thanks.

Incedentally I was kinda hoping you guys would start using 0.6 and the
new authentication mechanism. Have you tried it yet and if so is it
working out?

Mike

-- 
May The Source be with you.




More information about the jcifs mailing list