www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/04/28/11:46:37

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10204281547.AA25276@clio.rice.edu>
Subject: Re: _open LFN & Win 2K Bug (Was Re: a bug)
To: djgpp-workers AT delorie DOT com
Date: Sun, 28 Apr 2002 10:47:44 -0500 (CDT)
Cc: acottrel AT ihug DOT com DOT au (Andrew Cottrell), eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
In-Reply-To: <10204281438.AA13572@clio.rice.edu> from "Charles Sandmann" at Apr 28, 2002 09:38:55 AM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Specifically, it seems that calling _open() with a name which includes
a wildcard character (*,?) the dos error code returned is not 2 but 
instead is 123 (0x7b) - which we interpret in _doserr_to_errno to be
EFAULT instead of ENOENT.

Win2K seems to return the standard code if what is sent to _open does
not contain a wildcard.

An easy fix would be to change the doserr_to_errno translation table.
I am guessing it has the current translation to support some DOS 
extended OS (?Netware?) since this code shows in my references to be
reserved to Microsoft.

We could modify _open to not call doserr_to_errno and hard code it instead.

Note, my results above show EFAULT (11) while Andrew noted 14 below, which
would be EINVAL - I don't know if this is a typo or a different test 
result.

> Andrew noted:
> > I have traced the problem back to the _open(). If the file does not exist
> > and LFN is set to yes _open() sets the errno to 14 decimal, but if LFN is
> > set to No then _open() sets errno to 22.  It looks like the changes made way
> > back in September last year with _open.c to add Win XP and 2K are not
> > complete.
> > 
> > In a nutshell the problem is that _open() is setting errno to the wrong
> > error code which then causes grep to display the wrong message.
> 
> Thanks for the quick analysis!
> 
> We've seen this before on the rename issue, that the error code from
> Win2K isn't what is expected.  I suspect the DOS error number is something
> really weird - we map those all to EINVAL.  Since I'm responsible for the
> mess known as _open, I'll take a look at it sometime ...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019