X-Spam-Check-By: sourceware.org Message-ID: Date: Thu, 1 Jun 2006 10:57:30 +0100 From: "Robert McKay" To: cygwin AT cygwin DOT com Subject: bash: /dev/null: No such file or directory. Why is /dev/null implemented using the windows NUL device? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Disposition: inline X-Google-Sender-Auth: a1798ab11c3e00f5 X-IsSubscribed: yes 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 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k519veVx008498 I've got rather an annoying/frustrating problem with cygwin 2.510.2.2 on WinXP [Version 5.1.2600]. It was working fine last friday but over the weekend gremlins have broken my /dev/null. $ echo > /dev/null bash: /dev/null: No such file or directory $ ls -l /dev/null crw-rw-rw- 1 mckayr1 mkpasswd 1, 3 Jun 1 10:35 /dev/null $ rm /dev/null rm: cannot remove `/dev/null': No such file or directory $ mknod /dev/null c 1 3 mknod: `/dev/null': File exists $ mknod /tmp/null c 1 3 $ ls -l /tmp/null crw-rw-rw- 1 mckayr1 mkpasswd 1, 3 Jun 1 10:36 /tmp/null $ echo > /tmp/null bash: /tmp/null: No such file or directory $ echo > /dev/zero $ $ dd if=/dev/zero of=file count=10 10+0 records in 10+0 records out 5120 bytes (5.1 kB) copied, 0.02 seconds, 256 kB/s $ ls -l file -rw-rw-rw- 1 mckayr1 mkpasswd 5120 Jun 1 10:39 file I found a few similar references to this issue in the mailing list archives, however there it was happening to people running on embedded windows. Then I found this post: http://www.cygwin.com/ml/cygwin/2003-10/msg01017.html which shed some light on what might be the issue. Cygwin /dev/null is implemented on top of the windows NUL device. Sure enough when I try this from cmd.exe : Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\>dir > NUL The system cannot find the file specified. C:\> Now I can't say for sure that this was working on friday, but I got a few other people to try the same thing and they don't get that "The system cannot find the file specified" message (ie: for them it works as you would expect): C:\>dir > NUL C:\> I don't have any idea why or how my NUL device has stopped working so I suppose my first question to the list is somewhat offtopic : Does anyone know what can go wrong with the windows NUL device? :-) Do you need any kind of special permissions to use NUL? I've tried rebooting, logging out logging back in, re-installing cygwin many times but still no joy. I guess my next question is.. how hard would it be to simply replace the cygwin /dev/null with one that doesn't use the NUL device? If I could remove the /dev/null device and replace it with a second /dev/zero device that would probably fix 99% of my problems as most things are only trying to write to /dev/null, not read from it. If I could write my own /dev/null device that just implemented a couple of do-nothing read/write syscalls without using the windows NUL service that would be even better. Any suggestions appreciated, Sincerely, Robert McKay. -- 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/