comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: if file exist
Date: 27 Sep 2002 18:17:10 -0700
Date: 2002-09-27T18:17:10-07:00	[thread overview]
Message-ID: <yec7kh6ud49.fsf@king.cts.com> (raw)
In-Reply-To: up99ko7dg3e2bd@corp.supernews.com

"Randy Brukardt" <randy@rrsoftware.com> writes:
> steve_H wrote in message
> <8db3d6c8.0209270247.5bf07ae5@posting.google.com>...
> >Robert A Duff <bobduff@shell01.TheWorld.com> wrote in message
> news:<wccadm41jqs.fsf@shell01.TheWorld.com>...
> >
> >> I don't agree that "a general solution is not possible".
> >> A File_Exists return Boolean function makes perfect sense.
> >> Of course it returns False if the file is invisible to the
> >> current process (because it "exists" in an inaccessible directory).
> >> To *this* process, that file does not exist.
> >
> >But the above is not logical. If your function return FALSE, then one
> >does not know if this means the file actually does not exist, or that
> >the function was not able to determine if it exist or not becuase of
> >permission issues.  The user might want to know this.
> 
> That would be a terrible breach of security. Simply that fact that
> something exists can be used as an attack point or a way to transmit
> information. To a process that doesn't have permission to a directory,
> no information whatsover about the file should be available.

I don't think Randy was suggesting that File_Exists should tell you
whether the file exists even if the directory is unreadable.  I think
his point is that a simple Boolean result may not be sufficient.  You
might want at least 3 possible results: file exists; file does not
exist; file may or may not exist but I can't tell you which.

Or you could have a Boolean function that raises an exception if it
can't determine a definitive answer.

The point is, you can't really determine how to answer the question
"Does this file exist?" until you decide what you're going to do with
the answer.

That's probably why the Ada I/O packages don't provide such a
function.  Instead, they let you try to perform an operation on a
file, and handle an exception if the operation fails.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"



  reply	other threads:[~2002-09-28  1:17 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1032687678.1150.comp.lang.ada@ada.eu.org>
2002-09-22  9:58 ` if file exist Preben Randhol
2002-09-22 19:25   ` Keith Thompson
2002-09-22 11:26 ` Dale Stanbrough
2002-09-22 14:45   ` Simon Wright
2002-09-22 17:24     ` Frank J. Lhota
2002-09-22 19:24     ` Keith Thompson
2002-09-22 22:20     ` Dale Stanbrough
2002-09-23  5:14       ` Simon Wright
2002-09-23 12:38         ` Larry Kilgallen
2002-09-26  0:39           ` Nick Roberts
2002-09-26 16:48             ` Warren W. Gay VE3WWG
2002-09-26 22:14               ` Robert A Duff
2002-09-27 10:47                 ` steve_H
2002-09-27 14:01                   ` Robert A Duff
2002-09-27 18:43                   ` Randy Brukardt
2002-09-28  1:17                     ` Keith Thompson [this message]
2002-09-28 13:04                       ` Marin David Condic
2002-09-29  4:50                         ` Keith Thompson
2002-09-29  5:13                           ` Christopher Browne
2002-09-27 21:59                   ` Mark Biggar
2002-09-27 23:09                     ` Larry Kilgallen
2002-10-04 20:56                     ` Stefan Skoglund
2002-10-05 13:59                       ` Robert A Duff
2002-10-06 20:35                         ` Keith Thompson
2002-10-07  0:34                       ` Robert A Duff
2002-10-07  5:42                     ` David Thompson
2002-10-13 17:05                       ` Larry Kilgallen
2002-10-21  2:17                         ` David Thompson
2002-09-22 11:55 ` Per Sandbergs
2002-09-22 22:29 ` SteveD
2002-09-23  1:53   ` if_file_exist : it's working thankyou all! Dominic D'Apice
2002-09-23  5:25     ` Simon Wright
2002-09-23 23:59       ` Dominic D'Apice
2002-09-25 19:13         ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox