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-22 02:58:43 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!129.240.148.23!uio.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: if file exist Date: Sun, 22 Sep 2002 09:58:42 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: NNTP-Posting-Host: kiuk0152.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1032688722 3874 129.241.83.78 (22 Sep 2002 09:58:42 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Sun, 22 Sep 2002 09:58:42 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:29248 Date: 2002-09-22T09:58:42+00:00 List-Id: On Sat, 21 Sep 2002 21:10:34 -0400, Dominic D'Apice wrote: > This is a multi-part message in MIME format. If you are going to poste questions on news then turn off HTML etc and post text only! > > ------=_NextPart_000_0001_01C261B3.5397E920 > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: 7bit > > Hello all, > > How can i know if a text file exist ? > > I mean : > > Procedure IF_FILE_EXIST is > Begin > . > end IF_FILE_EXIST; > > > thank in advance > Dominic > > ------=_NextPart_000_0001_01C261B3.5397E920 > Content-Type: text/html; > charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > xmlns:w=3D"urn:schemas-microsoft-com:office:word" = > xmlns=3D"http://www.w3.org/TR/REC-html40"> > > > charset=3Dus-ascii"> > > > > > > > > > > > > style=3D'tab-interval:35.4pt'> > >
> >

style=3D'font-size:10.0pt; > font-family:Arial'>Hello all,

> >

style=3D'font-size:10.0pt; > font-family:Arial'> 

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'>How can i know if a = > text file >exist ?

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'> >

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'>I class=3DGramE>mean : >

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'> >

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'>Procedure = > IF_FILE_EXIST is

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'>Begin= >

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'>… n>

> >

face=3DArial> style=3D'font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-CA'>end<= > /span> size=3D2 face=3DArial> style=3D'font-size:10.0pt;font-family:Arial; > mso-ansi-language:EN-CA'> IF_FILE_EXIST;

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'> >

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'> >

> >

face=3DArial> style=3D'font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-CA'>than= > k size=3D2 face=3DArial> style=3D'font-size:10.0pt;font-family:Arial; > mso-ansi-language:EN-CA'> in advance

> >

style=3D'font-size: > 10.0pt;font-family:Arial;mso-ansi-language:EN-CA'>Dominic n>

> >
> > > > > > ------=_NextPart_000_0001_01C261B3.5397E920-- > 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-22 04:26:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!intgwpad.nntp.telstra.net!news.telstra.net!news-server.bigpond.net.au!not-for-mail From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: if file exist Organization: RMIT References: User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X) Message-ID: Date: Sun, 22 Sep 2002 11:26:36 GMT NNTP-Posting-Host: 144.132.47.50 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 1032693996 144.132.47.50 (Sun, 22 Sep 2002 21:26:36 EST) NNTP-Posting-Date: Sun, 22 Sep 2002 21:26:36 EST Xref: archiver1.google.com comp.lang.ada:29250 Date: 2002-09-22T11:26:36+00:00 List-Id: In article , "Dominic D'Apice" wrote: > Hello all, > > How can i know if a text file exist ? > > I mean : > > Procedure IF_FILE_EXIST is > Begin > . > end IF_FILE_EXIST; Ask the operating system? Another way is to attempt to open the file. If it opens successfully then it exists. BTW you may have a problem as after you get the answer the file may have been created/no longer exist. This will of course depend on your environment. Dale 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-22 12:24:37 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: From: Keith Thompson Date: 22 Sep 2002 12:24:35 -0700 Message-ID: X-Newsreader: Gnus v5.7/Emacs 20.7 NNTP-Posting-Host: 209.68.192.180 X-Trace: 1032722675 nntp.cts.com 324 209.68.192.180 Xref: archiver1.google.com comp.lang.ada:29262 Date: 2002-09-22T12:24:35-07:00 List-Id: Simon Wright writes: > Dale Stanbrough writes: > > Ask the operating system? Another way is to attempt to open > > the file. If it opens successfully then it exists. > > and is readable (assuning you tried to open it for read!). It might > exist and not be readable, in which case this test would fail. Or, even if the file exists and is readable, the open might fail for any number of reasons depending on the OS. For example, in an OS that distinguishes between binary and text files, using Text_IO.Open on a binary file might fail. (Then again, in such an OS, knowing whether a file exists might not be all that useful.) -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> Schroedinger does Shakespeare: "To be *and* not to be" 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-22 12:25:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!ihnp4.ucsd.edu!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: From: Keith Thompson Date: 22 Sep 2002 12:25:46 -0700 Message-ID: X-Newsreader: Gnus v5.7/Emacs 20.7 NNTP-Posting-Host: 209.68.192.180 X-Trace: 1032722746 nntp.cts.com 324 209.68.192.180 Xref: archiver1.google.com comp.lang.ada:29263 Date: 2002-09-22T12:25:46-07:00 List-Id: Preben Randhol writes: > On Sat, 21 Sep 2002 21:10:34 -0400, Dominic D'Apice wrote: > > This is a multi-part message in MIME format. > > If you are going to poste questions on news then turn off HTML etc and > post text only! [...] If you're going to complain about someone posting HTML, please don't quote the whole thing. -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> Schroedinger does Shakespeare: "To be *and* not to be" 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-22 04:55:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!195.54.122.107!newsfeed1.bredband.com!bredband!newsspool1.bredband.com!news1.bredband.com.POSTED!not-for-mail From: "Per Sandbergs" Newsgroups: comp.lang.ada References: Subject: Re: if file exist X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Sun, 22 Sep 2002 13:55:24 +0200 NNTP-Posting-Host: 213.114.165.252 X-Complaints-To: news-abuse@bredband.com X-Trace: news1.bredband.com 1032695707 213.114.165.252 (Sun, 22 Sep 2002 13:55:07 CEST) NNTP-Posting-Date: Sun, 22 Sep 2002 13:55:07 CEST Organization: A customer of B2 Bredbandsbolaget (www.bredband.com) Xref: archiver1.google.com comp.lang.ada:29251 Date: 2002-09-22T13:55:24+02:00 List-Id: Well if you are using a modern GNAT you may use function Is_Regular_File in package GNAT.Os_Lib /Per Sandberg "Dominic D'Apice" wrote in message news:mailman.1032687678.1150.comp.lang.ada@ada.eu.org... Hello all, How can i know if a text file exist ? I mean : Procedure IF_FILE_EXIST is Begin . end IF_FILE_EXIST; thank in advance Dominic 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-22 08:03:23 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: if file exist Date: 22 Sep 2002 15:45:52 +0100 Organization: Pushface Sender: simon@smaug Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1032707003 3103 62.49.19.209 (22 Sep 2002 15:03:23 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sun, 22 Sep 2002 15:03:23 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:29257 Date: 2002-09-22T15:45:52+01:00 List-Id: Dale Stanbrough writes: > Ask the operating system? Another way is to attempt to open > the file. If it opens successfully then it exists. and is readable (assuning you tried to open it for read!). It might exist and not be readable, in which case this test would fail. 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=2.2 required=5.0 tests=BAYES_00,FROM_WORDY, REPLYTO_WITHOUT_TO_CC autolearn=no 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-22 10:24:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!feed2.news.rcn.net!feed1.news.rcn.net!rcn!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada Subject: Re: if file exist Date: Sun, 22 Sep 2002 13:24:09 -0400 Message-ID: References: Reply-To: "Frank J. Lhota" X-Trace: UmFuZG9tSVZWmeGjBWfarz1ZFNmF+eSA2exNviT9NEdobGEh2xlGolX/ho8Stdx8 X-Complaints-To: abuse@rcn.com NNTP-Posting-Date: 22 Sep 2002 17:23:56 GMT X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Priority: 3 X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MSMail-Priority: Normal Xref: archiver1.google.com comp.lang.ada:29258 Date: 2002-09-22T17:23:56+00:00 List-Id: "Simon Wright" wrote in message news:x7vd6r6rskf.fsf@pushface.org... > Dale Stanbrough writes: > > > Ask the operating system? Another way is to attempt to open > > the file. If it opens successfully then it exists. > > and is readable (assuning you tried to open it for read!). It might > exist and not be readable, in which case this test would fail. Absolutely true. There is a proposal for a directory I/O package for inclusion in Ada 0x, and that would be the ideal solution. 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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no 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-22 18:53:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "Dominic D'Apice" Newsgroups: comp.lang.ada Subject: if_file_exist : it's working thankyou all! Date: Sun, 22 Sep 2002 21:53:04 -0400 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1032745981 18017 137.194.161.2 (23 Sep 2002 01:53:01 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 23 Sep 2002 01:53:01 +0000 (UTC) Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:29270 Date: 2002-09-22T21:53:04-04:00 Well, it's working good ! -- verifie si un fichier existe procedure si_fic_existe (fichier : out ada.text_io.file_type ; mod_fic_ecr : in ada.text_io.file_mode ; nom_fic : in string ) is begin ada.text_io.open (fichier,mod_fic_lec,nom_fic); ada.text_io.close(fichier); raise sortir_program_principal; exception when ada.text_io.name_error => null; end si_fic_existe; -----Original Message----- From: comp.lang.ada-admin@ada.eu.org [mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of SteveD Sent: 22 septembre, 2002 18:29 To: comp.lang.ada@ada.eu.org Subject: Re: if file exist >"Dominic D'Apice" wrote in message >news:mailman.1032687678.1150.comp.lang.ada@ada.eu.org... >Hello all, > >How can i know if a text file exist ? > >I mean : > >Procedure IF_FILE_EXIST is >Begin >. >end IF_FILE_EXIST; > How about something along the lines of: Pseudo code: Procedure IF_FILE_EXIST is begin open the existing file close the file return true; exception when the exception occurs that is associated with a file not present => return false; end IF_FILE_EXIST; I hope this helps (I hope it works too!) SteveD >thank in advance >Dominic _______________________________________________ comp.lang.ada mailing list comp.lang.ada@ada.eu.org http://ada.eu.org/mailman/listinfo/comp.lang.ada 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-22 15:20:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!intgwpad.nntp.telstra.net!news.telstra.net!news-server.bigpond.net.au!not-for-mail From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: if file exist Organization: RMIT References: User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X) Message-ID: Date: Sun, 22 Sep 2002 22:20:09 GMT NNTP-Posting-Host: 144.132.47.50 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 1032733209 144.132.47.50 (Mon, 23 Sep 2002 08:20:09 EST) NNTP-Posting-Date: Mon, 23 Sep 2002 08:20:09 EST Xref: archiver1.google.com comp.lang.ada:29266 Date: 2002-09-22T22:20:09+00:00 List-Id: Simon Wright wrote: > and is readable (assuning you tried to open it for read!). It might > exist and not be readable, in which case this test would fail. No, my test will succeed in that -if- it exists, and -if- it opens successfully, then it does exist. I said nothing about other conditions. Dale 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-22 15:29:21 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp-server.caltech.edu!attla2!ip.att.net!attbi_feed3!attbi_feed4!attbi.com!sccrnsc02.POSTED!not-for-mail From: "SteveD" Newsgroups: comp.lang.ada References: Subject: Re: if file exist X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: NNTP-Posting-Host: 12.225.227.101 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc02 1032733750 12.225.227.101 (Sun, 22 Sep 2002 22:29:10 GMT) NNTP-Posting-Date: Sun, 22 Sep 2002 22:29:10 GMT Organization: AT&T Broadband Date: Sun, 22 Sep 2002 22:29:10 GMT Xref: archiver1.google.com comp.lang.ada:29267 Date: 2002-09-22T22:29:10+00:00 List-Id: >"Dominic D'Apice" wrote in message >news:mailman.1032687678.1150.comp.lang.ada@ada.eu.org... >Hello all, > >How can i know if a text file exist ? > >I mean : > >Procedure IF_FILE_EXIST is >Begin >. >end IF_FILE_EXIST; > How about something along the lines of: Pseudo code: Procedure IF_FILE_EXIST is begin open the existing file close the file return true; exception when the exception occurs that is associated with a file not present => return false; end IF_FILE_EXIST; I hope this helps (I hope it works too!) SteveD >thank in advance >Dominic 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-22 22:32:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: if file exist Date: 23 Sep 2002 06:14:38 +0100 Organization: Pushface Sender: simon@smaug Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1032759139 16890 62.49.19.209 (23 Sep 2002 05:32:19 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 23 Sep 2002 05:32:19 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:29271 Date: 2002-09-23T06:14:38+01:00 List-Id: Dale Stanbrough writes: > Simon Wright wrote: > > > and is readable (assuning you tried to open it for read!). It might > > exist and not be readable, in which case this test would fail. > > No, my test will succeed in that -if- it exists, and -if- it > opens successfully, then it does exist. > I said nothing about other conditions. No, but you introduced the feature that the file must be readable; which was not in the original poster's requirements. 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-22 22:43:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: if_file_exist : it's working thankyou all! Date: 23 Sep 2002 06:25:50 +0100 Organization: Pushface Sender: simon@smaug Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1032759811 16890 62.49.19.209 (23 Sep 2002 05:43:31 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 23 Sep 2002 05:43:31 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:29272 Date: 2002-09-23T06:25:50+01:00 List-Id: "Dominic D'Apice" writes: > Well, it's working good ! > > -- verifie si un fichier existe > procedure si_fic_existe (fichier : out ada.text_io.file_type > ; > mod_fic_ecr : in ada.text_io.file_mode > ; nom_fic : in string > ) is > begin > > ada.text_io.open (fichier,mod_fic_lec,nom_fic); > ada.text_io.close(fichier); > raise sortir_program_principal; > exception when ada.text_io.name_error => null; > > end si_fic_existe; Why are you passing fichier in, since you exit with it closed (the file didn't exist) or indeterminate (if it did)? Do you think a local variable would be more appropriate? By the way, if you check the ARM in Annex A (A.13) you will find The exception Name_Error is propagated by a call of Create or Open if the string given for the parameter Name does not allow the identification of an external file. For example, this exception is propagated if the string is improper, or, alternatively, if either none or more than one external file corresponds to the string. 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-23 04:38:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!chcgil2-snf1.gtei.net!news.gtei.net!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: if file exist Date: 23 Sep 2002 06:38:22 -0600 Organization: LJK Software Message-ID: References: NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1032779605 22467 192.135.80.34 (23 Sep 2002 11:13:25 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Mon, 23 Sep 2002 11:13:25 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:29273 Date: 2002-09-23T06:38:22-06:00 List-Id: In article , Simon Wright writes: > Dale Stanbrough writes: > >> Simon Wright wrote: >> >> > and is readable (assuning you tried to open it for read!). It might >> > exist and not be readable, in which case this test would fail. >> >> No, my test will succeed in that -if- it exists, and -if- it >> opens successfully, then it does exist. >> I said nothing about other conditions. > > No, but you introduced the feature that the file must be readable; > which was not in the original poster's requirements. On some operating systems the existence of a file for which the user lacks read permission cannot be detected. A general solution for detecting unreadable files is not possible. 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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no 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-23 17:00:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "Dominic D'Apice" Newsgroups: comp.lang.ada Subject: RE: if_file_exist : it's working thankyou all! Date: Mon, 23 Sep 2002 19:59:03 -0400 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1032825604 21534 137.194.161.2 (24 Sep 2002 00:00:04 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 24 Sep 2002 00:00:04 +0000 (UTC) Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal In-Reply-To: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:29296 Date: 2002-09-23T19:59:03-04:00 The thing is i would like to verify if the file exist ; 1- try to open the file if file not there then it goes to exception (AT THE END OF THE PROCEUDRE and it do nothing (null;) => that what I want BUT 2-If file there then Close it AND RAISE THE REAL EXEPTION (LOCATED IN MAIN PROGRAM, MEANS THAT THE FILE EXIT... Well, may I don't understand , what you tell.. Dominic -----Original Message----- From: comp.lang.ada-admin@ada.eu.org [mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of Simon Wright Sent: 23 septembre, 2002 01:26 To: comp.lang.ada@ada.eu.org Subject: Re: if_file_exist : it's working thankyou all! "Dominic D'Apice" writes: > Well, it's working good ! > > -- verifie si un fichier existe > procedure si_fic_existe (fichier : out ada.text_io.file_type > ; > mod_fic_ecr : in ada.text_io.file_mode > ; nom_fic : in string > ) is > begin > > ada.text_io.open (fichier,mod_fic_lec,nom_fic); > ada.text_io.close(fichier); > raise sortir_program_principal; > exception when ada.text_io.name_error => null; > > end si_fic_existe; Why are you passing fichier in, since you exit with it closed (the file didn't exist) or indeterminate (if it did)? Do you think a local variable would be more appropriate? By the way, if you check the ARM in Annex A (A.13) you will find The exception Name_Error is propagated by a call of Create or Open if the string given for the parameter Name does not allow the identification of an external file. For example, this exception is propagated if the string is improper, or, alternatively, if either none or more than one external file corresponds to the string. _______________________________________________ comp.lang.ada mailing list comp.lang.ada@ada.eu.org http://ada.eu.org/mailman/listinfo/comp.lang.ada 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-25 12:30:52 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: if_file_exist : it's working thankyou all! Date: 25 Sep 2002 20:13:07 +0100 Organization: Pushface Sender: simon@smaug Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1032982251 29298 62.49.19.209 (25 Sep 2002 19:30:51 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Wed, 25 Sep 2002 19:30:51 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:29333 Date: 2002-09-25T20:13:07+01:00 List-Id: "Dominic D'Apice" writes: Dominic, I would find it much easier to try to help you if you would put your comments _after_ the part of my message that you are responding to. As I have done in this article. Indeed, I had to read to the end before I found out it was my article you were replying to. So you nearly didn't get a reply at all (of course, you may not care!) > The thing is i would like to verify if the file exist ; > > 1- try to open the file > > if file not there then it goes to exception (AT THE END OF THE > PROCEUDRE and it do nothing (null;) => that what I want > > BUT > > 2-If file there then > > Close it AND RAISE THE REAL EXEPTION (LOCATED IN MAIN PROGRAM, MEANS > THAT THE FILE EXIT... I understood that .. > Well, may I don't understand , what you tell.. This is your code (slightly reformatted): procedure si_fic_existe (fichier : out ada.text_io.file_type; mod_fic_ecr : in ada.text_io.file_mode; nom_fic : in string) is begin ada.text_io.open (fichier,mod_fic_lec,nom_fic); ada.text_io.close (fichier); raise sortir_program_principal; exception when ada.text_io.name_error => null; end si_fic_existe; and I'm suggesting that this would be even more useful: procedure si_fic_existe (nom_fic : in String; mod_fic_ecr : in ada.text_io.file_mode) is fichier : ada.text_io.file_type; begin ada.text_io.open (fichier, mod_fic_lec, nom_fic); ada.text_io.close (fichier); raise sortir_program_principal; exception when ada.text_io.name_error => null; end si_fic_existe; because you aren't asking your caller to supply a variable (fichier) which is of no use to him after your procedure has returned. -S 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-25 17:38:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!fu-berlin.de!uni-berlin.de!pc-62-31-50-169-cr.blueyonder.co.UK!not-for-mail From: nickroberts@blueyonder.co.uk (Nick Roberts) Newsgroups: comp.lang.ada Subject: Re: if file exist Date: Thu, 26 Sep 2002 00:39:01 GMT Organization: AdaOS Message-ID: <3d9245da.259420486@news.cis.dfn.de> References: NNTP-Posting-Host: pc-62-31-50-169-cr.blueyonder.co.uk (62.31.50.169) X-Trace: fu-berlin.de 1033000733 9628133 62.31.50.169 (16 [25716]) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: archiver1.google.com comp.lang.ada:29340 Date: 2002-09-26T00:39:01+00:00 List-Id: On 23 Sep 2002 06:38:22 -0600, Kilgallen@SpamCop.net (Larry Kilgallen) strongly typed: >On some operating systems the existence of a file for which the user >lacks read permission cannot be detected. A general solution for >detecting unreadable files is not possible. In addition, if you were to do, e.g. on MS-DOS: Open(F1,In_File,"COM1:"); You could get failure for a variety of reasons nothing to do with the existence, non-existence, or readability of files. In particular, it is quite possible that a file existence detector may say "COM1:" does not exist (as a file, or as a readable file, or as a readable text file), yet the above statement may succeed (and be useful). In full generality, it is not possible for a program to detect the existence of files for the purposes of determining whether it can subsequently open them for a particular purpose. On any multi-processing system, for example, the file could be deleted in between the detection and the opening. As far as the Ada program is concerned, the file name "foo" might mean: hack into the CIA central computer in CIACHQ Langley VA*; select a file at random with "foo" somewhere in the name; decrypt it using Blowfish and the key "Oojalum123"; reverse the order of the byte contents; send an e-mail to Tom Cruise, telling him what a handsome guy he is; insert the names of known KGB agents into the byte stream at 4KB intervals. The OS can interpret names how it likes. In general, I recommend that Ada code simply handles the Name_Error exception appropriately. [* properly, now named the George Bush Center for Intelligence] -- Nick Roberts Per Ardua ad Disastra 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-26 09:52:09 PST Message-ID: <3D933A6B.5000105@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: if file exist References: <3d9245da.259420486@news.cis.dfn.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 26 Sep 2002 12:48:43 -0400 NNTP-Posting-Host: 198.96.47.195 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1033058921 198.96.47.195 (Thu, 26 Sep 2002 12:48:41 EDT) NNTP-Posting-Date: Thu, 26 Sep 2002 12:48:41 EDT Organization: Bell Sympatico Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Xref: archiver1.google.com comp.lang.ada:29358 Date: 2002-09-26T12:48:43-04:00 List-Id: Nick Roberts wrote: > On 23 Sep 2002 06:38:22 -0600, Kilgallen@SpamCop.net (Larry Kilgallen) > strongly typed: > >>On some operating systems the existence of a file for which the user >>lacks read permission cannot be detected. A general solution for >>detecting unreadable files is not possible. On most file systems, when you don't have the permission(s) to read the _directory_, you cannot determine if the file exists or not (within that directory). This is because the directory itself is unreadable by you, and intentially so! So this is another example of how a general solution is not possible, and this applies to _most_ O/S in use, where security at the directory level is possible. -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg 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-26 15:16:28 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.stealth.net!news.stealth.net!nntp5.savvis.net!uunet!dfw.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: if file exist User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Thu, 26 Sep 2002 22:14:35 GMT Content-Type: text/plain; charset=us-ascii References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:29363 Date: 2002-09-26T22:14:35+00:00 List-Id: "Warren W. Gay VE3WWG" writes: > Nick Roberts wrote: > > On 23 Sep 2002 06:38:22 -0600, Kilgallen@SpamCop.net (Larry Kilgallen) > > strongly typed: > > > >>On some operating systems the existence of a file for which the user > >>lacks read permission cannot be detected. A general solution for > >>detecting unreadable files is not possible. > > On most file systems, when you don't have the permission(s) > to read the _directory_, you cannot determine if the file > exists or not (within that directory). This is because > the directory itself is unreadable by you, and intentially > so! So this is another example of how a general solution > is not possible, and this applies to _most_ O/S in use, > where security at the directory level is possible. 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. - Bob 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,FREEMAIL_FROM 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 03:47:11 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: nma124@hotmail.com (steve_H) Newsgroups: comp.lang.ada Subject: Re: if file exist Date: 27 Sep 2002 03:47:11 -0700 Organization: http://groups.google.com/ Message-ID: <8db3d6c8.0209270247.5bf07ae5@posting.google.com> References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> NNTP-Posting-Host: 63.203.198.30 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1033123631 12761 127.0.0.1 (27 Sep 2002 10:47:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 27 Sep 2002 10:47:11 GMT Xref: archiver1.google.com comp.lang.ada:29368 Date: 2002-09-27T10:47:11+00:00 List-Id: 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. You have overloaded the boolean result of FALSE to mean more than one thing. Why not have simply have a function that returns a status code istead of TRUE or FALSE? A status code can have more information in it than just a flag. 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 11:44:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: if file exist Date: Fri, 27 Sep 2002 13:43:41 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3719.2500 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:29386 Date: 2002-09-27T13:43:41-05:00 List-Id: 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. The point is that "If_Exist" is meaningless by itself. Its meaning depends on permissions and capabilities and probably other stuff that couldn't practically be standardized. Of course, if everyone implemented Ada.Directories, you could use that and figure out whatever interpretation you'd like. Randy. 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 07:01:41 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!news.tufts.edu!uunet!dca.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: if file exist User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Fri, 27 Sep 2002 14:01:16 GMT Content-Type: text/plain; charset=us-ascii References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:29375 Date: 2002-09-27T14:01:16+00:00 List-Id: nma124@hotmail.com (steve_H) writes: > 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. Fine, but if you ask whether secret/mumble exists, and "secret" is my secret directory, it should *not* tell you whether or not the file exists. - Bob 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 15:09:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!iad-peer.news.verio.net!news.verio.net!newsfeed.cwix.com!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: if file exist Date: 27 Sep 2002 17:09:41 -0600 Organization: LJK Software Message-ID: References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> <3D94D418.5010604@attbi.com> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1033163011 26374 192.135.80.34 (27 Sep 2002 21:43:31 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Fri, 27 Sep 2002 21:43:31 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:29393 Date: 2002-09-27T17:09:41-06:00 List-Id: In article <3D94D418.5010604@attbi.com>, Mark Biggar writes: > steve_H wrote: >> 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. > > No, from a computer security point of view, this is exactly what is > wanted. A user should see absolutely no difference between "file does > not exist" and "you don't have permission to see the file". Otherwise, > you have introduced a covert information channel. Beyond security, there are other possibilities like "this file is shelved and all the unshelving drives are currently busy". And as has been mentioned by others, "this file exists but someone else will delete it between now and when you try to open it" :-) 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" 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 15:00:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!ps01-chi1!news.webusenet.com!cyclone1.gnilink.net!wn1feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail Message-ID: <3D94D418.5010604@attbi.com> From: Mark Biggar User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 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> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 12.235.91.30 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1033163993 12.235.91.30 (Fri, 27 Sep 2002 21:59:53 GMT) NNTP-Posting-Date: Fri, 27 Sep 2002 21:59:53 GMT Organization: AT&T Broadband Date: Fri, 27 Sep 2002 21:59:53 GMT Xref: archiver1.google.com comp.lang.ada:29392 Date: 2002-09-27T21:59:53+00:00 List-Id: steve_H wrote: > 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. No, from a computer security point of view, this is exactly what is wanted. A user should see absolutely no difference between "file does not exist" and "you don't have permission to see the file". Otherwise, you have introduced a covert information channel. -- Mark Biggar mark.a.biggar@attbi.com 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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no 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-28 06:05:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!cox.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: if file exist Date: Sat, 28 Sep 2002 09:04:53 -0400 Organization: MindSpring Enterprises Message-ID: References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> NNTP-Posting-Host: d1.56.bc.67 X-Server-Date: 28 Sep 2002 13:05:24 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Xref: archiver1.google.com comp.lang.ada:29399 Date: 2002-09-28T13:05:24+00:00 List-Id: Q: Are you a spy? A: I'm not allowed to say... Maybe its better to think about it from the OS level - provide something in an OS interface package that says "We'll return whatever information the OS will give us about the file and it is OS dependent as to what the result is..." That way whatever security the OS wants to provide is respected. MDC -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jast.mil/ Send Replies To: m c o n d i c @ a c m . o r g "I'd trade it all for just a little more" -- Charles Montgomery Burns, [4F10] ====================================================================== Keith Thompson wrote in message news:yec7kh6ud49.fsf@king.cts.com... > 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. > 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-28 21:50:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!newshub.sdsu.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: 28 Sep 2002 21:50:04 -0700 Message-ID: X-Newsreader: Gnus v5.7/Emacs 20.7 NNTP-Posting-Host: 209.68.192.180 X-Trace: 1033275004 nntp.cts.com 321 209.68.192.180 Xref: archiver1.google.com comp.lang.ada:29409 Date: 2002-09-28T21:50:04-07:00 List-Id: "Marin David Condic" writes: > Q: Are you a spy? > > A: I'm not allowed to say... > > Maybe its better to think about it from the OS level - provide something in > an OS interface package that says "We'll return whatever information the OS > will give us about the file and it is OS dependent as to what the result > is..." That way whatever security the OS wants to provide is respected. I don't think we are (or should be) debating whether to respect the security provided by the OS. Violating OS security isn't just a bad idea, it's just plain impossible (barring OS bugs, of course). -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> Schroedinger does Shakespeare: "To be *and* not to be" 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-28 22:13:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!area.cu.mi.it!newsfeeder.edisontel.com!fu-berlin.de!uni-berlin.de!hse-mtl-ppp74259.qc.sympatico.CA!not-for-mail From: Christopher Browne Newsgroups: comp.lang.ada Subject: Re: if file exist Date: 29 Sep 2002 05:13:04 GMT Organization: cbbrowne Computing Inc Message-ID: References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> NNTP-Posting-Host: hse-mtl-ppp74259.qc.sympatico.ca (64.229.208.36) X-Trace: fu-berlin.de 1033276384 11847169 64.229.208.36 (16 [125932]) X-Draft-From: ("nntp+chvatal:comp.lang.ada" 2987) X-Home-Page: http://www.cbbrowne.com/info/ X-Emacs-Acronym: Embarrassed Manual-Writer Accused of Communist Subversion Microsoft: Where even the version numbers aren't Y2K-compliant X-Uboat-Death-Message: TORPEDOED BY TINY GNATS. EXPLODING. U-19. Xref: archiver1.google.com comp.lang.ada:29410 Date: 2002-09-29T05:13:04+00:00 List-Id: In the last exciting episode, Keith Thompson wrote:: > "Marin David Condic" writes: >> Q: Are you a spy? >> >> A: I'm not allowed to say... >> >> Maybe its better to think about it from the OS level - provide something in >> an OS interface package that says "We'll return whatever information the OS >> will give us about the file and it is OS dependent as to what the result >> is..." That way whatever security the OS wants to provide is respected. > > I don't think we are (or should be) debating whether to respect the > security provided by the OS. Violating OS security isn't just a bad > idea, it's just plain impossible (barring OS bugs, of course). FYI, here are two /highly/ relevant links to documents concerning a Multics security evaluation done back in 1974. http://csrc.nist.gov/publications/history/karg74.pdf http://domino.watson.ibm.com/library/cyberdig.nsf/papers?SearchView&Query=(multics) Part of the conclusion was that Multics /wasn't/ acceptably secure, back then, and that some modifications to the security design would be required to make it /really/ secure. The OSes of today have downright moved backwards from that. Another part of the conclusion was that part of the security Multics /did/ have came from the string support in PL/1. The buffer overruns that C is famed for wouldn't happen in PL/1, and more than likely aren't Ada things either... Some interesting principles pop out, in any case... -- (concatenate 'string "cbbrowne" "@ntlug.org") http://cbbrowne.com/info/multics.html I've had a perfectly wonderful evening. But this wasn't it. -- Groucho Marx 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-10-04 13:51:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!news.algonet.se!algonet!news2.tninet.se!not-for-mail From: Stefan Skoglund Newsgroups: comp.lang.ada Subject: Re: if file exist Date: Fri, 04 Oct 2002 22:56:49 +0200 Organization: Telenordia/Algonet Message-ID: <3D9E0091.18314F2E@ebox.tninet.se> References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> <3D94D418.5010604@attbi.com> NNTP-Posting-Host: sdu77-220.ppp.algonet.se Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: green.tninet.se 1033764734 12744 195.163.220.77 (4 Oct 2002 20:52:14 GMT) X-Complaints-To: abuse@telenordia.se NNTP-Posting-Date: Fri, 4 Oct 2002 20:52:14 +0000 (UTC) X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: sv,en,en-US Xref: archiver1.google.com comp.lang.ada:29526 Date: 2002-10-04T22:56:49+02:00 List-Id: Mark Biggar wrote: > No, from a computer security point of view, this is exactly what is > wanted. A user should see absolutely no difference between "file does > not exist" and "you don't have permission to see the file". Otherwise, > you have introduced a covert information channel. Hrmm, rather flimsy security in that case. Security-by-obscurity doesn't work. In that case a simple 'ls filename' on unix will give a not enough permissions message 'ls `dirname filename`' will tell if we are having a directory permissions problem. 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-10-05 07:00:40 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!osa.uu.net!sea.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: if file exist User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Sat, 5 Oct 2002 13:59:56 GMT Content-Type: text/plain; charset=us-ascii References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> <3D94D418.5010604@attbi.com> <3D9E0091.18314F2E@ebox.tninet.se> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:29534 Date: 2002-10-05T13:59:56+00:00 List-Id: Stefan Skoglund writes: > Mark Biggar wrote: > > No, from a computer security point of view, this is exactly what is > > wanted. A user should see absolutely no difference between "file does > > not exist" and "you don't have permission to see the file". Otherwise, > > you have introduced a covert information channel. > > Hrmm, rather flimsy security in that case. > Security-by-obscurity doesn't work. Methinks you are misusing the term "security by obscurity", which I understand to mean security by preventing people from knowing the method of security. For example, if you don't give out the source code for your operating system, so people won't know the password encryption algorithm, in an attempt to prevent people from breaking that algorithm. You're right -- that doesn't work very well. But it has nothing to do with this case. > In that case a simple 'ls filename' on unix > will give a not enough permissions message > 'ls `dirname filename`' will tell if we are having > a directory permissions problem. I'm not sure what the second command is attempting to do, but I'm pretty sure that on Unix systems, if you have no access to directory "dir" (i.e., rwx bits all zero), then you can't find out whether a given file name exists in dir. E.g., "ls dir/exists" and "ls dir/not-exists" will both produce the same error message, even though exists exists and not-exists does not. Attempting to run a directory as a command will cause an error, too, so I don't see how the second command causes a security flaw. Please explain the 'ls `dirname filename`'. - Bob 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-10-06 13:38:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!ps01-chi1!news.webusenet.com!cyclone1.gnilink.net!wn11feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi_feed3!attbi.com!12.120.28.17!attla2!ip.att.net!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> <3D94D418.5010604@attbi.com> <3D9E0091.18314F2E@ebox.tninet.se> From: Keith Thompson Date: 06 Oct 2002 13:35:21 -0700 Message-ID: X-Newsreader: Gnus v5.7/Emacs 20.7 NNTP-Posting-Host: 209.68.192.180 X-Trace: 1033936521 nntp.cts.com 321 209.68.192.180 Xref: archiver1.google.com comp.lang.ada:29546 Date: 2002-10-06T13:35:21-07:00 List-Id: Robert A Duff writes: [...] > I'm not sure what the second command is attempting to do, but I'm pretty > sure that on Unix systems, if you have no access to directory "dir" > (i.e., rwx bits all zero), then you can't find out whether a given file > name exists in dir. E.g., "ls dir/exists" and "ls dir/not-exists" will > both produce the same error message, even though exists exists and > not-exists does not. Attempting to run a directory as a command will > cause an error, too, so I don't see how the second command causes a > security flaw. Please explain the 'ls `dirname filename`'. I think you missed the backticks and/or the fact that "dirname" is a Unix command that prints a given filename with the trailing component removed. (It's a litle confusing; "dirname" is a literal command name, and "filename" substitutes for the actual name of some file.) So the command ls `dirname /etc/motd` expands (well, contracts actually) to ls /etc -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> Schroedinger does Shakespeare: "To be *and* not to be" 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-10-06 17:36:41 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: if file exist User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Mon, 7 Oct 2002 00:34:40 GMT Content-Type: text/plain; charset=us-ascii References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> <3D94D418.5010604@attbi.com> <3D9E0091.18314F2E@ebox.tninet.se> Keith Thompson writes: > Robert A Duff writes: > [...] > > I'm not sure what the second command is attempting to do, but I'm pretty > > sure that on Unix systems, if you have no access to directory "dir" > > (i.e., rwx bits all zero), then you can't find out whether a given file > > name exists in dir. E.g., "ls dir/exists" and "ls dir/not-exists" will > > both produce the same error message, even though exists exists and > > not-exists does not. Attempting to run a directory as a command will > > cause an error, too, so I don't see how the second command causes a > > security flaw. Please explain the 'ls `dirname filename`'. > > I think you missed the backticks and/or the fact that "dirname" is a > Unix command that prints a given filename with the trailing component > removed. I missed the fact that "dirname" was the dirname command. I thought it meant "the name of some directory". I still don't see how this introduces a security hole. The dirname command just works on a string -- it doesn't care whether the given file and directory names exist. And 'ls' won't tell you whether the file exists either. (The security hole in question is when I have a private directory foo, can outsiders find out the name(s) of my files in foo.) - Bob 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-10-06 22:42:36 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!washdc3-snf1!news.gtei.net!cyclone1.gnilink.net!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail From: "David Thompson" Newsgroups: comp.lang.ada References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> <3D94D418.5010604@attbi.com> Subject: Re: if file exist X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: Date: Mon, 07 Oct 2002 05:42:36 GMT NNTP-Posting-Host: 12.89.95.207 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1033969356 12.89.95.207 (Mon, 07 Oct 2002 05:42:36 GMT) NNTP-Posting-Date: Mon, 07 Oct 2002 05:42:36 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:29551 Date: 2002-10-07T05:42:36+00:00 List-Id: Mark Biggar wrote : > steve_H wrote: ... > > 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. > > No, from a computer security point of view, this is exactly what is > wanted. A user should see absolutely no difference between "file does > not exist" and "you don't have permission to see the file". Otherwise, > you have introduced a covert information channel. > First this only matters if you want/need nondiscretionary controls. Second it is OK if the third state is not specifically 'file exists but you don't have access' but rather 'I won't say if the file exists'* -- as in Multics' most-frequent and perhaps most-annoying error code/message "Insufficient access to return any information". * assuming there isn't an observable timing difference either -- - David.Thompson 1 now at worldnet.att.net 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,LOTS_OF_MONEY 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-10-13 09:05:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!iad-peer.news.verio.net!news.verio.net!newsfeed.cwix.com!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: if file exist Date: 13 Oct 2002 11:05:53 -0600 Organization: LJK Software Message-ID: <9WZ5dN1lmUZv@eisner.encompasserve.org> References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> <3D94D418.5010604@attbi.com> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1034523326 6656 192.135.80.34 (13 Oct 2002 15:35:26 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Sun, 13 Oct 2002 15:35:26 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:29744 Date: 2002-10-13T11:05:53-06:00 List-Id: In article , "David Thompson" writes: > Mark Biggar wrote : >> steve_H wrote: > ... >> > 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. >> >> No, from a computer security point of view, this is exactly what is >> wanted. A user should see absolutely no difference between "file does >> not exist" and "you don't have permission to see the file". Otherwise, >> you have introduced a covert information channel. >> > First this only matters if you want/need nondiscretionary controls. Non-discretionary controls, known as MAC for Mandatory Access Controls, are when the direct data owner (e.g., file owner) does not have full rights to control protection, for instance no right to disclose. The inability to tell whether an inaccessible file exists is _NOT_ restricted to MAC situations. Under DAC (Dicretionary Access Controls) the data owner may very well wish to restrict knowledge of file existence. Whether the desire for non-disclosure comes from the data owner or some higher authority has nothing to do with what characteristics are required in order to avoid disclosing the presence of a file. 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,LOTS_OF_MONEY 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-10-20 19:17:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn14feed!wn12feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail From: "David Thompson" Newsgroups: comp.lang.ada References: <3d9245da.259420486@news.cis.dfn.de> <3D933A6B.5000105@cogeco.ca> <8db3d6c8.0209270247.5bf07ae5@posting.google.com> <3D94D418.5010604@attbi.com> <9WZ5dN1lmUZv@eisner.encompasserve.org> Subject: Re: if file exist X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: <%sJs9.19905$1P1.1202599@bgtnsc05-news.ops.worldnet.att.net> Date: Mon, 21 Oct 2002 02:17:31 GMT NNTP-Posting-Host: 12.89.138.142 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1035166651 12.89.138.142 (Mon, 21 Oct 2002 02:17:31 GMT) NNTP-Posting-Date: Mon, 21 Oct 2002 02:17:31 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:29968 Date: 2002-10-21T02:17:31+00:00 List-Id: Larry Kilgallen wrote : > In article , "David Thompson" writes: > > Mark Biggar wrote : ... > >> No, from a computer security point of view, this is exactly what is > >> wanted. A user should see absolutely no difference between "file does > >> not exist" and "you don't have permission to see the file". Otherwise, > >> you have introduced a covert information channel. > >> > > First this only matters if you want/need nondiscretionary controls. > > Non-discretionary controls, known as MAC for Mandatory Access Controls, > are when the direct data owner (e.g., file owner) does not have full > rights to control protection, for instance no right to disclose. > Yes, and not just the owner, but also other users who are authorized to read and/or write, if any. > The inability to tell whether an inaccessible file exists is _NOT_ > restricted to MAC situations. Under DAC (Dicretionary Access Controls) > the data owner may very well wish to restrict knowledge of file existence. > Whether the desire for non-disclosure comes from the data owner or some > higher authority has nothing to do with what characteristics are required > in order to avoid disclosing the presence of a file. But only MAC really needs to be concerned about covert channels, since a DAC-authorized user is permitted to use open channels. AFAICT it is rare(r?) in DAC situations to care about disclosing existence, only contents, but if it is, it is common (and I am assuming possible) to put the file in a directory which is restricted against unauthorized probing for member's names and existence. -- - David.Thompson 1 now at worldnet.att.net