Hi ,
I am using readdir with a view to selecting files for opening and reading or just taking a stat of them. I am doing this recursively. I test the output from readdir to see if its a file or dir or link etc and this works well. This suddenly changes though and an item is returned by readdir (that is a filename) but its type cannot be determined - it is not of any type at all! So looking at a wireshark trace revealed there had been a sharing violation but I was blissfully unaware of this.

I am seeking to have such an error condition made available so that ANY i/o op can be tested not just for true or false but to further establish the i/o outcome and hence track sharing violations amongst other errors. Apart from the type issue above, my substantive point about readdir was this: If I get a false reply I am not sure if I had a failed i/o operation or I had come to the end of a directory list. As far as I can see ( and I may be wrong of course ) there is for PHP no difference between the two but the impact is significantly different. It was more to demonstrate that error reporting is fairly clumsy in these circumstances.

It is certainly true all the files I have seen so far that cause this problem related to either iTunes or Microsoft - especially internet explorer 8 recovery files. It must be they are exclusively locked and any attempt by my software makes to read them brings about a violation which cannot be detected, cannot be recovered from and thus not handled by me.

I cannot reliably repeat it as I can barely detect it other than my software will carry on looking for files and directories and not being able to recognise types and actions I wanted are not carried out. I have a wireshark trace of the smb protocol exchanges if that helps but it basically says trans2 query path request, trans2 query path response , create_andx request (which is probably a stat), which is retried several times and finally a create andx response indicating a sharing violation. If I could get hold of that in PHP I could react.............
Thanks
Ian

----- Original Message ----- From: "Keisial" <keis...@gmail.com>
To: "Ian Tighe" <ian.ti...@latitude-51.co.uk>; <internals@lists.php.net>
Sent: Thursday, September 17, 2009 12:48 PM
Subject: Re: [PHP-DEV] Detecting share violations over cifs with PHP? Feature request


Ian Tighe wrote:
Hi. I hope this has been sent to the right place.
I am using files that are mount.cif share files. My client is a samba linux box but acting as a client over cifs to an XP box (several in fact). I am descending the share recursively with opendir and readdir detecting files ( and of course directories ) before doing my processing. I note from a wireshark trace I am getting errors - sharing violations reported by XP. I would very much like to detect these events to take action - ignore the file for instance - but right now I have a true or false return from readdir, is_dir, is_file or is_link which is not very helpful during a fault condition such as a sharing violation. In other words a sharing violation looks like a readdir saying no more files!

It seems that once the error condition comes about all my reads of a directory and tests of file types fail until I reach the end of that directory and all of its parent directories. This is not so good.

Am I missing a trick here? If not is it possible to bring out more error information so that I can detect these events. An error array as an additional overloaded argument to readdir, opendir (indeed any I/O) where the first element has the normal true/false perhaps but a second element has a return code for smb/cifs/file_system failure/error/warning condition?

Thanks

Ian

What are you doing that triggers that error? I would expect a sharing
violation to be related to trying to read/write files opened exclusively
by other program, not by traversing a directory tree. Do you know how to
reproduce it?




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to