Subject: Re: Lisp as replacement for python
From: Erik Naggum <erik@naggum.net>
Date: Sat, 08 Dec 2001 09:57:22 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3216794239740055@naggum.net>

* Kaz Kylheku
| If it's not an executable, it s shunted to the same command interpreter
| that the system() function invokes.  That interpreter can optionally
| process #!, as provided by this text in the shell command language
| description:``[I]f the first line of a file of shell commands starts with
| the characters #!, the results are unspecified.''

* Erik Naggum
> This is incorrect for many systems, probably all reasonably modern
> systems.  #! is processed by the kernel as just another magic number for
> executabies, not by the shell, anymore.

* Kaz Kylheku
| It's not incorrect, it's only too weak to express what is provided by
| actual useful implementations.  Those modern systems do conform the
| weak spec as written. Treating the #! as a comment is an exemplary
| provision of ``unspecified behavior''. Plus there is plenty of
| room to interpret what is considered an executable file by the exec*()
| functions, which opens the door to magic numbers.

  I thought the premise for your elaboration was the first sentence.  The
  first sentence is incorrect, since the file has to be executable, but
  maybe there is a difference between an executable file and an executable.
  In any case, the followup would be arbitrary.

> A better way than all this would be a system call to request the full
> path name of one's executable.  That, of course, does not exist.
> Sometimes, Unix really sucks.

| It doesn't exist in any *portable* way.

  Well, those of us who still have a working memory of better times past
  remember TOPS-10 and TOPS-20 and their excellent operating system support
  for this kind of information.

| On Linux, for instance, we have a special /proc filesystem section where
| you can look up the paths of your memory mappings.

  Now that you made me look for it (thanks :), I vastly prefer
  (unix:readlink "/proc/self/exe").
  
///
-- 
  The past is not more important than the future, despite what your culture
  has taught you.  Your future observations, conclusions, and beliefs are
  more important to you than those in your past ever will be.  The world is
  changing so fast the balance between the past and the future has shifted.