unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Removing the locale warning?
@ 2019-12-14 15:44 Ludovic Courtès
  2019-12-15  0:22 ` Brett Gilio
  2019-12-16 14:10 ` Andy Wingo
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-12-14 15:44 UTC (permalink / raw)
  To: Guile Devel; +Cc: Andy Wingo

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

Hello!

What about getting rid of the locale warning, as shown below?

More generally, I'm in favor of reducing run-time warnings to a bare
minimum, because application users often don’t care about them (plus
they’re not i18n’d), and because application developers cannot silence
them or handle them in a way that is more suitable for the application.

Thoughts?

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 930 bytes --]

diff --git a/libguile/guile.c b/libguile/guile.c
index fa5fef928..e8879caad 100644
--- a/libguile/guile.c
+++ b/libguile/guile.c
@@ -1,4 +1,4 @@
-/* Copyright 1996-1997,2000-2001,2006,2008,2011,2013,2018
+/* Copyright 1996-1997,2000-2001,2006,2008,2011,2013,2018,2019
      Free Software Foundation, Inc.
 
    This file is part of Guile.
@@ -88,8 +88,10 @@ main (int argc, char **argv)
      error messages, use the right locale.  See
      <https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00041.html>
      for the rationale.  */
-  if (should_install_locale () && setlocale (LC_ALL, "") == NULL)
-    fprintf (stderr, "guile: warning: failed to install locale\n");
+  if (should_install_locale ())
+    /* Silently ignore 'setlocale' failures.  It's up to the application
+       to handle it.  */
+    setlocale (LC_ALL, "");
 
   scm_install_gmp_memory_functions = 1;
   scm_boot_guile (argc, argv, inner_main, 0);

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

* Re: Removing the locale warning?
  2019-12-14 15:44 Removing the locale warning? Ludovic Courtès
@ 2019-12-15  0:22 ` Brett Gilio
  2019-12-16 14:10 ` Andy Wingo
  1 sibling, 0 replies; 4+ messages in thread
From: Brett Gilio @ 2019-12-15  0:22 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Andy Wingo, Guile Devel

Ludovic Courtès <ludo@gnu.org> writes:

> Hello!
>
> What about getting rid of the locale warning, as shown below?
>
> More generally, I'm in favor of reducing run-time warnings to a bare
> minimum, because application users often don’t care about them (plus
> they’re not i18n’d), and because application developers cannot silence
> them or handle them in a way that is more suitable for the application.
>
> Thoughts?
>
> Ludo’.
>
> diff --git a/libguile/guile.c b/libguile/guile.c
> index fa5fef928..e8879caad 100644
> --- a/libguile/guile.c
> +++ b/libguile/guile.c
> @@ -1,4 +1,4 @@
> -/* Copyright 1996-1997,2000-2001,2006,2008,2011,2013,2018
> +/* Copyright 1996-1997,2000-2001,2006,2008,2011,2013,2018,2019
>       Free Software Foundation, Inc.
>  
>     This file is part of Guile.
> @@ -88,8 +88,10 @@ main (int argc, char **argv)
>       error messages, use the right locale.  See
>       <https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00041.html>
>       for the rationale.  */
> -  if (should_install_locale () && setlocale (LC_ALL, "") == NULL)
> -    fprintf (stderr, "guile: warning: failed to install locale\n");
> +  if (should_install_locale ())
> +    /* Silently ignore 'setlocale' failures.  It's up to the application
> +       to handle it.  */
> +    setlocale (LC_ALL, "");
>  
>    scm_install_gmp_memory_functions = 1;
>    scm_boot_guile (argc, argv, inner_main, 0);
>

I like this idea, and it looks like it is handled well. It seems like
something we should move toward with our Guile 3 progress in my opinion.

-- 
Brett M. Gilio
Homepage -- https://scm.pw/
GNU Guix -- https://guix.gnu.org/



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

* Re: Removing the locale warning?
  2019-12-14 15:44 Removing the locale warning? Ludovic Courtès
  2019-12-15  0:22 ` Brett Gilio
@ 2019-12-16 14:10 ` Andy Wingo
  2019-12-16 16:06   ` Ludovic Courtès
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2019-12-16 14:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guile Devel

On Sat 14 Dec 2019 16:44, Ludovic Courtès <ludo@gnu.org> writes:

> What about getting rid of the locale warning?
>
> More generally, I'm in favor of reducing run-time warnings to a bare
> minimum, because application users often don’t care about them (plus
> they’re not i18n’d), and because application developers cannot silence
> them or handle them in a way that is more suitable for the application.
>
> Thoughts?

Funny, I find them really useful as they let me know when my environment
isn't correctly configured, so I can then take action.  How can we
resolve these two use cases?

Andy



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

* Re: Removing the locale warning?
  2019-12-16 14:10 ` Andy Wingo
@ 2019-12-16 16:06   ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-12-16 16:06 UTC (permalink / raw)
  To: Andy Wingo; +Cc: Guile Devel

Hi,

Andy Wingo <wingo@igalia.com> skribis:

> On Sat 14 Dec 2019 16:44, Ludovic Courtès <ludo@gnu.org> writes:
>
>> What about getting rid of the locale warning?
>>
>> More generally, I'm in favor of reducing run-time warnings to a bare
>> minimum, because application users often don’t care about them (plus
>> they’re not i18n’d), and because application developers cannot silence
>> them or handle them in a way that is more suitable for the application.
>>
>> Thoughts?
>
> Funny, I find them really useful as they let me know when my environment
> isn't correctly configured, so I can then take action.

Oh, I see.

> How can we resolve these two use cases?

Not sure.  Guix does an extra ‘setlocale’ call and prints a
user-friendly and Guix-specific message when the locale is unavailable:

  https://git.savannah.gnu.org/cgit/guix.git/tree/guix/ui.scm#n457

As an application developer, I feel that it’s the application’s job to
pay attention to that (when it matters) and it bothers me that libguile
prints its own warning (not i18n’d, not controllable, etc.), just like
it would bother me if libc were emitting such a warning.

Perhaps the REPL and the ‘guild’ script could emit such a warning, while
libguile itself would remain silent?

(I know that Perl and Bash emit a warning when ‘setlocale’ fails, while
Python doesn’t.  As for applications, I’ve seen all sorts of behaviors
ranging from silently ignoring the issue (Coreutils, sed, grep, Git,
etc.) to showing a popup window (Gramps) to emitting a warning (most
GTK+ programs).)

Thoughts?

Ludo’.



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

end of thread, other threads:[~2019-12-16 16:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-14 15:44 Removing the locale warning? Ludovic Courtès
2019-12-15  0:22 ` Brett Gilio
2019-12-16 14:10 ` Andy Wingo
2019-12-16 16:06   ` Ludovic Courtès

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 read-only IMAP folder(s) and NNTP newsgroup(s).