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

2006-06-01 Thread Robert McKay

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/



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

2006-06-01 Thread Igor Peshansky
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 http://cygwin.com/problems.html 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:

 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.
 [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 http://cygwin.com/ml/cygwin/2006-04/msg00316.html,
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.
HTH,
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED]
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:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



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

2006-06-01 Thread Christopher Faylor
On Thu, Jun 01, 2006 at 10:57:30AM +0100, Robert McKay wrote:
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.

Personally, I would be rather concerned if my Windows system started
dropping devices like NUL and I'd wonder what else was wrong with it.
I don't think modifying cygwin to deal with the breakage is really in
your best interest.  I think getting to the bottom of the problem is
what you need to do.  Maybe you have a virus?  Or maybe one of those
system doctor programs will be able to diagonose what's going on.

cgf

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



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

2006-06-01 Thread Lev Bishop

On 6/1/06, Robert McKay wrote:


Does anyone know what can go wrong with the windows NUL device? :-)

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


You could download winobj from sysinternals.com.
Check that \GLOBAL??\NUL is a symbolic link to \Device\Null
Check that \Device\Null exists.
Check the permissions for both (properties, security tab).

HTH
Lev

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