Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <42E1389C.4987B945@dessent.net> Date: Fri, 22 Jul 2005 11:19:08 -0700 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Cannot write files if they are hidden References: <42E11E4C DOT 3090406 AT hones DOT org DOT uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Report: -5.9/5.0 ---- Start SpamAssassin results * -3.3 ALL_TRUSTED Did not pass through any untrusted hosts * -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] * 0.0 AWL AWL: From: address is in the auto white-list ---- End SpamAssassin results X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Joe Smith wrote: > I seccond the motion that the windows hidden attribute be ignored. I suspect > that nearly every user on the list has Explorer.exe set to show hidden > files. Sice Cygwin is very useful for system administrators, and they almost > always leave hidden files visable, it makes no sense to treat these files in > any special way. (Assming that cygwin does). Again, as Dave K has been trying to say, Cygwin is not treating the Hidden attribute special in any way. It asks Windows to open the file and if it fails, it fails. You can run strace and see. In the case of "echo something > hiddenfile", this results in an open() with the mode flags set to O_CREAT | O_TRUNC | O_WRONLY, which translates to a call to NtCreateFile() in fhandler_base::open with CreateDisposition set to FILE_OVERWRITE_IF, which returns an error code of 0xC0000022. This NT error status translates into win32 errno 5, or "Access is denied." In the case of "echo something >> hiddenfile", the call to open() has flags O_CREAT | O_APPEND | O_WRONLY which translates into CreateDisposition = FILE_OPEN_IF. This succeeds with return value of 0. So in other words, Windows is fine with opening the file for appending, but not for replacing (truncating) it. There is no special "treat +H files weird" code in Cygwin. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/