X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <4877BD14.5000708@t-online.de> Date: Fri, 11 Jul 2008 22:05:40 +0200 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071128 SeaMonkey/1.1.7 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: CoPy to /dev/null fails Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: Exr1XqZDZh+9EHMeZdqxOp3ObxFxKYic6SaeoVGCn+J2NM4doYhzs0xtgjTyRcgwgn X-TOI-MSGID: a6b1176b-39d9-47e8-bb15-0f505bccf09b X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Hi, this works on Linux: $ cp file /dev/null but fails on Cygwin 1.5.25-15: $ cp file /dev/null cp: cannot create regular file `/dev/null': Invalid request code /dev/null exists, so /bin/cp opens it with O_TRUNC only. But this fails with EBADRQC (54): fd = open("/dev/null", O_WRONLY|O_TRUNC, .) According to strace, Cygwin calls: h = CreateFile("NUL", ., ., TRUNCATE_EXISTING, ., .); which fails. Interestingly, this works: fd = open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, .); Cygwin calls: h = CreateFile("NUL", ., ., CREATE_ALWAYS, ., .); Apparently a subtle (and IMO undocumented) difference between TRUNCATE_EXISTING and CREATE_ALWAYS even when file exists. Christian -- 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/