!standard A.16(61/2) 11-12-15 AI05-0271-1/01 !standard A.16(69/2) !class binding interpretation 11-11-09 !status Amendment 2012 11-11-11 !status ARG Approved 7-0-2 11-11-11 !status work item 11-11-09 !status received 11-10-01 !priority Low !difficulty Easy !qualifier Omission !subject Failure behavior of Directories.Create_Path !summary It is unspecified what directories, if any, are created if Ada.Directories.Create_Path raises Use_Error. Similarly, it is unspecified if a portion of the file is copied if Ada.Directories.Copy_File raises Use_Error. !question It is unspecified what happens if Ada.Directories.Create_Path partially succeeds. That is, if the call manages to create some (outer) directories but fails later on an (inner) directory. This should be specified. !recommendation (See summary.) !wording Add to the end of A.16(61/2): If Use_Error is propagated, it is unspecified whether a portion of the directory path is created. Add to the end of A.16(69/2): If Use_Error is propagated, it is unspecified whether a portion of the file is copied. !discussion The call may leave any created directories when it fails. Attempting to clean up could not be guaranteed (what if the attempt to remove also fails?) and is much harder to implement (requiring handlers for errors rather than simply propagating them). We use wording similar to that found in A.16(63/2) for Delete_Tree. Wording is necessary because saying this explicitly for Delete_Tree and not saying anything for Create_Path makes it look like Create_Path has an omission. But saying nothing is leaving the behavior unspecified, so the meaning is the same either way. During discusssion of this AI, a similar question was raised about Copy_File; we use a similar answer there (again because we cannot guarantee to be able to clean up a failed copy). !corrigendum A.16(61/2) @drepl Creates zero or more directories with name New_Directory. Each nonexistent directory named by New_Directory is created. For example, on a typical Unix system, Create_Path ("/usr/me/my"); would create directory "me" in directory "usr", then create directory "my" in directory "me". The Form parameter can be used to give system-dependent characteristics of the directory; the interpretation of the Form parameter is implementation-defined. A null string for Form specifies the use of the default options of the implementation of the new directory. The exception Name_Error is propagated if the string given as New_Directory does not allow the identification of any directory. The exception Use_Error is propagated if the external environment does not support the creation of any directories with the given name (in the absence of Name_Error) and form. @dby Creates zero or more directories with name New_Directory. Each nonexistent directory named by New_Directory is created. For example, on a typical Unix system, Create_Path ("/usr/me/my"); would create directory "me" in directory "usr", then create directory "my" in directory "me". The Form parameter can be used to give system-dependent characteristics of the directory; the interpretation of the Form parameter is implementation-defined. A null string for Form specifies the use of the default options of the implementation of the new directory. The exception Name_Error is propagated if the string given as New_Directory does not allow the identification of any directory. The exception Use_Error is propagated if the external environment does not support the creation of any directories with the given name (in the absence of Name_Error) and form. If Use_Error is propagated, it is unspecified whether a portion of the directory path is created. !corrigendum A.16(69/2) @drepl Copies the contents of the existing external file with name Source_Name to an external file with name Target_Name. The resulting external file is a duplicate of the source external file. The Form parameter can be used to give system-dependent characteristics of the resulting external file; the interpretation of the Form parameter is implementation-defined. Exception Name_Error is propagated if the string given as Source_Name does not identify an existing external ordinary or special file, or if the string given as Target_Name does not allow the identification of an external file. The exception Use_Error is propagated if the external environment does not support creating the file with the name given by Target_Name and form given by Form, or copying of the file with the name given by Source_Name (in the absence of Name_Error). @dby Copies the contents of the existing external file with name Source_Name to an external file with name Target_Name. The resulting external file is a duplicate of the source external file. The Form parameter can be used to give system-dependent characteristics of the resulting external file; the interpretation of the Form parameter is implementation-defined. Exception Name_Error is propagated if the string given as Source_Name does not identify an existing external ordinary or special file, or if the string given as Target_Name does not allow the identification of an external file. The exception Use_Error is propagated if the external environment does not support creating the file with the name given by Target_Name and form given by Form, or copying of the file with the name given by Source_Name (in the absence of Name_Error). If Use_Error is propagated, it is unspecified whether a portion of the file is copied. !ACATS Test It is not possible to test anything that is unspecified. !ASIS No effect on ASIS (this is a predefined package). !appendix !topic IO Ada.Directories.Create_Path failure behavior !reference Ada 2005 RM A.16 (61/2) !from /Brad Moore 11-10-01/ !keywords Directory Path !discussion Ada.Directories.Create_Path does not specify what happens if the call partially succeeds. If the call manages to create the outer directories associated with the path, but fails to create any of the lower level directories of the path, does the call leave the partially created directories in the file system, or does it remove any directories it may have created? ****************************************************************