Subject: bug#23739: Unexpected behavior of 'add-to-load-path'.

From: <[email-masked]>
Date: Fri, 10 Jun 2016 15:41:43 +0200

On Fri, Jun 10, 2016 at 02:17:23PM +0200, Mathieu Lirzin wrote:
> Hello,
> 
> I have noticed something that doesn't feel right when using
> ‘add-to-load-path’.
> 
> $ cat test.scm
> --8<---------------cut here---------------start------------->8---
> (define old %load-path)
> (add-to-load-path "foo")
> (pk %load-path)
> (pk old)
> --8<---------------cut here---------------end--------------->8---
> 
> first run:
> 
> $ guile test.scm
> --8<---------------cut here---------------start------------->8---
> ;;; [Compilation]
> ;;; (("foo" "foo" "/usr/share/guile/2.0" "/usr/share/guile/site/2.0" "/usr/share/guile/site" "/usr/share/guile"))
> 
> ;;; (("foo" "/usr/share/guile/2.0" "/usr/share/guile/site/2.0" "/usr/share/guile/site" "/usr/share/guile"))
> --8<---------------cut here---------------end--------------->8---
> 
> next runs:
> 
> $ guile test.scm
> --8<---------------cut here---------------start------------->8---
> ;;; (("foo" "/usr/share/guile/2.0" "/usr/share/guile/site/2.0" "/usr/share/guile/site" "/usr/share/guile"))
> 
> ;;; (("/usr/share/guile/2.0" "/usr/share/guile/site/2.0" "/usr/share/guile/site" "/usr/share/guile"))
> --8<---------------cut here---------------end--------------->8---

I can confirm half of it :-)

I mean: the double entry "foo" for %load-path in your first result
above doesn't happen for me. Could that be a typo?

As for the strangely different behaviour when running pre-compiled
(old has %load-path's old value) and compiling (old has %load-path's
value after (add-to-load-path ...) yes, that happens to me too, on

  tomas@rasputin:/tmp$ guile --version
  guile (GNU Guile) 2.0.11.133-d680
  Copyright (C) 2014 Free Software Foundation, Inc.

Looks like a bug to me.

regards
- -- tomás