Subject: bug#11806: (setq load-path ..) of elisp-comp

From: Stefano Lattarini <[email-masked]>
Date: Thu, 28 Jun 2012 12:49:45 +0200

Hi Makoto.  Thanks for the report and the patch.

On 06/28/2012 06:47 AM, Makoto Fujiwara wrote:
> We have following line in automake-1.12.1/lib/elisp-comp.
> 
>     73  mkdir $tempdir
>     74  cp "$@" $tempdir
>     75  
>     76  (
>     77    cd $tempdir
>     78    echo "(setq load-path (cons nil load-path))" > script
>     79    $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $?
>     80    mv *.elc ..
>     81  ) || exit $?
>     82  
>     83  (exit 0); exit 0
> 
>  It seems to me the intention of line 78 is to set load-path
> to add default directory on top of existing load-path.
> 
>  This 'script' is OK if the file to compile is only one in the
> directory.
> 
>   But if some files are in the directory there and we will
> compile file by file on the same directory, there may be a
> possibility that some files load another file in the same
> directory. In that case this 'script' fails to read such ones.
> 
> I do have problem compiling *.el files with tc-2.3.1 (svn version) 
>
Could you expose such problems in a minimal test case?  This way, I
could add it to the automake testsuite, to ensure the issue doesn't
represent itself in the future.  Thanks.

> Following patch fixes this type of problem, thanks a lot.
> 
> By the way, the same patch was once proposed as
>   http://osdir.com/ml/sysutils.automake.patches/2003-01/msg00004.html
> and fix seems to have made, but real line was dropped with
> unknown reason.
>
> --- lib/elisp-comp.orig	2012-06-01 22:47:10.000000000 +0900
> +++ lib/elisp-comp	2012-06-28 13:28:44.000000000 +0900
> @@ -75,7 +75,7 @@
>  
>  (
>    cd $tempdir
> -  echo "(setq load-path (cons nil load-path))" > script
> +  echo "(setq load-path (cons \"../\" (cons nil load-path)))" > script
>    $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $?
>    mv *.elc ..
>  ) || exit $?
> 
> 
The patch seems small and harmless, but unfortunately I know nothing at
all about Lisp or Emacs, so I can't judge whether such a change could
have unintended consequences.  Perchance someone more knowledgeable than
me in this area is reading the thread, and can chime in?  Otherwise I
will go ahead and push the patch in 72 hours.

Thanks,
  Stefano