This is the mail archive of the cygwin@cygwin.com 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: Errors when trying to access /dev/null


On Thu, Oct 16, 2003 at 06:49:47AM -0400, Sandy Pyke wrote:
> Yeah, gotta admit of all things I never thought 'null' would give me a
> problem. Guess you can say I got a problem with nothing...

Yeah, obviously :-)

> As I've mentioned, I have been able to get this working on another machine.
> I took a backup of my cygwin directory there and dumped it on my machine
> here at home where I'm having the problem. Everything seemed to work okay
> except for null again. I'm starting to think my problem is in the windows
> configuration of my machine.

It really seems so.  Please notice that the POSIX device /dev/null is
translated into the Windows device nul.  And Cygwin is doing that quite
nicely, just...  but see yourself.  This is an extract from you below strace:

  63  159863 [main] bash 284 fhandler_base::open: (nul, 0x601) query_open 0
  154  160017 [main] bash 284 seterrno_from_win_error:/netrel/src/cygwin-1.5.5-1/winsup/cygwin/fhandler.cc:478 windows error 2
  69  160086 [main] bash 284 geterrno_from_win_error: windows error 2 == errno 2
  63  160149 [main] bash 284 fhandler_base::open: 0 = fhandler_base::open (nul, 0x601)

That's really weird.  Trying to open the Windows "nul" device returns
actually an error 2 on your machine:

  $ net helpmsg 2

  The system cannot find the file specified.

On my machine, the same code produces the below strace:

  22   58641 [main] bash 1960 fhandler_base::open: (nul, 0x601) query_open 0
  73   58714 [main] bash 1960 fhandler_base::open: 0x6EC = CreateFile (nul, 0x40000000, 0x7, 0x22F880, 0x2, 0x80, 0)
  26   58740 [main] bash 1960 fhandler_base::set_flags: flags 0x601, supplied_bin 0x10000
  21   58761 [main] bash 1960 fhandler_base::set_flags: filemode set to binary
  19   58780 [main] bash 1960 fhandler_base::open: 1 = fhandler_base::open (nul, 0x601)

> Guess I could format the old HD and start over with a fresh install, but
> that seems a little radical...

Yes, that seems radical.  And the next step is to buy a new PC ;-)

However, the above effect is pretty weird.  Is it possible (don't laugh)
that the nul device is broken on your machine?  Actually there's a driver
${windir}/system32/drivers/null.sys which manages that device.  Or an
even worse scenario:  Do you (well, your machine) have some bad virus?
So far, I have no other idea :-(

> Or I may just replace the calls to /dev/null
> in my configure script with something like /null and let it go to a file
> instead.

That's not really a solution.  That won't make you happy in the long run.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

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


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