Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45586 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89146 invoked from network); 17 Sep 2009 12:54:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2009 12:54:22 -0000 Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.226 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 209.85.220.226 mail-fx0-f226.google.com Received: from [209.85.220.226] ([209.85.220.226:47640] helo=mail-fx0-f226.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/F1-13341-A7132BA4 for ; Thu, 17 Sep 2009 08:54:19 -0400 Received: by fxm26 with SMTP id 26so254237fxm.23 for ; Thu, 17 Sep 2009 05:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Q1WajqEXbNizhZeFtdMjGV3ANtX7T74ab0hDVqnvb+g=; b=D9HrKFmTshVRRm/ut1j707KTPD3Iiczs+tmOe6P4FM3HSOCMT2VN59yR3sE5EwgJ4b JjR++ZGWhdOZBCHezVcLNUvJztNZDrML2SjPBry1I+p/Fg17fGlDnMChkKmknIEo7MRp CimFRWK79h4CjAP3P0QSq98iu+7HjtK5tZ/ro= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=nD4TJdhDWuo2k5r7IUacZ4VnZ89GNaQ/K8TTCQRNmvtMZtw9xq/3NHESbrJAkG0bvV 7kiJfmvOBnmLvYdjZYH4GxWyUxBBQ3KDC9J3Jv+I5pMVp7ziqIpbGf6PH/IUQZcPOsh/ d8c/Dy5oZsxf2s9qJ5QETwZbz1SBp6HRPIE88= Received: by 10.86.232.5 with SMTP id e5mr548114fgh.27.1253192055823; Thu, 17 Sep 2009 05:54:15 -0700 (PDT) Received: from ?192.168.1.25? (226.Red-83-51-56.dynamicIP.rima-tde.net [83.51.56.226]) by mx.google.com with ESMTPS id 4sm1492149fgg.8.2009.09.17.05.54.13 (version=SSLv3 cipher=RC4-MD5); Thu, 17 Sep 2009 05:54:14 -0700 (PDT) Message-ID: <4AB23175.1080601@gmail.com> Date: Thu, 17 Sep 2009 14:54:13 +0200 User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Ian Tighe CC: internals@lists.php.net References: <3A8BE18A46C746E69582175E92E503AC@saturn> <4AB221F6.1070504@gmail.com> <1545DFB6BD704A44A4CB7C1B6EF3B5D1@saturn> In-Reply-To: <1545DFB6BD704A44A4CB7C1B6EF3B5D1@saturn> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Detecting share violations over cifs with PHP? Feature request From: keisial@gmail.com (Keisial) 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