The code here doesn't correctly determine the number of files and sets the counter to a potentially too low number: https://github.com/AdaCore/libadalang-tools/blob/dd86765017a5fd8656560e10d0964431880c3c7f/src/utils-drivers.adb#L98-L100
Which can trigger a CONSTRAINT_ERROR here: https://github.com/AdaCore/libadalang-tools/blob/dd86765017a5fd8656560e10d0964431880c3c7f/src/utils-drivers.adb#L118Arg_Length (Cmd, Ignore) returns the number of files passed via --ignore arguments, not the number of files listed in those files, which might have been the intention. The exception is triggered if more --ignore arguments are passed than files are eventually ignored (can be reproduced by e.g. passing an empty ignore file or one that lists files that don't exist, or by passing the same file that lists a single existing file twice). What's more, if the code were to actually reduce the number of files by the number of those listed in all ignore files, it could still trigger the same error as it assumes all the ignored files actually exist and can be skipped in the loop.
I didn't realize this before, but apparently gnattest always only compared the file name of ignored files, never the path. However, in previous versions, the base name/directory of all paths listed in files passed via --ignore was stripped, so the list/set of ignored files only contained the file names. Therefore, even if a relative path was listed, this worked correctly. The problem is that this version of gnattest doesn't remove the base name anymore, so if a relative path is listed, there won't be a match (which in my case triggered the above error as only a single file was ignored via its relative path).
I noticed two issues with the
--ignore
argument:Arg_Length (Cmd, Ignore)
returns the number of files passed via--ignore
arguments, not the number of files listed in those files, which might have been the intention. The exception is triggered if more--ignore
arguments are passed than files are eventually ignored (can be reproduced by e.g. passing an empty ignore file or one that lists files that don't exist, or by passing the same file that lists a single existing file twice). What's more, if the code were to actually reduce the number of files by the number of those listed in all ignore files, it could still trigger the same error as it assumes all the ignored files actually exist and can be skipped in the loop.gnattest
always only compared the file name of ignored files, never the path. However, in previous versions, the base name/directory of all paths listed in files passed via--ignore
was stripped, so the list/set of ignored files only contained the file names. Therefore, even if a relative path was listed, this worked correctly. The problem is that this version ofgnattest
doesn't remove the base name anymore, so if a relative path is listed, there won't be a match (which in my case triggered the above error as only a single file was ignored via its relative path).