From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6482d0ae6dcb1b4c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-27 18:17:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!enews.sgi.com!sdd.hp.com!usc.edu!newspeer.cts.com!galanthis.cts.com!127.0.0.1.MISMATCH!not-for-mail Sender: kst@king.cts.com Newsgroups: comp.lang.ada Subject: Re: if file exist References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> From: Keith Thompson Date: 27 Sep 2002 18:17:10 -0700 Message-ID: X-Newsreader: Gnus v5.7/Emacs 20.7 NNTP-Posting-Host: 209.68.192.180 X-Trace: 1033175830 nntp.cts.com 324 209.68.192.180 Xref: archiver1.google.com comp.lang.ada:29395 Date: 2002-09-27T18:17:10-07:00 List-Id: "Randy Brukardt" writes: > steve_H wrote in message > <8db3d6c8.0209270247.5bf07ae5@posting.google.com>... > >Robert A Duff wrote in message > news:... > > > >> 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 San Diego Supercomputer Center <*> Schroedinger does Shakespeare: "To be *and* not to be"