[jcifs] Calling length on open file chokes

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Fri Dec 14 12:31:24 EST 2001


> -----Original Message-----
> From:	Rob Wygand [SMTP:rob at filefish.com]
> Sent:	Thursday, December 13, 2001 7:54 PM
> To:	Allen, Michael B (RSCH)
> Cc:	jcifs at samba.org
> Subject:	Re: [jcifs] Calling length on open file chokes
> 
> I sort of agree with you. It is correct that if I wanted to do something 
> invasive to the file, that I should get that exception... but smbclient 
> and even Windows Network Neighborhood allow me to get the length of the 
> file.
> 
	This is because of the Trans2FindFirst/Next thing ... see next message...

> Also, isDirectory() and isFile() both return false... I assume this is 
> related?
> 
	For pagefile.sys? Actually I think the appropriate behavior here would be to throw the exception if the result cannot be determined. Looks like it's catching that and just returning false.

	This kind of stuff is still up in the air a little because we have introduced a new dimension with throwing exceptions. Feel free to express your opinions and argue about how these methods
should behave.

> rjw
> 
> Allen, Michael B (RSCH) wrote:
> 
> > Mmm. I thought this would go away with the shareAccess change in SmbComNTCreateAndX. Unfourtunately this particular file is opened by the Win32 Kernel which I guess uses a very restrictive
> > ShareAccess. The SMB_COM_QUERY_INFORMATION command is correctly getting the "File is being accessed by another process". smbclient uses the Trans2FindFirst2/Next2 commands. I'll see if there's a
> way
> > to handle this a little more elegantly but I don't think so. Technically the "file is being accessed by another processes" business is correct; you shouldn't be querying that file. This is another
> yet
> > another reason to implement listFiles().
> > 
> > Mike
> > 
> > 
> >>-----Original Message-----
> >>From:	Rob Wygand [SMTP:rob at filefish.com]
> >>Sent:	Thursday, December 13, 2001 6:35 PM
> >>To:	jcifs at samba.org
> >>Subject:	[jcifs] Calling length on open file chokes
> >>
> >>Mike,
> >>
> >>Another little oddity, and this was also in 0.5.
> >>
> >>If I can length() is a file that is open by another process, I get an 
> >>exception (the file is in use by another process). I see this all the 
> >>time when 'browsing' pagefile.sys. It should be possible to read the 
> >>attrs of a file, even if another process has a write lock on it, no?
> >>
> >>I tested this with smbclient, and that returns the right file length...
> >>
> >>rjw
> >>
> >>
> >>
> > 
> 
> 





More information about the jcifs mailing list