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-Thread: 103376,1295f20108acc30c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!o39g2000prb.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Ada.Directories.Copy_File behavior Date: Mon, 21 Feb 2011 11:41:05 -0800 (PST) Organization: http://groups.google.com Message-ID: <108751e8-cfc7-4b8d-be11-fae80cbd0285@o39g2000prb.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1298317272 16397 127.0.0.1 (21 Feb 2011 19:41:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 21 Feb 2011 19:41:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o39g2000prb.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:18495 Date: 2011-02-21T11:41:05-08:00 List-Id: On Feb 21, 11:26=A0am, "Vinzent Hoefler" <0439279208b62c95f1880bf0f8776...@t-domaingrabbing.de> wrote: > Adam Beneschan wrote: > > On Feb 19, 3:01 pm, "Vinzent Hoefler" > > <0439279208b62c95f1880bf0f8776...@t-domaingrabbing.de> wrote: > >> =A0 wrote: > >> > If the Target_Name file already exists, does Copy_File raise an exce= ption, > >> > or does it replace the old file? =A0I can't seem to find where the b= ehavior > >> > is specified in the ARM. > > >> |The exception Use_Error is propagated if the external environment doe= s not > >> |support creating the file with the name given by Target_Name > > >> So, the actual behaviour depends on the underlying OS, I'd say. > > > Note that the phrase you quote says "does not support creating". > > Which is basically the same as the language used in the description of > > Create operations (see A.8.2(5)). =A0The language does *not* say "does > > not support copying to" or anything of that sort. =A0So I think > > Copy_File is supposed to work any time Create will work, > > So far I'm inclined to agree 100%. > > > including > > when the file already exists (assuming the permissions are such that > > the file can be overwritten). =A0And, barring permission/ownership > > issues, Create normally does not raise an exception if you give it the > > name of an existing file. > > But is that specified anywhere in the ARM? Always being pessimistic, I > would read > > |The exception Use_Error is propagated if, for the specified mode, the > |external environment does not support creation of an external file with > |the given name (in the absence of Name_Error) and form. > > as "it is permissible that file creation fails in some environments if a > file with the same name already exists". Although one (including me) may > consider such an interpretation unlikely, it seems still possible. ;) My interpretation is that if the OS allows you to delete a file and then create a new one with the same name, then it does support "creation of an external file with the given name". That's true even if the operation that the OS provides to create a file will return an error if the file already exists. There's nothing in the RM language that says that the OS has to support creating the new file with just one OS call. If the OS won't let you delete a file at all, then it makes sense for the Create procedure to raise an exception (and similarly Copy_File). -- Adam