[gps-devel] Debian Bug#666958: gnat-gps: GPS isn't looking in /usr/share/ada/adainclude for installed packages

Ludovic Brenta ludovic at ludovic-brenta.org
Mon Apr 9 15:45:02 CEST 2012


While investigating http://bugs.debian.org/666958, I discovered a bug in
prj_editor/src/creation_wizard-dependencies.adb; the fix is:

--- a/prj_editor/src/creation_wizard-dependencies.adb
+++ b/prj_editor/src/creation_wizard-dependencies.adb
@@ -278,8 +278,9 @@
          --  Make sure the path isn't duplicated
          Found := False;
 
-         for K in Project_Path'Range loop
+         for K in Project_Path'First .. J - 1 loop
             if Project_Path (J) = Project_Path (K) then
+               --  We've already processed the same path before.  Abort.
                Found := True;
                exit;
             end if;


If you look in the sources, you will see that, without the patch, the
condition "Project_Path (J) = Project_Path (K)" is always true at least
once (i.e. when J = K) and therefore Found always becomes True and the
rest of the loop is never executed.  Also, there is a risk that a path
that appears twice (or more) in the Project_Path array is *never*
processed.  The patch carefully ensures that a duplicated path is
processed once.

-- 
Ludovic Brenta.


More information about the gps-devel mailing list