Re: Quiet compilation for scripting
On 3/18/24 6:40 AM, Matt Wette wrote: On 3/15/24 1:52 PM, Matt Wette wrote: As mentioned on another topic (start=up message) I had once hacked guile to have a info-port, with initial welcome message and compile messages going to (current-info-port). Adding a command arg to set that to a file or /dev/null would fix both issues. The patch I sent out was not complete. i am making an effort to get it working. I'll let you all know when I have it. It looks like I have something working. Here is a link: https://github.com/mwette/guile-contrib/blob/main/patch/3.0.9/info-port.patch Matt
Re: Quiet compilation for scripting
On 3/15/24 1:52 PM, Matt Wette wrote: As mentioned on another topic (start=up message) I had once hacked guile to have a info-port, with initial welcome message and compile messages going to (current-info-port). Adding a command arg to set that to a file or /dev/null would fix both issues. The patch I sent out was not complete. i am making an effort to get it working. I'll let you all know when I have it. Matt
Re: Quiet compilation for scripting
On Fri, Mar 15, 2024, at 3:52 PM, Matt Wette wrote: > As mentioned on another topic (start=up message) I had once hacked guile > to have a info-port, with initial welcome message and compile messages > going to (current-info-port). Adding a command arg to set that to a file or > /dev/null would fix both issues. > > Matt OP here. I was going to offer to try implementing a --quiet switch myself, but this idea seems better and I don't know how to do it. For the moment I am satisfied running "guild compile test.scm" during deployment so this message doesn't appear in production, but I still feel that ideally there would be an option to suppress the message. Kevin
Re: Quiet compilation for scripting
On Fri, Mar 15, 2024 at 01:52:10PM -0700, Matt Wette wrote: > On 3/15/24 1:47 PM, Marc Chantreux wrote: > > On Fri, Mar 15, 2024 at 08:00:09PM +0100, to...@tuxteam.de wrote: > > > > I think most of Guile user actually want this feature for a long time. > > > > I can understand. > > > I agree. > > so do I. > > As mentioned on another topic (start=up message) I had once hacked guile to > have a > info-port, with initial welcome message and compile messages going to > (current-info-port). Thanks. To me, that makes a lot of sense, yes. Cheers -- t signature.asc Description: PGP signature
Re: Quiet compilation for scripting
On 3/15/24 1:52 PM, Matt Wette wrote: On 3/15/24 1:47 PM, Marc Chantreux wrote: On Fri, Mar 15, 2024 at 08:00:09PM +0100, to...@tuxteam.de wrote: I think most of Guile user actually want this feature for a long time. I can understand. I agree. so do I. As mentioned on another topic (start=up message) I had once hacked guile to have a info-port, with initial welcome message and compile messages going to (current-info-port). Adding a command arg to set that to a file or /dev/null would fix both issues. Matt I think is it. --- libguile/ports.c-orig 2023-05-29 06:18:05.866508234 -0700 +++ libguile/ports.c2023-05-29 09:00:54.592316332 -0700 @@ -432,6 +432,7 @@ static SCM cur_outport_fluid = SCM_BOOL_F; static SCM cur_errport_fluid = SCM_BOOL_F; static SCM cur_warnport_fluid = SCM_BOOL_F; +static SCM cur_infoport_fluid = SCM_BOOL_F; static SCM cur_loadport_fluid = SCM_BOOL_F; SCM_DEFINE (scm_current_input_port, "current-input-port", 0, 0, 0, @@ -488,6 +489,18 @@ } #undef FUNC_NAME +SCM_DEFINE (scm_current_info_port, "current-info-port", 0, 0, 0, +(void), + "Return the port to which diagnostic information should be sent.") +#define FUNC_NAME s_scm_current_info_port +{ + if (scm_is_true (cur_infoport_fluid)) +return scm_fluid_ref (cur_infoport_fluid); + else +return SCM_BOOL_F; +} +#undef FUNC_NAME + SCM_DEFINE (scm_current_load_port, "current-load-port", 0, 0, 0, (), "Return the current-load-port.\n" @@ -545,6 +558,18 @@ } #undef FUNC_NAME +SCM +scm_set_current_info_port (SCM port) +#define FUNC_NAME "set-current-info-port" +{ + SCM oinfop = scm_fluid_ref (cur_infoport_fluid); + port = SCM_COERCE_OUTPORT (port); + SCM_VALIDATE_OPOUTPORT (1, port); + scm_fluid_set_x (cur_infoport_fluid, port); + return oinfop; +} +#undef FUNC_NAME + void scm_dynwind_current_input_port (SCM port) #define FUNC_NAME NULL @@ -4155,6 +4180,7 @@ scm_c_define ("%current-output-port-fluid", cur_outport_fluid); scm_c_define ("%current-error-port-fluid", cur_errport_fluid); scm_c_define ("%current-warning-port-fluid", cur_warnport_fluid); + scm_c_define ("%current-info-port-fluid", cur_infoport_fluid); } void @@ -4189,6 +4215,7 @@ cur_outport_fluid = scm_make_fluid (); cur_errport_fluid = scm_make_fluid (); cur_warnport_fluid = scm_make_fluid (); + cur_infoport_fluid = scm_make_fluid (); cur_loadport_fluid = scm_make_fluid (); default_port_encoding_var = @@ -4227,4 +4254,8 @@ (scm_t_subr) scm_current_error_port); scm_c_define_gsubr (s_scm_current_warning_port, 0, 0, 0, (scm_t_subr) scm_current_warning_port); + + /* Used by welcome and compiler routines. */ + scm_c_define_gsubr (s_scm_current_info_port, 0, 0, 0, + (scm_t_subr) scm_current_info_port); } --- module/ice-9/command-line.scm-orig 2023-05-29 09:45:37.186157673 -0700 +++ module/ice-9/command-line.scm 2023-05-29 10:36:29.730463604 -0700 @@ -135,6 +135,7 @@ files. --listen[=P] listen on a local port or a path for REPL clients; if P is not given, the default is local port 37146 + --info-file=PORT set output file for informative diagnostics -q inhibit loading of user init file --use-srfi=LS load SRFI modules for the SRFIs in LS, which is a list of numbers like \"2,13,14\" @@ -142,6 +143,7 @@ R6RS --r7rs change initial Guile environment to better support R7RS + -W don't print welcome message -h, --help display this help and exit -v, --version display version information and exit \\ read arguments from following script lines")) @@ -386,6 +388,14 @@ (parse args (cons '((@@ (system repl server) spawn-server)) out))) + ((string=? arg "--info-file") ; set info port +(parse args + (cons `(set-current-info-port + ',(open-file + (substring arg (string-length "--info-port=")) + "w")) + out))) + ((string-prefix? "--listen=" arg) ; start a repl server (parse args @@ -405,6 +415,12 @@ (error "unknown argument to --listen" out))) + #| + ((string=? "-W" arg) +(parse args + (cons '(skip-welcome) out))) + |# + ((or (string=? arg "-h") (string=? arg "--help")) (shell-usage usage-name #f) (exit 0)) --- module/ice-9/boot-9.scm-orig2023-05-29 10:40:16.405710774 -0700 +++ module/ice-9/boot-9.scm 2023-05-29 09:26:41.743249629 -0700 @@ -190,6 +190,13 @@ (newline (current-warning-port)) (car (last-pair stuff))) +(define (info . stuff) +
Re: Quiet compilation for scripting
On 3/15/24 1:47 PM, Marc Chantreux wrote: On Fri, Mar 15, 2024 at 08:00:09PM +0100, to...@tuxteam.de wrote: I think most of Guile user actually want this feature for a long time. I can understand. I agree. so do I. As mentioned on another topic (start=up message) I had once hacked guile to have a info-port, with initial welcome message and compile messages going to (current-info-port). Adding a command arg to set that to a file or /dev/null would fix both issues. Matt
Re: Quiet compilation for scripting
On Fri, Mar 15, 2024 at 08:00:09PM +0100, to...@tuxteam.de wrote: > > I think most of Guile user actually want this feature for a long time. > > I can understand. > I agree. so do I. -- Marc Chantreux Pôle CESAR (Calcul et services avancés à la recherche) Université de Strasbourg 14 rue René Descartes, BP 80010, 67084 STRASBOURG CEDEX 03.68.85.60.79
Re: Quiet compilation for scripting
On Fri, Mar 15, 2024 at 02:51:51PM -0400, Olivier Dion wrote: > On Fri, 15 Mar 2024, Keith Wright wrote: > > Olivier Dion writes: [supress auto-compilation warnings] > >> Not possible unfortunately :-( > > > > Why would this be unfortunate? This seems like a feature (non-bug). > > I think most of Guile user actually want this feature for a long time. > I can understand. I agree. Cheers -- t signature.asc Description: PGP signature
Re: Quiet compilation for scripting
On Fri, 15 Mar 2024, Keith Wright wrote: > Olivier Dion writes: > Like the warning says, you ought to either use the GUILE_AUTO_COMPILE environment variable or use the `--no-auto-compile' switch. Unfortunately, there is no `--quiet' or `--warning=/dev/null' option. >>> >>> I think the OP is fine with autocompilation (I even guess they expect >>> it, i.e. changing the source file and getting old behaviour would be >>> a surprise), they just want it to happen silently (as Tomas has hinted >>> at). >> >> Not possible unfortunately :-( > > Why would this be unfortunate? This seems like a feature (non-bug). I think most of Guile user actually want this feature for a long time. I can understand. > If it is autocompiling something you think is already compiled > then either your thought or the build/make/autocompile system is > buggy. It depends. You do not want to auto-compile script do you? You certainly do not want user to see this after installing your script. As for none-script files, I actually like the auto-compile warning. It tells me about changes in my project. -- Olivier Dion oldiob.ca
Re: Quiet compilation for scripting
Olivier Dion writes: >>> Like the warning says, you ought to either use the GUILE_AUTO_COMPILE >>> environment variable or use the `--no-auto-compile' switch. >>> Unfortunately, there is no `--quiet' or `--warning=/dev/null' option. >> >> I think the OP is fine with autocompilation (I even guess they expect >> it, i.e. changing the source file and getting old behaviour would be >> a surprise), they just want it to happen silently (as Tomas has hinted >> at). > > Not possible unfortunately :-( Why would this be unfortunate? This seems like a feature (non-bug). If it is autocompiling something you think is already compiled then either your thought or the build/make/autocompile system is buggy. Don't kill the message, fix the error. -- Keith
Re: Quiet compilation for scripting
On Fri, 15 Mar 2024, wrote: > On Fri, Mar 15, 2024 at 01:31:43PM -0400, Olivier Dion wrote: >> On Fri, 15 Mar 2024, ks...@sent.com wrote: >> > I am in the process of rewriting in Guile a script that I use >> > regularly. Running Guile 3.0.9, when I execute a file containing > > [...] > >> Like the warning says, you ought to either use the GUILE_AUTO_COMPILE >> environment variable or use the `--no-auto-compile' switch. >> Unfortunately, there is no `--quiet' or `--warning=/dev/null' option. > > I think the OP is fine with autocompilation (I even guess they expect > it, i.e. changing the source file and getting old behaviour would be > a surprise), they just want it to happen silently (as Tomas has hinted > at). Not possible unfortunately :-( -- Olivier Dion oldiob.ca
Re: Quiet compilation for scripting
On Fri, Mar 15, 2024 at 01:31:43PM -0400, Olivier Dion wrote: > On Fri, 15 Mar 2024, ks...@sent.com wrote: > > I am in the process of rewriting in Guile a script that I use > > regularly. Running Guile 3.0.9, when I execute a file containing [...] > Like the warning says, you ought to either use the GUILE_AUTO_COMPILE > environment variable or use the `--no-auto-compile' switch. > Unfortunately, there is no `--quiet' or `--warning=/dev/null' option. I think the OP is fine with autocompilation (I even guess they expect it, i.e. changing the source file and getting old behaviour would be a surprise), they just want it to happen silently (as Tomas has hinted at). Cheers -- tomás signature.asc Description: PGP signature
Re: Quiet compilation for scripting
On Fri, 15 Mar 2024, ks...@sent.com wrote: > I am in the process of rewriting in Guile a script that I use > regularly. Running Guile 3.0.9, when I execute a file containing > > #!/usr/local/bin/guile -s > !# > (display "Hello, mailing list!") > (newline) > > the following is printed to standard error: > > ;;; note: source file /Users/me/./test.scm > ;;; newer than compiled > /Users/me/.cache/guile/ccache/3.0-LE-8-4.6/Users/me/test.scm.go > ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 > ;;; or pass the --no-auto-compile argument to disable. > ;;; compiling /Users/me/./test.scm > ;;; compiled > /Users/me/.cache/guile/ccache/3.0-LE-8-4.6/Users/me/test.scm.go Like the warning says, you ought to either use the GUILE_AUTO_COMPILE environment variable or use the `--no-auto-compile' switch. Unfortunately, there is no `--quiet' or `--warning=/dev/null' option. What I typically do is to compile modules and not compile scripts (program entrypoints). So in the end, I have the following prologue for portable Guile script: --8<---cut here---start->8--- #!/bin/sh #-*-Scheme-*- GUILE="$(command -v guile || command -v guile3.0)" if [ -z "$GUILE" ]; then echo "Missing guile executable." exit 1 fi exec $GUILE --no-auto-compile -e main -s "$0" "$@" !# --8<---cut here---end--->8--- Note the usage of `--no-auto-compile' which will prevent Guile from auto-compiling file, while still loading already compiled modules. [...] -- Olivier Dion oldiob.ca
Re: Quiet compilation for scripting
Hello, On 2024-03-15 12:15:33 -0500, ks...@sent.com wrote: > I am in the process of rewriting in Guile a script that I use regularly. > Running Guile 3.0.9, when I execute a file containing > > #!/usr/local/bin/guile -s > !# > (display "Hello, mailing list!") > (newline) > > the following is printed to standard error: > > ;;; note: source file /Users/me/./test.scm > ;;; newer than compiled > /Users/me/.cache/guile/ccache/3.0-LE-8-4.6/Users/me/test.scm.go > ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 > ;;; or pass the --no-auto-compile argument to disable. > ;;; compiling /Users/me/./test.scm > ;;; compiled /Users/me/.cache/guile/ccache/3.0-LE-8-4.6/Users/me/test.scm.go > > While not showstopping, it would be preferable if there were a way to > suppress the message. You technically can disable the message by disabling the auto-compilation, which can be done using environment variable, or the flag, directly from the script file itself. However disabling it might not be always desired. > This has been mentioned here and in other venues previously [1][2][3], but > the last mention was over 10 years ago and perusal of the Guile manual > suggests nothing toward this end has been implemented yet. Would adding a > --quiet switch cause breakage? I think adding a switch to suppress the message should be fine, I think something like --auto-compilation-quiet or something would work. I would actually want that as well, but never got to writing the patch. Have a nice day, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. signature.asc Description: PGP signature