Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45587 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91584 invoked from network); 17 Sep 2009 13:11:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2009 13:11:28 -0000 Authentication-Results: pb1.pair.com header.from=ian.tighe@latitude-51.co.uk; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ian.tighe@latitude-51.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain latitude-51.co.uk designates 80.235.207.146 as permitted sender) X-PHP-List-Original-Sender: ian.tighe@latitude-51.co.uk X-Host-Fingerprint: 80.235.207.146 pluto.renegade-hosting.co.uk Received: from [80.235.207.146] ([80.235.207.146:37142] helo=pluto.renegade-hosting.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/62-13341-E7532BA4 for ; Thu, 17 Sep 2009 09:11:27 -0400 Received: from localhost (unknown [127.0.0.1]) by pluto.renegade-hosting.co.uk (Postfix) with ESMTP id A62BCAF03A7; Thu, 17 Sep 2009 13:11:22 +0000 (UTC) X-Virus-Scanned: Scanned by Consulting Ian Tighe @ renegade-hosting.co.uk Received: from pluto.renegade-hosting.co.uk ([127.0.0.1]) by localhost (pluto.renegade-hosting.co.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XaxLPsSOSOep; Thu, 17 Sep 2009 14:11:21 +0100 (BST) Received: from saturn (saturn.renegade-hosting.co.uk [192.168.0.2]) by pluto.renegade-hosting.co.uk (Postfix) with SMTP id 0C362AF014C; Thu, 17 Sep 2009 14:11:21 +0100 (BST) Message-ID: <8EBCCF3B6859465A8B7AFCD8B9459A0C@saturn> To: "Keisial" Cc: References: <3A8BE18A46C746E69582175E92E503AC@saturn> <4AB221F6.1070504@gmail.com> <1545DFB6BD704A44A4CB7C1B6EF3B5D1@saturn> <4AB23175.1080601@gmail.com> Date: Thu, 17 Sep 2009 14:11:21 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5843 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Subject: Re: [PHP-DEV] Detecting share violations over cifs with PHP? Feature request From: ian.tighe@latitude-51.co.uk ("Ian Tighe") Yes readdir was an example and I am saying error reporting is not very good. I am suggesting ( requesting a feature ) that all I/O functions should return better information so we can detect outcomes of I/O - whichever function is used, whatever file system, whatever circumstance. ----- Original Message ----- From: "Keisial" To: "Ian Tighe" Cc: Sent: Thursday, September 17, 2009 1:54 PM Subject: Re: [PHP-DEV] Detecting share violations over cifs with PHP? Feature request > Ian Tighe `wrote: >> 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. > The readdir() system call doesn't have a better error checking. It will > return a null pointer on error, just as on eof. The only way to check if > it had an error is by setting errno to 0 before the call and checking > its status after it. And the reported shouldn't happen anyway, since > they are application errors (passing a bad fd...) not reading problems. > > Perhaps the sharing violation should be reported by stat() instead of > readdir()? > >> 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 > >