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]

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

On Thu, 1 Jun 2006, Robert McKay wrote:

> I've got rather an annoying/frustrating problem with cygwin 2.510.2.2

First off, that is not your version of Cygwin -- it's the version of setup
you used to install it.  Please read the Cygwin problem reporting
guidelines at <> for instructions on
reporting the versions of various parts of your Cygwin installation.

> 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
> [snip]
> 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:
> 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.
> [snip]
> 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? :-)

Try asking on a Microsoft forum.

> Do you need any kind of special permissions to use NUL?

Not usually.

> I've tried rebooting, logging out logging back in, re-installing
> cygwin many times but still no joy.

None of these actions are likely to restore NUL.  Reinstalling Cygwin was
particularly futile, as Cygwin doesn't do anything to the underlying
Windows configuration.

> 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.

If you've found the embedded Windows thread from last year, you must've
seen the footnote in <>,
which tells you how to do it.  I suggest you read the rest of the thread,
however.  For one, you may not be able to redirect output from Windows
programs to /dev/null after that change.  Also, you will then have to live
with essentially your own branch of Cygwin, unsupported on this list.
      |\      _,,,---,,_ |
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

Unsubscribe info:
Problem reports:

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