Open stcarrez opened 2 years ago
LOL! I've found the reason and it is caused by a bug in Ada.Directories
(filed in 2014):
When you build AWS, you get a symbolic link to a non-existing file:
$ ls -l /src/awa/ada-awa/ada-servlet/alire/tmp/alr-bsib.tmp/alire/cache/dependencies/aws_21.0.0_57fddf8f/install_dir/lib/
lrwxrwxrwx 1 ciceron ciceron 32 juil. 3 13:56 libaws.so -> ../lib/aws.relocatable/libaws.so
In fact you cannot use Ada.Directories.Delete_Tree
to reliably delete a build directory. I've discovered that recently with Porion. This is why I've implemented a safer delete operation in my library Ada Utility Library, see Util.Files.Delete_Tree
The root issue in Ada.Directories
package is that it uses stat
instead of lstat
to have information about a file. Then, it checks for the existence of the file before allowing its deletion. Since stat
fails to resolve the target link, the target file is not found but the symbolic link is real and the deletion is not done. At the end, the directory is not empty.
I doubt that Ada.Directories
will ever be fixed since the issue was reported in 2014 and nothing changed.
It is also not clear whether the Ada.Directories.Kind
and Ada.Directories.Exists
should be based on stat
or lstat
. This makes a big difference on Unix depending on what you want to do :-). Now, in most cases people use stat
because you are interested by the target file (except when you delete it!!!).
Deleting files is hard :cry: We also have an issue with deleting the index on Windows.
Maybe we should use you implementation.
I'm using Alire 1.2 official version.
When trying to publish some projects, I'm getting a
PROGRAM_ERROR
exception at the end of publish when it succeeds.It seems to occur on projects where I'm using
aws
as dependency. The generated Alire toml file is correct and the crash occurs probably in the cleanup phase of the build process.