| delorie.com/archives/browse.cgi | search |
| 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 <Christian DOT Franke AT t-online DOT de> |
| 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 |
| 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: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |