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.2 required=5.0 tests=BAYES_00,FROM_LOCAL_HEX, FROM_STARTS_WITH_NUMS autolearn=no 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-7-bit Path: g2news1.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Vinzent Hoefler" <0439279208b62c95f1880bf0f8776eeb@t-domaingrabbing.de> Newsgroups: comp.lang.ada Subject: Re: Ada.Directories.Copy_File behavior Date: Mon, 21 Feb 2011 20:26:27 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: individual.net lapurCJ5N2KBR4+cB6j0GgLwSQbekPDPu8D84EKp+2zdEG/B32 Cancel-Lock: sha1:LoB5IDKiQ4SSwrE7/kHcgeE+PS8= User-Agent: Opera Mail/11.01 (Win32) Xref: g2news1.google.com comp.lang.ada:17523 Date: 2011-02-21T20:26:27+01:00 List-Id: Adam Beneschan wrote: > On Feb 19, 3:01 pm, "Vinzent Hoefler" > <0439279208b62c95f1880bf0f8776...@t-domaingrabbing.de> wrote: >> wrote: >> > If the Target_Name file already exists, does Copy_File raise an exception, >> > or does it replace the old file? I can't seem to find where the behavior >> > is specified in the ARM. >> >> |The exception Use_Error is propagated if the external environment does 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)). The language does *not* say "does > not support copying to" or anything of that sort. So 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). And, 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. ;) Vinzent. -- You know, we're sitting on four million pounds of fuel, one nuclear weapon, and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it? -- Rockhound, "Armageddon"