GNU bug report logs - #32580
Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling

Previous Next

Package: guile;

Reported by: seamus phenetols <seamusphenetols <at> yandex.com>

Date: Wed, 29 Aug 2018 23:47:01 UTC

Severity: normal

Done: Taylan Kammer <taylan.kammer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32580 in the body.
You can then email your comments to 32580 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#32580; Package guile. (Wed, 29 Aug 2018 23:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to seamus phenetols <seamusphenetols <at> yandex.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 29 Aug 2018 23:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: seamus phenetols <seamusphenetols <at> yandex.com>
To: bug-guile <at> gnu.org
Subject: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in
 ~/.guile doesn't prevent compiling
Date: Wed, 29 Aug 2018 18:49:00 -0400
I'm new to guile and scheme.  I compiled 2.2.4 from source yesterday.
I wish to silence the auto-compile chatter, other than real warnings and errors
while testing my programs.  There seems to be no way to do it, so I looked
for a way to disable auto-compile in ~/.guile configuration file.  No luck so far,
but the variables %load-should-autocompile and GUILE_AUTO_COMPILE
seem promising.  Sadly, they don't seem to prevent auto-compile when
set within ~/.guile.

Below is an excerpt of my shell session to demonstrate.  In case it may be
poorly formatted, I could make  a web paste for easy viewing.



