unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#16364: auto-compile noise can't be avoided by script
@ 2014-01-05 23:41 Zefram
  2014-01-17 21:31 ` Ludovic Courtès
  2021-05-17 22:31 ` Taylan Kammer
  0 siblings, 2 replies; 5+ messages in thread
From: Zefram @ 2014-01-05 23:41 UTC (permalink / raw)
  To: 16364

Guile 2.0.9 has a facility to automatically cache a compiled version
of any Scheme source file that it loads, and it wants the world to
know about it!  If auto-compilation is enabled, which it is by default,
then when guile loads a file (that was not already compiled) it emits a
banner describing the auto-compilation.  This interferes with the proper
functionality of any program written as a guile script, by producing
output that the program did not intend.  Working around this is tricky
(discussed below).  There's no straightforward way for a script to avoid
the noise while being portable between guile versions 1.8 and 2.0.
There's also no way to avoid the noise while actually getting the
auto-compilation behaviour.

In my particular case, my script makes interesting use of the
read-eval (#.) feature, which means that the compilation process
actually can't work.  This means that *every* time the script is run,
not just the first time, guile emits the banner about auto-compilation,
followed by a rather misleading warning/error about compilation failure.
It's misleading because it then goes on to execute the script just fine.
I can demonstrate this with a minimal test case (using read-eval in an
uninteresting way, just making the compiler barf by not having applied
eval-when to enable it):

$ cat t0
#!/usr/bin/guile -s
!#
(fluid-set! read-eval? #t)
(display #."hello world")
(newline)
$ guile-1.8 -s t0
hello world
$ guile-2.0 -s t0
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/zefram/usr/guile/t0
;;; WARNING: compilation of /home/zefram/usr/guile/t0 failed:
;;; ERROR: #. read expansion found and read-eval? is #f.
hello world
$

I can turn off the auto-compilation from within the script by using the
--no-auto-compile option, but that breaks compatibility to 1.8:

$ cat t1
#!/usr/bin/guile \
--no-auto-compile -s
!#
(fluid-set! read-eval? #t)
(display #."hello world")
(newline)
$ guile-2.0 '\' t1
hello world
$ guile-1.8 '\' t1
guile-1.8: Unrecognized switch `--no-auto-compile'
Usage: guile-1.8 OPTION ...
Evaluate Scheme code, interactively or from a script.
...

Aside from the portability concern, turning off auto-compilation doesn't
actually fix the problem.  If a compiled version has previously been
cached for the filename of a script being run, guile will consider
using the cached version even if --no-auto-compile was supplied: the
switch only controls the attempt to compile for the cache.  If the
cached compilation is up to date then it is used silently, which is OK.
But if it's out of date, because the cache was for a different script
that previously existed under the same name, then guile emits a banner
saying that it's out of date (implying that the cached compilation is
therefore not being used).  So the script's visible behaviour is defiled
even if it applies the option.

Observe what happens to the second script in this sequence:

$ echo '(display "hello world\n")' >t10
$ guile-2.0 t10
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/zefram/usr/guile/t10
;;; compiled /home/zefram/.cache/guile/ccache/2.0-LE-8-2.0/home/zefram/usr/guile/t10.go
hello world
$ echo '(display "goodbye world\n")' >t10
$ guile-2.0 --no-auto-compile t10        
;;; note: source file /home/zefram/usr/guile/t10
;;;       newer than compiled /home/zefram/.cache/guile/ccache/2.0-LE-8-2.0/home/zefram/usr/guile/t10.go
goodbye world

I have, however, come up with a truly ugly workaround.  The meta option
system can be used to introduce a -c option that explicitly loads the
script file via primitive-eval, which does not attempt compilation.
(Nor does it look at the compilation cache, so this even avoids the
problem that --no-auto-compile runs into.)  Running the script this way
yields a different command line (visible through (program-arguments))
from that which arrives when the script is run via -s, so if the script
is to process its command line, for robustness it must pay attention to
which way it was invoked.  All together, this looks like:

$ cat t11
#!/usr/bin/guile \
-c (begin\
\ \ \ (define\ arg-hack\ #t)\
\ \ \ (primitive-load\ (cadr\ (program-arguments))))
!#
(define argv
  (if (false-if-exception arg-hack)
    (cdr (program-arguments))
    (program-arguments)))
(write argv)
(newline)
$ guile-1.6 '\' t11 a b c
("t11" "a" "b" "c")
$ guile-1.6 -s t11 a b c 
("t11" "a" "b" "c")
$ guile-1.8 '\' t11 a b c
("t11" "a" "b" "c")
$ guile-1.8 -s t11 a b c 
("t11" "a" "b" "c")
$ guile-2.0 '\' t11 a b c
("t11" "a" "b" "c")
$ guile-2.0 -s t11 a b c 
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/zefram/usr/guile/t11
;;; /home/zefram/usr/guile/t11:7:6: warning: possibly unbound variable `arg-hack'
;;; compiled /home/zefram/.cache/guile/ccache/2.0-LE-8-2.0/home/zefram/usr/guile/t11.go
("t11" "a" "b" "c")
$ guile-2.0 -s t11 a b c
("t11" "a" "b" "c")

I'm not comfortable with this as a workaround.  It smells fragile.
Also note that though this does avoid the banner appearing for
#!-based executions, it's not muffling the banner per se but actually
preventing compilation.  While for some programs it's desirable to
prevent compilation per se (because of the compiler's limitations),
there are plenty of programs that would like to be compiled and only
want to muffle the banner.  Losing the efficiency of compilation is
potentially a high price to pay for clean output.

Guile should not be emitting this banner by default.  It's really not
acceptable to damage the visible behaviour of a program that worked
fine on older guile versions.  It also, for this auto-compilation to
serve as the invisible optimising cache as which it's intended, ought
to keep quiet about compilation failure: the fallback to interpreting
the script should be silent.

Debian incarnation of this bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734009

-zefram





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16364: auto-compile noise can't be avoided by script
  2014-01-05 23:41 bug#16364: auto-compile noise can't be avoided by script Zefram
@ 2014-01-17 21:31 ` Ludovic Courtès
  2014-01-17 21:56   ` Zefram
  2021-05-17 22:31 ` Taylan Kammer
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2014-01-17 21:31 UTC (permalink / raw)
  To: Zefram; +Cc: 16364

Zefram <zefram@fysh.org> skribis:

> I can turn off the auto-compilation from within the script by using the
> --no-auto-compile option, but that breaks compatibility to 1.8:

However, you can set the environment variable GUILE_AUTO_COMPILE=0.

Do you think that would solve the problem?

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16364: auto-compile noise can't be avoided by script
  2014-01-17 21:31 ` Ludovic Courtès
@ 2014-01-17 21:56   ` Zefram
  0 siblings, 0 replies; 5+ messages in thread
From: Zefram @ 2014-01-17 21:56 UTC (permalink / raw)
  To: Ludovic Courtes; +Cc: 16364

Ludovic Courtes wrote:
>However, you can set the environment variable GUILE_AUTO_COMPILE=0.
>
>Do you think that would solve the problem?

It does not solve the problem.  Firstly, it can't be done from the
#! line at all, so the script can't do it early enough.  It only works
if it's already been set by the user, which is no good for what should
be an internal detail of the program.  Secondly, it suffers the second
problem that I noted with --no-auto-compile: if there's already a cached
compilation then that'll be looked at, and if it's out of date then a
"newer than" banner is emitted.  With the environment variable set the
cached version will never be updated, nor will it be deleted, so the
banner then appears on every execution.

-zefram





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16364: auto-compile noise can't be avoided by script
  2014-01-05 23:41 bug#16364: auto-compile noise can't be avoided by script Zefram
  2014-01-17 21:31 ` Ludovic Courtès
@ 2021-05-17 22:31 ` Taylan Kammer
  2021-05-18 14:52   ` Taylan Kammer
  1 sibling, 1 reply; 5+ messages in thread
From: Taylan Kammer @ 2021-05-17 22:31 UTC (permalink / raw)
  To: 16364, Zefram

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

Attached is a patch that adds a command-line switch --silence-auto-compile
which disables all diagnostics about auto-compilation except when the
auto-compilation of a file fails.


This can be used the following way in a script:

#!/usr/bin/guile \
--silence-auto-compile --any --other --switches -s
!#


See:

https://www.gnu.org/software/guile/manual/html_node/The-Meta-Switch.html


-- 
Taylan

[-- Attachment #2: 0001-Add-command-line-switch-silence-auto-compile.patch --]
[-- Type: text/plain, Size: 7886 bytes --]

From f00fd000a05801fa8f57e06c6803ea01422c419b Mon Sep 17 00:00:00 2001
From: Taylan Kammer <taylan.kammer@gmail.com>
Date: Tue, 18 May 2021 00:21:54 +0200
Subject: [PATCH] Add command-line switch --silence-auto-compile.

* libguile/load.c: Define and obey new variable %silence-auto-compile.
* module/ice-9/boot-9.scm (load-in-vicinity): Obey %silence-auto-compile.
* module/ice-9/command-line.scm (compile-shell-switches): Check for
the switch --silence-auto-compile and set %silence-auto-compile.
---
 libguile/load.c               | 59 ++++++++++++++++++++++++-----------
 module/ice-9/boot-9.scm       |  8 +++--
 module/ice-9/command-line.scm |  4 +++
 3 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/libguile/load.c b/libguile/load.c
index 0c198f165..7edd44bd5 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -230,6 +230,9 @@ static SCM *scm_loc_load_should_auto_compile;
 /* Whether to treat all auto-compiled files as stale. */
 static SCM *scm_loc_fresh_auto_compile;
 
+/* Whether to silence auto-compile related diagnostics output. */
+static SCM *scm_loc_silence_auto_compile;
+
 /* The fallback path for auto-compilation */
 static SCM *scm_loc_compile_fallback_path;
 
@@ -571,11 +574,14 @@ compiled_is_fresh (SCM full_filename, SCM compiled_filename,
   else
     {
       compiled_is_newer = 0;
-      scm_puts (";;; note: source file ", scm_current_warning_port ());
-      scm_display (full_filename, scm_current_warning_port ());
-      scm_puts ("\n;;;       newer than compiled ", scm_current_warning_port ());
-      scm_display (compiled_filename, scm_current_warning_port ());
-      scm_puts ("\n", scm_current_warning_port ());
+      if (scm_is_false (*scm_loc_silence_auto_compile))
+        {
+          scm_puts (";;; note: source file ", scm_current_warning_port ());
+          scm_display (full_filename, scm_current_warning_port ());
+          scm_puts ("\n;;;       newer than compiled ", scm_current_warning_port ());
+          scm_display (compiled_filename, scm_current_warning_port ());
+          scm_puts ("\n", scm_current_warning_port ());
+        }
     }
 
   return compiled_is_newer;
@@ -740,7 +746,9 @@ load_thunk_from_path (SCM filename, SCM source_file_name,
                 /* Already warned.  */
                 continue;
 
-              if (found_stale_file && *found_stale_file)
+              if (found_stale_file
+                  && *found_stale_file
+                  && scm_is_false (*scm_loc_silence_auto_compile))
                 {
                   scm_puts (";;; found fresh compiled file at ",
                                      scm_current_warning_port ());
@@ -961,10 +969,16 @@ do_try_auto_compile (void *data)
 {
   SCM source = SCM_PACK_POINTER (data);
   SCM comp_mod, compile_file;
+  int print_autocompile_messages;
 
-  scm_puts (";;; compiling ", scm_current_warning_port ());
-  scm_display (source, scm_current_warning_port ());
-  scm_newline (scm_current_warning_port ());
+  print_autocompile_messages = 0;
+
+  if (print_autocompile_messages)
+    {
+      scm_puts (";;; compiling ", scm_current_warning_port ());
+      scm_display (source, scm_current_warning_port ());
+      scm_newline (scm_current_warning_port ());
+    }
 
   comp_mod = scm_c_resolve_module ("system base compile");
   compile_file = scm_module_variable (comp_mod, sym_compile_file);
@@ -991,17 +1005,23 @@ do_try_auto_compile (void *data)
       /* Assume `*current-warning-prefix*' has an appropriate value.  */
       res = scm_call_n (scm_variable_ref (compile_file), args, 5);
 
-      scm_puts (";;; compiled ", scm_current_warning_port ());
-      scm_display (res, scm_current_warning_port ());
-      scm_newline (scm_current_warning_port ());
+      if (print_autocompile_messages)
+        {
+          scm_puts (";;; compiled ", scm_current_warning_port ());
+          scm_display (res, scm_current_warning_port ());
+          scm_newline (scm_current_warning_port ());
+        }
       return res;
     }
   else
     {
-      scm_puts (";;; it seems ", scm_current_warning_port ());
-      scm_display (source, scm_current_warning_port ());
-      scm_puts ("\n;;; is part of the compiler; skipping auto-compilation\n",
-                scm_current_warning_port ());
+      if (print_autocompile_messages)
+        {
+          scm_puts (";;; it seems ", scm_current_warning_port ());
+          scm_display (source, scm_current_warning_port ());
+          scm_puts ("\n;;; is part of the compiler; skipping auto-compilation\n",
+                    scm_current_warning_port ());
+        }
       return SCM_BOOL_F;
     }
 }
@@ -1040,7 +1060,7 @@ SCM_DEFINE (scm_sys_warn_auto_compilation_enabled, "%warn-auto-compilation-enabl
 {
   static int message_shown = 0;
 
-  if (!message_shown)
+  if (!message_shown && scm_is_false (*scm_loc_silence_auto_compile))
     {
       scm_puts (";;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0\n"
                 ";;;       or pass the --no-auto-compile argument to disable.\n",
@@ -1174,7 +1194,8 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
           && compiled_is_fresh (full_filename, fallback,
                                 &stat_source, &stat_compiled))
         {
-          if (found_stale_compiled_file)
+          if (found_stale_compiled_file
+              && scm_is_false (*scm_loc_silence_auto_compile))
             {
               scm_puts (";;; found fresh local cache at ",
                                  scm_current_warning_port ());
@@ -1304,6 +1325,8 @@ scm_init_load ()
     = SCM_VARIABLE_LOC (scm_c_define ("%load-should-auto-compile", SCM_BOOL_F));
   scm_loc_fresh_auto_compile
     = SCM_VARIABLE_LOC (scm_c_define ("%fresh-auto-compile", SCM_BOOL_F));
+  scm_loc_silence_auto_compile
+    = SCM_VARIABLE_LOC (scm_c_define ("%silence-auto-compile", SCM_BOOL_F));
 
   scm_ellipsis = scm_from_latin1_string ("...");
 
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 2323b1ec5..f9766a2a3 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -4327,16 +4327,18 @@ when none is available, reading FILE-NAME with READER."
        (if (and gostat (more-recent? gostat scmstat))
            (load-thunk-from-file go-file-name)
            (begin
-             (when gostat
+             (when (and gostat (not %silence-auto-compile))
                (format (current-warning-port)
                        ";;; note: source file ~a\n;;;       newer than compiled ~a\n"
                        name go-file-name))
              (cond
               (%load-should-auto-compile
                (%warn-auto-compilation-enabled)
-               (format (current-warning-port) ";;; compiling ~a\n" name)
+               (when (not %silence-auto-compile)
+                 (format (current-warning-port) ";;; compiling ~a\n" name))
                (let ((cfn (compile name)))
-                 (format (current-warning-port) ";;; compiled ~a\n" cfn)
+                 (when (not %silence-auto-compile)
+                   (format (current-warning-port) ";;; compiled ~a\n" cfn))
                  (load-thunk-from-file cfn)))
               (else #f)))))
      #:warning "WARNING: compilation of ~a failed:\n" name))
diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index a0a1a35d9..7562366bd 100644
--- a/module/ice-9/command-line.scm
+++ b/module/ice-9/command-line.scm
@@ -358,6 +358,10 @@ If FILE begins with `-' the -s switch is mandatory.
             (set! %load-should-auto-compile #f)
             (parse args out))
 
+           ((string=? arg "--silence-auto-compile")
+            (set! %silence-auto-compile #t)
+            (parse args out))
+
            ((string=? arg "-q")         ; don't load user init
             (set! inhibit-user-init? #t)
             (parse args out))
-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16364: auto-compile noise can't be avoided by script
  2021-05-17 22:31 ` Taylan Kammer
@ 2021-05-18 14:52   ` Taylan Kammer
  0 siblings, 0 replies; 5+ messages in thread
From: Taylan Kammer @ 2021-05-18 14:52 UTC (permalink / raw)
  To: 16364, Zefram

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

On 18.05.2021 00:31, Taylan Kammer wrote:
> Attached is a patch ...

Accidentally sent a broken version of the patch.  Here's the right one.

-- 
Taylan

[-- Attachment #2: 0001-Add-command-line-switch-silence-auto-compile.patch --]
[-- Type: text/plain, Size: 7929 bytes --]

From 81b0ed712b435816175414313bfe11fedd5ce11a Mon Sep 17 00:00:00 2001
From: Taylan Kammer <taylan.kammer@gmail.com>
Date: Tue, 18 May 2021 00:21:54 +0200
Subject: [PATCH] Add command-line switch --silence-auto-compile.

* libguile/load.c: Define and obey new variable %silence-auto-compile.
* module/ice-9/boot-9.scm (load-in-vicinity): Obey %silence-auto-compile.
* module/ice-9/command-line.scm (compile-shell-switches): Check for
the switch --silence-auto-compile and set %silence-auto-compile.
---
 libguile/load.c               | 59 ++++++++++++++++++++++++-----------
 module/ice-9/boot-9.scm       |  8 +++--
 module/ice-9/command-line.scm |  4 +++
 3 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/libguile/load.c b/libguile/load.c
index 0c198f165..6cd34ee7b 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -230,6 +230,9 @@ static SCM *scm_loc_load_should_auto_compile;
 /* Whether to treat all auto-compiled files as stale. */
 static SCM *scm_loc_fresh_auto_compile;
 
+/* Whether to silence auto-compile related diagnostics output. */
+static SCM *scm_loc_silence_auto_compile;
+
 /* The fallback path for auto-compilation */
 static SCM *scm_loc_compile_fallback_path;
 
@@ -571,11 +574,14 @@ compiled_is_fresh (SCM full_filename, SCM compiled_filename,
   else
     {
       compiled_is_newer = 0;
-      scm_puts (";;; note: source file ", scm_current_warning_port ());
-      scm_display (full_filename, scm_current_warning_port ());
-      scm_puts ("\n;;;       newer than compiled ", scm_current_warning_port ());
-      scm_display (compiled_filename, scm_current_warning_port ());
-      scm_puts ("\n", scm_current_warning_port ());
+      if (scm_is_false (*scm_loc_silence_auto_compile))
+        {
+          scm_puts (";;; note: source file ", scm_current_warning_port ());
+          scm_display (full_filename, scm_current_warning_port ());
+          scm_puts ("\n;;;       newer than compiled ", scm_current_warning_port ());
+          scm_display (compiled_filename, scm_current_warning_port ());
+          scm_puts ("\n", scm_current_warning_port ());
+        }
     }
 
   return compiled_is_newer;
@@ -740,7 +746,9 @@ load_thunk_from_path (SCM filename, SCM source_file_name,
                 /* Already warned.  */
                 continue;
 
-              if (found_stale_file && *found_stale_file)
+              if (found_stale_file
+                  && *found_stale_file
+                  && scm_is_false (*scm_loc_silence_auto_compile))
                 {
                   scm_puts (";;; found fresh compiled file at ",
                                      scm_current_warning_port ());
@@ -961,10 +969,16 @@ do_try_auto_compile (void *data)
 {
   SCM source = SCM_PACK_POINTER (data);
   SCM comp_mod, compile_file;
+  int print_autocompile_messages;
 
-  scm_puts (";;; compiling ", scm_current_warning_port ());
-  scm_display (source, scm_current_warning_port ());
-  scm_newline (scm_current_warning_port ());
+  print_autocompile_messages = scm_is_false (*scm_loc_silence_auto_compile);
+
+  if (print_autocompile_messages)
+    {
+      scm_puts (";;; compiling ", scm_current_warning_port ());
+      scm_display (source, scm_current_warning_port ());
+      scm_newline (scm_current_warning_port ());
+    }
 
   comp_mod = scm_c_resolve_module ("system base compile");
   compile_file = scm_module_variable (comp_mod, sym_compile_file);
@@ -991,17 +1005,23 @@ do_try_auto_compile (void *data)
       /* Assume `*current-warning-prefix*' has an appropriate value.  */
       res = scm_call_n (scm_variable_ref (compile_file), args, 5);
 
-      scm_puts (";;; compiled ", scm_current_warning_port ());
-      scm_display (res, scm_current_warning_port ());
-      scm_newline (scm_current_warning_port ());
+      if (print_autocompile_messages)
+        {
+          scm_puts (";;; compiled ", scm_current_warning_port ());
+          scm_display (res, scm_current_warning_port ());
+          scm_newline (scm_current_warning_port ());
+        }
       return res;
     }
   else
     {
-      scm_puts (";;; it seems ", scm_current_warning_port ());
-      scm_display (source, scm_current_warning_port ());
-      scm_puts ("\n;;; is part of the compiler; skipping auto-compilation\n",
-                scm_current_warning_port ());
+      if (print_autocompile_messages)
+        {
+          scm_puts (";;; it seems ", scm_current_warning_port ());
+          scm_display (source, scm_current_warning_port ());
+          scm_puts ("\n;;; is part of the compiler; skipping auto-compilation\n",
+                    scm_current_warning_port ());
+        }
       return SCM_BOOL_F;
     }
 }
@@ -1040,7 +1060,7 @@ SCM_DEFINE (scm_sys_warn_auto_compilation_enabled, "%warn-auto-compilation-enabl
 {
   static int message_shown = 0;
 
-  if (!message_shown)
+  if (!message_shown && scm_is_false (*scm_loc_silence_auto_compile))
     {
       scm_puts (";;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0\n"
                 ";;;       or pass the --no-auto-compile argument to disable.\n",
@@ -1174,7 +1194,8 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
           && compiled_is_fresh (full_filename, fallback,
                                 &stat_source, &stat_compiled))
         {
-          if (found_stale_compiled_file)
+          if (found_stale_compiled_file
+              && scm_is_false (*scm_loc_silence_auto_compile))
             {
               scm_puts (";;; found fresh local cache at ",
                                  scm_current_warning_port ());
@@ -1304,6 +1325,8 @@ scm_init_load ()
     = SCM_VARIABLE_LOC (scm_c_define ("%load-should-auto-compile", SCM_BOOL_F));
   scm_loc_fresh_auto_compile
     = SCM_VARIABLE_LOC (scm_c_define ("%fresh-auto-compile", SCM_BOOL_F));
+  scm_loc_silence_auto_compile
+    = SCM_VARIABLE_LOC (scm_c_define ("%silence-auto-compile", SCM_BOOL_F));
 
   scm_ellipsis = scm_from_latin1_string ("...");
 
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 2323b1ec5..f9766a2a3 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -4327,16 +4327,18 @@ when none is available, reading FILE-NAME with READER."
        (if (and gostat (more-recent? gostat scmstat))
            (load-thunk-from-file go-file-name)
            (begin
-             (when gostat
+             (when (and gostat (not %silence-auto-compile))
                (format (current-warning-port)
                        ";;; note: source file ~a\n;;;       newer than compiled ~a\n"
                        name go-file-name))
              (cond
               (%load-should-auto-compile
                (%warn-auto-compilation-enabled)
-               (format (current-warning-port) ";;; compiling ~a\n" name)
+               (when (not %silence-auto-compile)
+                 (format (current-warning-port) ";;; compiling ~a\n" name))
                (let ((cfn (compile name)))
-                 (format (current-warning-port) ";;; compiled ~a\n" cfn)
+                 (when (not %silence-auto-compile)
+                   (format (current-warning-port) ";;; compiled ~a\n" cfn))
                  (load-thunk-from-file cfn)))
               (else #f)))))
      #:warning "WARNING: compilation of ~a failed:\n" name))
diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index a0a1a35d9..7562366bd 100644
--- a/module/ice-9/command-line.scm
+++ b/module/ice-9/command-line.scm
@@ -358,6 +358,10 @@ If FILE begins with `-' the -s switch is mandatory.
             (set! %load-should-auto-compile #f)
             (parse args out))
 
+           ((string=? arg "--silence-auto-compile")
+            (set! %silence-auto-compile #t)
+            (parse args out))
+
            ((string=? arg "-q")         ; don't load user init
             (set! inhibit-user-init? #t)
             (parse args out))
-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-18 14:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-05 23:41 bug#16364: auto-compile noise can't be avoided by script Zefram
2014-01-17 21:31 ` Ludovic Courtès
2014-01-17 21:56   ` Zefram
2021-05-17 22:31 ` Taylan Kammer
2021-05-18 14:52   ` Taylan Kammer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).