bug#16364: auto-compile noise can't be avoided by script

2021-05-18 Thread Taylan Kammer
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
From 81b0ed712b435816175414313bfe11fedd5ce11a Mon Sep 17 00:00:00 2001
From: Taylan Kammer 
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 

bug#30542: https://www.gnu.org/software/guile/docs/ needs an update

2021-05-18 Thread Taylan Kammer
> Hi,
> 
> https://www.gnu.org/software/guile/docs/ needs an update.
> 
> Following the link "Reference Manual for Guile 2.0 (the current stable
> release series)" results in "GNU Guile 2.2.3 Reference Manual"
> 
> I did not compare text and content of the other links.
> 
> Regard
> Frank

Seems fixed, closing.

-- 
Taylan





bug#30600: repl metacommands do not discard remaining input after syntax error in an expression

2021-05-18 Thread Taylan Kammer
Attached is a small patch to fix this.

-- 
Taylan
From 0ba67891624647105e0dbdc33b0079cba655cec1 Mon Sep 17 00:00:00 2001
From: Taylan Kammer 
Date: Tue, 18 May 2021 18:15:08 +0200
Subject: [PATCH] Better REPL behavior on syntax errors in meta commands.

* module/system/repl/command.scm (define-meta-command): Flush all
remaining input after handling a read error.
* module/system/repl/common.scm (flush-all-input): New public procedure.
* module/system/repl/repl.scm: Remove local flush-all-input definition.
---
 module/system/repl/command.scm | 5 -
 module/system/repl/common.scm  | 9 -
 module/system/repl/repl.scm| 7 ---
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/module/system/repl/command.scm b/module/system/repl/command.scm
index ac1fa0933..c0649b60b 100644
--- a/module/system/repl/command.scm
+++ b/module/system/repl/command.scm
@@ -230,7 +230,10 @@
  (lp (cons x out)))
  (lambda (k . args)
(handle-read-error #f k args)
-   (lambda (k) #f)   ; the abort handler
+   ;; The abort handler:
+   (lambda (k)
+ (flush-all-input)
+ #f)
 
 ((_ ((name category) repl . datums) docstring b0 b1 ...)
  (define-meta-command ((name category) repl () . datums)
diff --git a/module/system/repl/common.scm b/module/system/repl/common.scm
index 29ae104c5..51bf783e7 100644
--- a/module/system/repl/common.scm
+++ b/module/system/repl/common.scm
@@ -35,7 +35,7 @@
 repl-expand repl-optimize
 repl-parse repl-print repl-option-ref repl-option-set!
 repl-default-option-set! repl-default-prompt-set!
-puts ->string user-error
+puts ->string user-error flush-all-input
 *warranty* *copying* *version*))
 
 (define *version*
@@ -286,3 +286,10 @@ See , for more 
details.")
 
 (define (user-error msg . args)
   (throw 'user-error #f msg args #f))
+
+(define (flush-all-input)
+  (if (and (char-ready?)
+   (not (eof-object? (peek-char
+  (begin
+(read-char)
+(flush-all-input
diff --git a/module/system/repl/repl.scm b/module/system/repl/repl.scm
index 5b27125f1..859ac444a 100644
--- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -96,13 +96,6 @@
  *unspecified*)
 (else ((language-reader lang) port env
 
-(define (flush-all-input)
-  (if (and (char-ready?)
-   (not (eof-object? (peek-char
-  (begin
-(read-char)
-(flush-all-input
-
 ;; repl-reader is a function defined in boot-9.scm, and is replaced by
 ;; something else if readline has been activated. much of this hoopla is
 ;; to be able to re-use the existing readline machinery.
-- 
2.30.2



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

2021-05-18 Thread Taylan Kammer
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#48503: [PATCH] Improve error reporting of getpw and getgr.

2021-05-18 Thread Taylan Kammer
Tag: patch
Severity: minor

The attached patch fixes/improves the error-reporting of getpw and getgr.

-- 
Taylan
From 0b3faa5c01ed2d41fd7fc30e7bb4490d79ec2586 Mon Sep 17 00:00:00 2001
From: Taylan Kammer 
Date: Tue, 18 May 2021 19:32:10 +0200
Subject: [PATCH] Improve error reporting of getpw and getgr.

* libguile/posix.c (scm_getpwuid): Check errno to see if a SYSERROR
should be raised; otherwise improve not-found error message.
(scm_getgrgid): Raise a meaningful error when errno isn't set.
---
 libguile/posix.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libguile/posix.c b/libguile/posix.c
index 31c4ab192..6ce00b9b5 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -372,7 +372,12 @@ SCM_DEFINE (scm_getpwuid, "getpw", 0, 1, 0,
   entry = getpwnam (c_user));
 }
   if (!entry)
-SCM_MISC_ERROR ("entry not found", SCM_EOL);
+{
+  if (errno)
+SCM_SYSERROR;
+  else
+SCM_MISC_ERROR ("No such POSIX user.", scm_list_1 (user));
+}
 
   SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (entry->pw_name));
   SCM_SIMPLE_VECTOR_SET(result, 1, scm_from_locale_string (entry->pw_passwd));
@@ -438,7 +443,12 @@ SCM_DEFINE (scm_getgrgid, "getgr", 0, 1, 0,
 STRING_SYSCALL (name, c_name,
entry = getgrnam (c_name));
   if (!entry)
-SCM_SYSERROR;
+{
+  if (errno)
+SCM_SYSERROR;
+  else
+SCM_MISC_ERROR ("No such POSIX user group.", scm_list_1 (name));
+}
 
   SCM_SIMPLE_VECTOR_SET(result, 0, scm_from_locale_string (entry->gr_name));
   SCM_SIMPLE_VECTOR_SET(result, 1, scm_from_locale_string (entry->gr_passwd));
-- 
2.30.2



bug#26107: Inaccurate location info for unbound-variable errors

2021-05-18 Thread Taylan Kammer
FWIW this seems fixed in 3.0, but I can reproduce with 2.2.7.

Are we still supporting 2.2 for non-critical stuff?

-- 
Taylan





bug#26107: Inaccurate location info for unbound-variable errors

2021-05-18 Thread Ludovic Courtès
Hi,

Taylan Kammer  skribis:

> FWIW this seems fixed in 3.0, but I can reproduce with 2.2.7.
>
> Are we still supporting 2.2 for non-critical stuff?

There’s no plan to do so.

Ludo’.





bug#26107: Inaccurate location info for unbound-variable errors

2021-05-18 Thread Taylan Kammer
On 18.05.2021 22:11, Ludovic Courtès wrote:
> Hi,
> 
> Taylan Kammer  skribis:
> 
>> FWIW this seems fixed in 3.0, but I can reproduce with 2.2.7.
>>
>> Are we still supporting 2.2 for non-critical stuff?
> 
> There’s no plan to do so.
> 
> Ludo’.
> 

Closing then. :-)

-- 
Taylan