[Emacs-ada-mode] [Emacs][ada-mode] ada-xref.el -- missing gnatls in PATH

Pierre-Louis Escouflaire pierre-louis.escouflaire at eurocontrol.int
Thu Nov 15 04:53:16 PST 2007


Hello,

We found a relatively drastic problem related to the 'ada-xref.el' 
script file that appears when you do NOT have 'gnatls' in your PATH.

Here are a few commands to reproduce the problem:
(Please make a backup of your .emacs)

$
$ alias emacs=$(which emacs)
$ cp .emacs /tmp/.emacs
$ cat << EOF > .emacs
(require 'ada-xref)
;; The following lines won't be executed
(set-background-color "black")
(set-foreground-color "white")
EOF
$ export oPATH=${PATH}
$ export PATH=:
$ emacs
--> emacs appears but shows some errors
--> The lines for background and foreground are not executed
$ export PATH=${oPATH}
$ mv /tmp/.emacs .emacs
$


The reason is located around line 300 in 'ada-xref.el':
...
  (let* ((gnatls (ada-find-executable (concat cross-prefix "gnatls")))
	(status (call-process gnatls nil t nil "-v")))
...


In fact, the `ada-find-executable' function returns:
   . the full path to the executable when found ;
   . the string given as an argument when not found.

Thus,   (ada-find-executable "gnatls")   returns "gnatls" when there is 
NO 'gnatls' in your PATH.

Thus, I think that your code misses a check that the "found" 'gnatls' 
exists and is executable (file-executable-p) between the call to 
`ada-find-executable' and the call to `call-process'.

Another solution (maybe wiser) would be to change `ada-find-executable' 
so that it raises an error when the executable has not been found. The 
one using it should then protect it using a `condition-case'.



Thanks for your concern.

Regards,
Pierre-Louis ESCOUFLAIRE

____

This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful.

Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL, unless it is confirmed by appropriately signed hard copy.

Any views expressed in this message are those of the sender.




More information about the Emacs-ada-mode mailing list