Nicolas Boulenguez wrote:
If foo is a symlink targeting "foo", GNAT's implementation of
Ada.Directories.Full_Name ("foo") returns "".
System.OS_Lib.Normalize_Pathname body ends with:
-- Too many iterations: give up
-- This can happen when there is a circularity in the symbolic links: A
-- is a symbolic link for B, which itself is a symbolic link, and the
-- target of B or of another symbolic link target of B is A. In this
-- case, we return an empty string to indicate failure to resolve.
This seems to be an error according to RM-A-16 72/2.
Do I miss something, or is it a bug?
It is definitely an error. They should either return "foo" or raise the exception Name_Error.
The tricky question is _which_ of the two. I would argue that symlinks are 'special files' (in the RM terminology) and it thus is wrong to follow a symlink in Ada.Directories.Full_Name. I.e. the correct action in your example would be to return "foo".
The alternative is to claim that a symlink isn't a file at all, which at least will make some people annoyed.
Greetings, Jacob -- Black Hole: Where the universe made a Divide by Zero.