$ rm -R $XDG_CACHE_HOME/guile/ccache
rm: cannot remove '/home/me/.cache/guile/ccache': No such file or directory
$ rm ~/.guile
rm: cannot remove '/home/me/.guile': No such file or directory
$
$ printf %s\\n '(display "Hello world!")' '(newline)' | tee ~/scheme/hello.scm
(display "Hello world!")
(newline)
$
$ guile ~/scheme/hello.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/me/scheme/hello.scm
;;; compiled /home/me/.cache/guile/ccache/2.2-LE-8-3.A/media/data/me/scheme/hello.scm.go
Hello world!
$
$ rm -R $XDG_CACHE_HOME/guile/ccache
$
$ printf %s\\n '(setenv "GUILE_AUTO_COMPILE" "0")' '(set! %load-should-autocompile #f)' | tee ~/.guile
(setenv "GUILE_AUTO_COMPILE" "0")
(set! %load-should-autocompile #f)
$
$ guile ~/scheme/hello.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/me/scheme/hello.scm
;;; compiled /home/me/.cache/guile/ccache/2.2-LE-8-3.A/media/data/me/scheme/hello.scm.go
Hello world!
$
$ guile --version
guile (GNU Guile) 2.2.4
Copyright (C) 2018 Free Software Foundation, Inc.

License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ls --full-time -gGh ~/Downloads/src/guile-2.2.4.tar.gz
-rw-r--r-- 1 18M 2018-08-24 17:37:08.405232060 -0400 /home/me/Downloads/src/guile-2.2.4.tar.gz
$





Information forwarded to bug-guile <at> gnu.org:
bug#32580; Package guile. (Fri, 31 Aug 2018 01:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 32580 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: seamus phenetols <seamusphenetols <at> yandex.com>
Cc: 32580 <at> debbugs.gnu.org
Subject: Re: bug#32580: Setting variables %load-should-autocompile and
 GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
Date: Thu, 30 Aug 2018 21:20:50 -0400
Hello,

seamus phenetols <seamusphenetols <at> yandex.com> writes:

> I'm new to guile and scheme.  I compiled 2.2.4 from source yesterday.
> I wish to silence the auto-compile chatter, other than real warnings and errors
> while testing my programs.  There seems to be no way to do it, so I looked
> for a way to disable auto-compile in ~/.guile configuration file.  No luck so far,
> but the variables %load-should-autocompile and GUILE_AUTO_COMPILE
> seem promising.  Sadly, they don't seem to prevent auto-compile when
> set within ~/.guile.
>
> Below is an excerpt of my shell session to demonstrate.  In case it may be
> poorly formatted, I could make  a web paste for easy viewing.

My guess is that setting GUILE_AUTO_COMPILE dynamically in your ~/.guile
is too late; the Guile process would have already been fire-up without
it set early enough to take effect (just a guess).

Try exporting the GUILE_AUTO_COMPILE variable before running your
program, or setting it inline in front of your guile command:

--8<---------------cut here---------------start------------->8---
guile hello.scm 
;;; note: source file /home/maxim/hello.scm
;;;       newer than compiled /home/maxim/.cache/guile/ccache/2.2-LE-8-3.A/home/maxim/hello.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/maxim/hello.scm
;;; compiled /home/maxim/.cache/guile/ccache/2.2-LE-8-3.A/home/maxim/hello.scm.go
Hello World
maxim <at> apteryx ~$ rm .cache/guile/ccache/2.2-LE-8-3.A/home/maxim/hello.scm.go
maxim <at> apteryx ~$ GUILE_AUTO_COMPILE=0 guile hello.scm
Hello World
--8<---------------cut here---------------end--------------->8---

Where have you seen that %load-should-autocompile variable documented?
It doesn't appear in the Guile Reference info manual.

This doesn't seem to be a bug :)

Thank you,

Maxim




Information forwarded to bug-guile <at> gnu.org:
bug#32580; Package guile. (Fri, 31 Aug 2018 14:01:02 GMT) Full text and rfc822 format available.

Message #11 received at 32580 <at> debbugs.gnu.org (full text, mbox):

From: seamus phenetols <seamusphenetols <at> yandex.com>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: "32580 <at> debbugs.gnu.org" <32580 <at> debbugs.gnu.org>
Subject: Re: bug#32580: Setting variables %load-should-autocompile and
 GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
Date: Fri, 31 Aug 2018 10:00:08 -0400
Hello MC,

> My guess is that setting GUILE_AUTO_COMPILE dynamically in your ~/.guile
> is too late; the Guile process would have already been fire-up without
> it set early enough to take effect (just a guess).

I assumed ~/.guile would be evaluated before any script.  Perhaps I am mistaken.

> Try exporting the GUILE_AUTO_COMPILE variable before running your
> program, or setting it inline in front of your guile command:

Yes, that does work.  Now every time I want to disable autocompile I must:

GUILE_AUTO_COMPILE=0 guile ~/scheme/hello.scm

If there is a hello.go under $XDG_CACHE_HOME/guile then it will be used
anyway unless it is considered out of date.  I would very much prefer to:

eliminate the unnecessary chatter when no warnings or errors occur
OR disable the auto-compile feature in ~/.guile.  

If these aren't possible, then I suppose I can make a shell alias or function
for:

 GUILE_AUTO_COMPILE=0 guile

> Where have you seen that %load-should-autocompile variable documented?
> It doesn't appear in the Guile Reference info manual.
>
> This doesn't seem to be a bug :)

%load-should-autocompile was mentioned in IRC by the person who asked
me to report this as a bug.  It's also present in some commit messages I 
found by a general web search.  

Thanks.




Information forwarded to bug-guile <at> gnu.org:
bug#32580; Package guile. (Sat, 01 Sep 2018 19:00:02 GMT) Full text and rfc822 format available.

Message #14 received at 32580 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: seamus phenetols <seamusphenetols <at> yandex.com>
Cc: "32580 <at> debbugs.gnu.org" <32580 <at> debbugs.gnu.org>
Subject: Re: bug#32580: Setting variables %load-should-autocompile and
 GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
Date: Sat, 01 Sep 2018 14:59:15 -0400
Hello Seamus,

seamus phenetols <seamusphenetols <at> yandex.com> writes:

> Hello MC,
>
>> My guess is that setting GUILE_AUTO_COMPILE dynamically in your ~/.guile
>> is too late; the Guile process would have already been fire-up without
>> it set early enough to take effect (just a guess).
>
> I assumed ~/.guile would be evaluated before any script.  Perhaps I am mistaken.
>
>> Try exporting the GUILE_AUTO_COMPILE variable before running your
>> program, or setting it inline in front of your guile command:
>
> Yes, that does work.  Now every time I want to disable autocompile I must:
>
> GUILE_AUTO_COMPILE=0 guile ~/scheme/hello.scm

As I wrote, you can also export the variable:
--8<---------------cut here---------------start------------->8---
export GUILE_AUTO_COMPILE=0
--8<---------------cut here---------------end--------------->8---

To make it permanent you can define such a line in your ~/.profile or
~/.bash_profile, and logout/login into your session to have it effective.

The Guile reference manual only defines two means to control
auto-compilation:

1. Setting the GUILE_AUTO_COMPILE environment variables (which, being an
environment variable, should be defined as such, as explained above)

2. Using the --no-auto-compile option passed directly to the guile
interpreter.

Let me know if this addresses your issue.

Thank you,

Maxim




Information forwarded to bug-guile <at> gnu.org:
bug#32580; Package guile. (Sun, 02 Sep 2018 19:24:01 GMT) Full text and rfc822 format available.

Message #17 received at 32580 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Llorens <daniel.llorens <at> bluewin.ch>
To: 32580 <at> debbugs.gnu.org
Subject: bug#32580: Setting variables %load-should-autocompile and
 GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
Date: Sun, 2 Sep 2018 21:22:56 +0200
I think, regardless of whether GUILE_AUTO_COMPILE works correctly or not (and public variables should all be documented, so if %load-should-autocompile isn't, I'd call that its own bug), I agree with the substance of the complaint. The autocompilation messages aren't warnings and shouldn't be sent to the warning port. Maybe they should be sent to a logging port instead.





Information forwarded to bug-guile <at> gnu.org:
bug#32580; Package guile. (Mon, 15 Oct 2018 00:22:01 GMT) Full text and rfc822 format available.

Message #20 received at 32580 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: seamus phenetols <seamusphenetols <at> yandex.com>
Cc: 32580 <at> debbugs.gnu.org
Subject: Re: bug#32580: Setting variables %load-should-autocompile and
 GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
Date: Sun, 14 Oct 2018 20:21:07 -0400
[Message part 1 (text/plain, inline)]
Hello Seamus,

seamus phenetols <seamusphenetols <at> yandex.com> writes:

> Setting GUILE_AUTO_COMPILE in ~/.profile and in ~/.bash_profile
> doesn't seem to have any effect.  I'm giving up on guile for now.
> Thank you very much for helping.

I'm sorry it hasn't worked for you! Let's see if we can find out why.

What exactly did you put in your ~/.profile or ~/.bash_profile? What
version of Guile are you using? When launching a new pseudo terminal
(i.e. xterm, gnome-terminal, etc.) and typing 'echo
$GUILE_AUTO_COMPILE', does it return the expected value defined in your
~/.profile or ~/.bash_profile?

Note that you would need to logout then login of your session for new
variable definition to take effect; otherwise you can test it in your
current shell by sourcing it:

--8<---------------cut here---------------start------------->8---
source ~/.bash_profile # or source ~/.profile
--8<---------------cut here---------------start------------->8---

I've put the following Scheme code in a file named
'test-auto-compile.scm' (attached for your convenience):

--8<---------------cut here---------------start------------->8---
#!/usr/bin/env guile
!#

(define (main)
  "Print whether auto-compilation is enabled or not and exit with an
exit status of 1 if it is enabled, 0 otherwise."
  (let ((guile-auto-compile-value (getenv "GUILE_AUTO_COMPILE")))
    (display (format #f "The value of GUILE_AUTO_COMPILE is ~s\n"
		     guile-auto-compile-value))
    (when (and guile-auto-compile-value
	       (string=? guile-auto-compile-value "0"))
	(display "Auto-compilation is disabled.\n")
	(exit 0))
    (display "Auto-compilation is enabled.\n")
    (exit 1)))

(main)
--8<---------------cut here---------------start------------->8---

Here's a small demonstration of what the above script gives on my system
(guile --version is 2.2.4, but this should work for any Guile version >=
2.0):

--8<---------------cut here---------------start------------->8---
echo $GUILE_AUTO_COMPILE

maxim <at> apteryx ~/Documents$ guile test-auto-compile.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/maxim/Documents/test-auto-compile.scm
;;; compiled /home/maxim/.cache/guile/ccache/2.2-LE-8-3.A/home/maxim/Documents/test-auto-compile.scm.go
The value of GUILE_AUTO_COMPILE is #f
Auto-compilation is enabled.
maxim <at> apteryx ~/Documents$ 
maxim <at> apteryx ~/Documents$ rm /home/maxim/.cache/guile/ccache/2.2-LE-8-3.A/home/maxim/Documents/test-auto-compile.scm.go
maxim <at> apteryx ~/Documents$ export GUILE_AUTO_COMPILE=0
maxim <at> apteryx ~/Documents$ guile test-auto-compile.scm
The value of GUILE_AUTO_COMPILE is "0"
Auto-compilation is disabled.
--8<---------------cut here---------------end--------------->8---

I hope this helps,

Maxim

[test-auto-compile.scm (text/plain, attachment)]

Reply sent to Taylan Kammer <taylan.kammer <at> gmail.com>:
You have taken responsibility. (Tue, 18 May 2021 16:31:01 GMT) Full text and rfc822 format available.

Notification sent to seamus phenetols <seamusphenetols <at> yandex.com>:
bug acknowledged by developer. (Tue, 18 May 2021 16:31:02 GMT) Full text and rfc822 format available.

Message #25 received at 32580-done <at> debbugs.gnu.org (full text, mbox):

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: 32580-done <at> debbugs.gnu.org
Subject: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in
 ~/.guile doesn't prevent compiling
Date: Tue, 18 May 2021 18:30:30 +0200
Closing as this was not a bug.

Exporting GUILE_AUTO_COMPILE=0 works as intended; must be done before start.

The variable %load-should-autocompile is for internal use by Guile only.

-- 
Taylan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 16 Jun 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 312 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.