www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/04/08:01:33

Message-Id: <m0yWJsy-000S3uC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, djgpp AT delorie DOT com
Date: Mon, 4 May 1998 09:06:05 +0000
MIME-Version: 1.0
Subject: Re: fstat and stat in a Novell disk (fstat have a flaw)
References: <m0yUaE7-000S3YC AT inti DOT gov DOT ar>
In-reply-to: <Pine.SUN.3.91.980503173701.19706I-100000@is>

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:

> On Wed, 29 Apr 1998, Salvador Eduardo Tropea (SET) wrote:
> 
> > I have some questions about fstat/stat. I found they work VERY
> > different.
> 
> They are different, indeed.  Neither DOS nor Windows don't let you
> know the full pathname of a file given the handle on which it is open,
> so there's no way these two could do exactly the same.

Is too much overhead to keep such a table? (I mean a libc table with pairs: 
handle/filename) of course it will work only in the program that opens the file 
and not in one that inherits the handles.
 
> I wouldn't use the words ``VERY different'', though.  Is there any
> other difference in the results except the write bit?  If so, please
> tell what other discrepancies did you see.

I just so it because a friend at work said me that my editor reports as 
read-only every file in the Novell disks.
 
> > But when using fstat it
> > uses some SFT(?) table, I don't know what's that, anyways, Novell
> > doesn't support it and hence libc just gives a general description,
> > that means: the file have read access because DOS ever have it, but
> > no write access just in case.
> 
> This is documented behavior, see "info libc alpha fstat", under
> ``Implementation Notes''.  You just cannot get at the file attributes
> under Novell on plain DOS, period.

:-(
 
> >  That's bad for my editor because it detects the files as
> > read-only. I'm using stat because I want to get the program working
> > on UNIX.
> 
> If you use `stat', it should report the file attributes under Novell
> as well; only `fstat' has this problem.

Yes, I saw the sources of stat and I tested stat.
 
> If you cannot use `stat', a work-around would be to just try writing
> to the file, and if you get EACCES, treat it as if the file were not
> writable by the user.

I can use stat.
 
> > Now the question is: why fstat can't use the file attributes to
> > solve it?
> 
> Why don't you ask how does `fstat' succeed to report file attributes at 
> all? 

Because I saw the sources.
 
> There is no DOS call which allows to access file attributes given a
> handle alone, and as I said above, you can't get the file name by its
> handle.  The DJGPP implementation of `fstat' goes out of its way--and
> succeeds--to compute them correctly under DOS and Windows 9X, but it
> fails under Novell versions which bypass DOS file-oriented data
> structures.  You should look at the source code for `fstat' some day,
> to see how hard it is to report Unix-compatible results.
>
> Windows 9X adds a function to report file info given a handle, so on
> Windows `fstat' works correctly (you need the latest `fstat' from Tom
> Demmer's site or from the latest v2.02 alpha, to have this feature, as
> it was only introduced lately).

Under W95 the redirector (to map the Novell disks) is a DLL provided by M$ and 
works VERY well without needing any extra thing. Is just the Novell redirector 
for DOS that's incomplet.

SET 
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


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