This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bash: /dev/null: No such file or directory. Why is /dev/null implemented using the windows NUL device?

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

Then I found this post:

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.


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

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,


Robert McKay.

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]