[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#232448: debian-policy: Ada Library Information files must be read-only



Bill Allombert <allomber@math.u-bordeaux.fr> writes:
> Why is it not sufficient for the file to be `write-protected' for the
> user running gnat instead of all users including root ? Or if it is, why
> when running as root cannot it add the compiled files in the same
> directory ? If it is not, why not just fix the test ?

The file must be 0444, not 0644.  The reason for this is within GNAT
itself; I think it has to do with portability (with Windows, OpenVMS).
If we would change this for Debian, we would become incompatible with
the other platforms and distributions where GNAT runs.

> Also why can't gnat check if the compiled binary exists instead ?

First a little backgrounder on these *.ali files.

Ada has stringent rules (chapter 10 in the [1]Reference Manual) for
program consistency.  These rules (in particular 10.1.4 (5)) basically
guarantee that the final executable consists of object files that are
up-to-date and consistent with the corresponding source files.

GNAT uses Ada Library Information files for this purpose.  For each
object (*.o) file, GNAT also produces a *.ali file that contains lots
of information[2] about the compiler options, timestamp, and even
checksum of the source file.  The *.ali files contain mostly
human-readable text.

Once the object and *.ali files for a library have been produced, GNAT
uses them to compile, bind and link programs that use the library.

* If an object file is present in the same directory as the *.ali
  file, it is linked statically into the final executable.  We do not
  want this; we want the final executable to be linked against the
  shared library instead.  Therefore, Debian packages never include
  the object files, only static and shared libraries, just like C or
  C++ library packages.

* If the *.ali file has permissions different from 0444, or if the
  user passes the `-a' flag, GNAT considers whether or not to
  recompile the corresponding source file.  Since the object file is
  missing, it will always try to recompile the source file.  This
  defeats the purpose of providing precompiled libraries.  We also do
  not want this; therefore we want the *.ali files to have permissions
  0444.

If the user insists on recompiling the library, this is quite easy too
because the *.ali files are in a different directory than the source
files.  The user just has to omit the directory with the *.ali files
in their compilation.  GNAT, not seeing the *.ali files, recompiles
the relevant source files for the library, just like if they were part
of the user's program.  This recompilation occurs in the user's
current directory and does not cause problems with file permissions.

I hope I have made things clearer now.

[1] http://www.adaic.org/standards/95lrm/html/RM-TOC.html
[2] http://gcc.gnu.org/onlinedocs/gcc-3.3.2/gnat_ug_unx/The-Ada-Library-Information-Files.html#The%20Ada%20Library%20Information%20Files

-- 
Ludovic Brenta.




Reply to: