GNU bug report logs - #22905
GUILE_INSTALL_LOCALE produces unavoidable noise

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Zefram <zefram@HIDDEN>; dated Fri, 4 Mar 2016 14:14:02 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at 22905 <at> debbugs.gnu.org:


Received: (at 22905) by debbugs.gnu.org; 9 Aug 2016 19:26:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 09 15:26:36 2016
Received: from localhost ([127.0.0.1]:33382 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bXCfc-00070z-4h
	for submit <at> debbugs.gnu.org; Tue, 09 Aug 2016 15:26:36 -0400
Received: from river.fysh.org ([87.98.248.19]:48339 ident=Debian-exim)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zefram@HIDDEN>) id 1bXCfb-00070r-6B
 for 22905 <at> debbugs.gnu.org; Tue, 09 Aug 2016 15:26:35 -0400
Received: from zefram by river.fysh.org with local (Exim 4.84_2 #1 (Debian))
 id 1bXCfW-00015r-Up; Tue, 09 Aug 2016 20:26:30 +0100
Date: Tue, 9 Aug 2016 20:26:30 +0100
From: Zefram <zefram@HIDDEN>
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#22905: GUILE_INSTALL_LOCALE produces unavoidable noise
Message-ID: <20160809192630.GJ24721@HIDDEN>
References: <20160304141334.GC7946@HIDDEN> <878tw8nswc.fsf@HIDDEN>
 <20160807230013.GE24721@HIDDEN> <87vazbm2vz.fsf@HIDDEN>
 <20160808210229.GH24721@HIDDEN> <87ziollu3d.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87ziollu3d.fsf@HIDDEN>
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 22905
Cc: 22905 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

Andy Wingo wrote:
>#!/bin/sh
>export FOO=bar
>exec guile $0 "$@"
>!#

That introduces all the complexity of using another language interpreter,
one I've chosen not to write my program in.  I don't much fancy working
round a gotcha by importing another series of gotchas.

Fundamentally, it seems like an admission of defeat.  With care it would
work, but means that Guile is not itself the platform on which to write
a Unix program.  Maybe you're OK with the idea that Guile programs aren't
meant to run in their own right.  Would you be OK with documenting it?

It also means that the Guile program isn't actually seeing the user's
environment, and so doesn't accurately pass that environment through to
anything that it runs in turn.  Working around that would involve some
hairy and error-prone shell code.

>This is certainly possible to do.  Actually I would guess that this
>works:
>
>  (setlocale LC_ALL "")

That succeeds in signalling an error in any case where the environmental
locale doesn't exist, but that's not really what I want.  If the
framework didn't perform an implicit setlocale, and so didn't mar my
output, I don't then want to make things break.

That approach is also totally specific to the setlocale warning.
If program-running-with-unclean-output were to exist, it should also
cover uncleanliness due to auto-compile banners (bug#16364).  It would
be the solution (though not a great one) to both problems.

>Does any of this work for you?

Shell script wrapper is the closest so far, but it's nasty.  You haven't
proposed any real solution.

The really simple solution would be to remove this switch from the
environment entirely, and remove the implicit setlocale from the startup
sequence entirely.  The environment was always the wrong place for the
switch, and there's no benefit in the implicit setlocale being as early
as it is.  The decision on whether to engage with the user's locale is
then made entirely by the program, as part of its ordinary execution.
If it wants to use the user's locale, it executes (setlocale LC_ALL
"").  If it wants non-default handling of errors, it executes that in
the dynamic scope of whatever throw or catch handler it likes.  If it
doesn't want to use the user's locale, it doesn't execute that.  Bonus:
works identically on older Guile versions.

If you won't go for the simple solution, then a proper solution
that maintains the default implicit setlocale would be to have
a switch in a magic comment in the program file.  Something like
"#!GUILE_INSTALL_LOCALE=0\n!#\n" immediately following the program's
initial #!...!# block.  This is ignored as a comment by older Guile
versions.  The semantic on newer versions would be that the setting given
there (which may be 0 or 1) determines conclusively whether the implicit
setlocale happens.  The environment variable would take effect as it
currently does only for programs not containing this kind of setting.

-zefram




Information forwarded to bug-guile@HIDDEN:
bug#22905; Package guile. Full text available.

Message received at 22905 <at> debbugs.gnu.org:


Received: (at 22905) by debbugs.gnu.org; 9 Aug 2016 17:40:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 09 13:40:03 2016
Received: from localhost ([127.0.0.1]:33353 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bXB0V-0004dD-4e
	for submit <at> debbugs.gnu.org; Tue, 09 Aug 2016 13:40:03 -0400
Received: from pb-sasl2.pobox.com ([64.147.108.67]:50145
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bXB0T-0004ck-9w
 for 22905 <at> debbugs.gnu.org; Tue, 09 Aug 2016 13:40:01 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 9B07C2E9A0;
 Tue,  9 Aug 2016 13:39:58 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=sasl; bh=bPvecZLdmR3hMGjnphRZrPGoJFM=; b=PSf13U
 Q362eLBC8g/an0hymPNO69UZusth1wLGqQgurmFI/a3R71X100S7ep946jZxFTEi
 lif10DyjCpEdLGyselkBe2WT8+MBGbpoYVtPU7wKR3857u6QRyNKpdGLml3yyKs4
 q1eQI2bTFiaoi8duhBJmOqfPobS447KgaKDJ4=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; q=dns; s=sasl; b=iQd2NPAC1tfbXnyuhRVoSIqq7Q6zgN2t
 oCvw14lW7hiLU1Cd0emzLdCKlGKKO2xMG9M9yf9u4epAl5GdD1unG14yW62S5/gI
 hS3jpxEa2d7xv8FK383aE1bfnjLr/je7iZBK5x3dKLGVEVAoJy3kqA6JdxRt2fnv
 A+8JE5raOfY=
Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 9422C2E99F;
 Tue,  9 Aug 2016 13:39:58 -0400 (EDT)
Received: from clucks (unknown [88.160.190.192])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by pb-sasl2.pobox.com (Postfix) with ESMTPSA id AA6B12E99E;
 Tue,  9 Aug 2016 13:39:57 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
To: Zefram <zefram@HIDDEN>
Subject: Re: bug#22905: GUILE_INSTALL_LOCALE produces unavoidable noise
References: <20160304141334.GC7946@HIDDEN> <878tw8nswc.fsf@HIDDEN>
 <20160807230013.GE24721@HIDDEN> <87vazbm2vz.fsf@HIDDEN>
 <20160808210229.GH24721@HIDDEN>
Date: Tue, 09 Aug 2016 19:39:50 +0200
In-Reply-To: <20160808210229.GH24721@HIDDEN> (zefram@HIDDEN's message of
 "Mon, 8 Aug 2016 22:02:29 +0100")
Message-ID: <87ziollu3d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 4A68B62A-5E58-11E6-8349-28A6F1301B6D-02397024!pb-sasl2.pobox.com
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 22905
Cc: 22905 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

On Mon 08 Aug 2016 23:02, Zefram <zefram@HIDDEN> writes:

> Andy Wingo wrote:
>>Serious question tho: what sort of back-compatibility can there be with
>>a Guile that only supports latin-1 strings?
>
> I'd expect that almost any program that runs on Guile 1.8 ought to be
> portable, with only minimal modifications, to later versions of Guile.

I'm with you :)  We did (and do) our best but some problems remain.  I'm
not sure which ones are incidental and which ones are essential.
Probably some are essential though and need to be minimized and then
documented.

> The particular problem that arises is that a possible form for a
> warning-muffling switch would be a command-line switch that goes on the
> #! line.  Any new switch of that nature wouldn't be recognised by Guile
> 1.8, and would cause an error when attempting to run the program on 1.8.

Just thinking out loud here, what about something like:

#!/bin/sh
export FOO=bar
exec guile $0 "$@"
!#

Various FOO=bar things that could work for you:

  LC_ALL=C
  GUILE_INSTALL_LOCALE=0

It doesn't work if you run "guile myscript.scm" but it would work as a
./myscript.scm.

>>How would this work?
>
> I imagine a builtin function that returns a truth value saying whether
> the Guile framework has emitted a warning before running the program.
> Suppose it's called "program-running-with-unclean-output".  Then those
> who particularly want clean output can write something like
>
>     (when (program-running-with-unclean-output)
>       (error "can't run after warnings"))
>
> This doesn't avoid the warning appearing, but does avoid treating a
> run marred by the warning as a successful program run.  The program's
> checking code can easily be made portable back to Guile versions lacking
> the new function, by using cond-expand, false-if-exception, or other
> metaprogramming facilities.

This is certainly possible to do.  Actually I would guess that this
works:

  (setlocale LC_ALL "")

E.g.

$ GUILE_INSTALL_LOCALE=1 LC_ALL=sadfadf guile -c '(setlocale LC_ALL "")'
guile: warning: failed to install locale
Backtrace:
In ice-9/boot-9.scm:
 157: 7 [catch #t #<catch-closure 24c1900> ...]
In unknown file:
   ?: 6 [apply-smob/1 #<catch-closure 24c1900>]
In ice-9/boot-9.scm:
  63: 5 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 4 [eval # #]
In unknown file:
   ?: 3 [call-with-input-string "(setlocale LC_ALL \"\")" ...]
In ice-9/command-line.scm:
 180: 2 [#<procedure 24d2400 at ice-9/command-line.scm:175:6 (port)> #<input: string 2271680>]
In unknown file:
   ?: 1 [eval (setlocale LC_ALL "") #<directory (guile-user) 24b4c60>]
   ?: 0 [setlocale 6 ""]

ERROR: In procedure setlocale:
ERROR: In procedure setlocale: Invalid argument

Does any of this work for you?

Andy




Information forwarded to bug-guile@HIDDEN:
bug#22905; Package guile. Full text available.

Message received at 22905 <at> debbugs.gnu.org:


Received: (at 22905) by debbugs.gnu.org; 8 Aug 2016 21:02:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 08 17:02:35 2016
Received: from localhost ([127.0.0.1]:60400 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bWrgx-0006Zt-PI
	for submit <at> debbugs.gnu.org; Mon, 08 Aug 2016 17:02:35 -0400
Received: from river.fysh.org ([87.98.248.19]:58736 ident=Debian-exim)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zefram@HIDDEN>) id 1bWrgv-0006Zj-Hn
 for 22905 <at> debbugs.gnu.org; Mon, 08 Aug 2016 17:02:34 -0400
Received: from zefram by river.fysh.org with local (Exim 4.84_2 #1 (Debian))
 id 1bWrgr-0000ex-LY; Mon, 08 Aug 2016 22:02:29 +0100
Date: Mon, 8 Aug 2016 22:02:29 +0100
From: Zefram <zefram@HIDDEN>
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#22905: GUILE_INSTALL_LOCALE produces unavoidable noise
Message-ID: <20160808210229.GH24721@HIDDEN>
References: <20160304141334.GC7946@HIDDEN> <878tw8nswc.fsf@HIDDEN>
 <20160807230013.GE24721@HIDDEN> <87vazbm2vz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87vazbm2vz.fsf@HIDDEN>
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 22905
Cc: 22905 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

Andy Wingo wrote:
>If you would like for me to work on your bugs then I would appreciate it
>if you would keep things constructive.  Thanks :)

I'm sorry that that bit came across badly.  I do appreciate your efforts.

>Serious question tho: what sort of back-compatibility can there be with
>a Guile that only supports latin-1 strings?

I'd expect that almost any program that runs on Guile 1.8 ought to be
portable, with only minimal modifications, to later versions of Guile.
Obviously this wouldn't work the other way round: if a program relies
on 2.0's non-Latin-1 strings then it can't be easily ported back to 1.8.
But lots of programs work fine on 1.8, either not processing non-Latin-1
data or processing it in forms other than the builtin string type.
Scheme was a good programming language long before Unicode came along.

>                                             What property is it that
>you are going for here?

In that bit, I'm going for it being possible for a program to run on
both Guile 1.8 and Guile 2.N while avoiding the new locale warning
from Guile 2.N.  This should be a single program file, starting with a
"#!/usr/bin/guile" line, where /usr/bin/guile may refer to either version
of Guile.  This would be especially relevant for a program originally
written for Guile 1.8, but more generally is relevant for any program
that doesn't need any of 2.0's new capabilities.

The particular problem that arises is that a possible form for a
warning-muffling switch would be a command-line switch that goes on the
#! line.  Any new switch of that nature wouldn't be recognised by Guile
1.8, and would cause an error when attempting to run the program on 1.8.

>What about GUILE_INSTALL_LOCALE=require or something like that?

In the environment?  That's still not controllable by the program.  The
environment is the wrong place for any switch that needs to be the choice
of the program.  Whether to engage with the environmentally-suggested
locale ought to be the choice of the program.

>How would this work?

I imagine a builtin function that returns a truth value saying whether
the Guile framework has emitted a warning before running the program.
Suppose it's called "program-running-with-unclean-output".  Then those
who particularly want clean output can write something like

    (when (program-running-with-unclean-output)
      (error "can't run after warnings"))

This doesn't avoid the warning appearing, but does avoid treating a
run marred by the warning as a successful program run.  The program's
checking code can easily be made portable back to Guile versions lacking
the new function, by using cond-expand, false-if-exception, or other
metaprogramming facilities.

-zefram




Information forwarded to bug-guile@HIDDEN:
bug#22905; Package guile. Full text available.

Message received at 22905 <at> debbugs.gnu.org:


Received: (at 22905) by debbugs.gnu.org; 8 Aug 2016 20:17:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 08 16:17:48 2016
Received: from localhost ([127.0.0.1]:60358 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bWqzc-0005NZ-PB
	for submit <at> debbugs.gnu.org; Mon, 08 Aug 2016 16:17:48 -0400
Received: from pb-sasl1.pobox.com ([64.147.108.66]:62816
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bWqza-0005NR-TD
 for 22905 <at> debbugs.gnu.org; Mon, 08 Aug 2016 16:17:47 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id 61C112FC8C;
 Mon,  8 Aug 2016 16:17:45 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=sasl; bh=YQ4kNJXAaQIKsHL6BiFzqv0UDTk=; b=VvKCbR
 TejL9QQo5rYhwWFUctS6v0z3V1J7Ze4Igfwl4xhEOiMQOaD0bTC7wTwpkfUIFWRj
 tqhu+R1rL1gQyKNlw8tn1L5vykBhtObChehxkbH2ZqopFuMsdk3ZPMIGW/da0U2z
 XQGuXqoNzUXP5f/IIjTkbNk5Bx4sMYDCya5FU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; q=dns; s=sasl; b=rBx0HRK5sj9tUrfCNkr7jOZDYiJMwBNW
 T/S2NnkG/aLL/mPrax9Jg2EnyaUATYX8UbY67rTuTq13DCXrt1nIQ7HCQw02EUuw
 DMNpNVEudzoz8zJXOP9cE0pTxtxBQ8SRAj7Wb0pXrqW2M6gBTXhdDabHkHCFRQlS
 4tWJ6P+p52U=
Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id 5B5AA2FC8A;
 Mon,  8 Aug 2016 16:17:45 -0400 (EDT)
Received: from clucks (unknown [88.160.190.192])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 6A9892FC85;
 Mon,  8 Aug 2016 16:17:44 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
To: Zefram <zefram@HIDDEN>
Subject: Re: bug#22905: GUILE_INSTALL_LOCALE produces unavoidable noise
References: <20160304141334.GC7946@HIDDEN> <878tw8nswc.fsf@HIDDEN>
 <20160807230013.GE24721@HIDDEN>
Date: Mon, 08 Aug 2016 22:17:36 +0200
In-Reply-To: <20160807230013.GE24721@HIDDEN> (zefram@HIDDEN's message of
 "Mon, 8 Aug 2016 00:00:13 +0100")
Message-ID: <87vazbm2vz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 2AA394B2-5DA5-11E6-90D8-C1836462E9F6-02397024!pb-sasl1.pobox.com
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 22905
Cc: 22905 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

Hello,

On Mon 08 Aug 2016 01:00, Zefram <zefram@HIDDEN> writes:

> Andy Wingo wrote:
>>I believe this is consistent with other programs which call setlocale,
>>notably Perl and Bash.
>
> It is consistent with them, but the fact that others get it wrong isn't
> an excuse.

I would like to let you know that I am working on this in my free time
and in that context I don't respond well to blame, "excuses", and so on.
If you would like for me to work on your bugs then I would appreciate it
if you would keep things constructive.  Thanks :)

>>avoid the call to setlocale, and Guile offers the GUILE_INSTALL_LOCALE=0
>>knob to do this.
>
> That knob is not available to the program.  If you provide a knob that
> the program can control, independent of the environment, with backward
> compatibility to Guile 1.8, then we can consider the setlocale call
> avoidable.

Serious question tho: what sort of back-compatibility can there be with
a Guile that only supports latin-1 strings?  What property is it that
you are going for here?

> Emitting a warning and then running the program anyway is
> fundamentally broken behaviour

My guess is that many people want exactly this behavior.  Only a guess
of course.

What about GUILE_INSTALL_LOCALE=require or something like that?  Does
that suit your needs?  If not, then:

> Some way for the program to detect that you've screwed up its output,
> so that it can decide to abort rather than continue with faulty output,
> would be another middle way.

How would this work?

Regards,

Andy




Information forwarded to bug-guile@HIDDEN:
bug#22905; Package guile. Full text available.

Message received at 22905 <at> debbugs.gnu.org:


Received: (at 22905) by debbugs.gnu.org; 7 Aug 2016 23:00:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 19:00:19 2016
Received: from localhost ([127.0.0.1]:59329 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bWX3L-0004O5-83
	for submit <at> debbugs.gnu.org; Sun, 07 Aug 2016 19:00:19 -0400
Received: from river.fysh.org ([87.98.248.19]:40951 ident=Debian-exim)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zefram@HIDDEN>) id 1bWX3J-0004Nw-JF
 for 22905 <at> debbugs.gnu.org; Sun, 07 Aug 2016 19:00:18 -0400
Received: from zefram by river.fysh.org with local (Exim 4.84_2 #1 (Debian))
 id 1bWX3F-0006s3-5f; Mon, 08 Aug 2016 00:00:13 +0100
Date: Mon, 8 Aug 2016 00:00:13 +0100
From: Zefram <zefram@HIDDEN>
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#22905: GUILE_INSTALL_LOCALE produces unavoidable noise
Message-ID: <20160807230013.GE24721@HIDDEN>
References: <20160304141334.GC7946@HIDDEN>
 <878tw8nswc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <878tw8nswc.fsf@HIDDEN>
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 22905
Cc: 22905 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

Andy Wingo wrote:
>I believe this is consistent with other programs which call setlocale,
>notably Perl and Bash.

It is consistent with them, but the fact that others get it wrong isn't
an excuse.

>avoid the call to setlocale, and Guile offers the GUILE_INSTALL_LOCALE=0
>knob to do this.

That knob is not available to the program.  If you provide a knob that
the program can control, independent of the environment, with backward
compatibility to Guile 1.8, then we can consider the setlocale call
avoidable.

>          Probably adding the suggestion to the warning is the right
>thing; wdyt?

No, that's not an improvement.  Emitting a warning and then running
the program anyway is fundamentally broken behaviour, and tweaking the
content of the warning doesn't help.

Some way for the program to detect that you've screwed up its output,
so that it can decide to abort rather than continue with faulty output,
would be another middle way.

-zefram




Information forwarded to bug-guile@HIDDEN:
bug#22905; Package guile. Full text available.

Message received at 22905 <at> debbugs.gnu.org:


Received: (at 22905) by debbugs.gnu.org; 7 Aug 2016 21:58:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 17:58:23 2016
Received: from localhost ([127.0.0.1]:59299 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bWW5P-0002wd-Ay
	for submit <at> debbugs.gnu.org; Sun, 07 Aug 2016 17:58:23 -0400
Received: from pb-sasl2.pobox.com ([64.147.108.67]:55371
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bWW5N-0002wV-By
 for 22905 <at> debbugs.gnu.org; Sun, 07 Aug 2016 17:58:21 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 9522430B61;
 Sun,  7 Aug 2016 17:58:19 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=sasl; bh=2ZTjqENFSqJDdFMkBO3Pn3Su7z4=; b=RnNaVb
 oQSBYajXhIMVLzQokF6X1rWZNe8J+2pQecPuj3s7vsJtB5vdldL8PE1Fn2GCpUiZ
 HIwd1SOFyb/6fvgjrzUALKDVvOJlF8ghFOaXwU/Raq9Lr+Y6NKAhhCNTsOgN5PD3
 T+3QX9B0QhdtV1k6kR5VCiAlGr0ThEIYSNqMs=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; q=dns; s=sasl; b=nw9GkwV/UfPJJzpsxxpVpuP0O3ZPf9je
 2owHpvtuqTW3HKBiYI0JqupbXtlqfgsXrIrBelUXOqgCuOvpOsvVALGr8og82/Hf
 VshGWUDr1tZr+CGrQytPbHNkZxjL0xNBjN3wIqA/Wkz/H2ESJKEjKTAXNlo/cEj8
 EsFSAUD3DT4=
Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 8DB6A30B60;
 Sun,  7 Aug 2016 17:58:19 -0400 (EDT)
Received: from clucks (unknown [88.160.190.192])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by pb-sasl2.pobox.com (Postfix) with ESMTPSA id A8E1930B5F;
 Sun,  7 Aug 2016 17:58:18 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
To: Zefram <zefram@HIDDEN>
Subject: Re: bug#22905: GUILE_INSTALL_LOCALE produces unavoidable noise
References: <20160304141334.GC7946@HIDDEN>
Date: Sun, 07 Aug 2016 23:58:11 +0200
In-Reply-To: <20160304141334.GC7946@HIDDEN> (zefram@HIDDEN's message of
 "Fri, 4 Mar 2016 14:13:34 +0000")
Message-ID: <878tw8nswc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 0CE4F3D2-5CEA-11E6-96D8-28A6F1301B6D-02397024!pb-sasl2.pobox.com
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 22905
Cc: 22905 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

On Fri 04 Mar 2016 15:13, Zefram <zefram@HIDDEN> writes:

> GUILE_INSTALL_LOCALE=1 breaks some of the robustness of non-locale-using
> programs, marring their stderr output if the environment's locale settings
> are faulty.

I believe this is consistent with other programs which call setlocale,
notably Perl and Bash.  I think the right way to avoid the output is to
avoid the call to setlocale, and Guile offers the GUILE_INSTALL_LOCALE=0
knob to do this.

> However, if it is deemed to be essential that Guile attempt the implicit
> setlocale and gripe about its failure, then the message should not
> precede or otherwise mix with the actual program run.  The message should
> be emitted *instead of* running the program, declaring the absolute
> incompatibility of the Guile framework with this environmental condition.

Your suggestion is not what Perl or Bash does, FWIW.  But it is
possible -- we could emit an error and require the user to run with
GUILE_INSTALL_LOCALE=0.  Or we could add that suggestion to the
warning.  Probably adding the suggestion to the warning is the right
thing; wdyt?  Try "LC_ALL=fasdada perl" for an example.

Andy




Information forwarded to bug-guile@HIDDEN:
bug#22905; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Mar 2016 14:13:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 09:13:48 2016
Received: from localhost ([127.0.0.1]:60934 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1abqUG-0006U6-8W
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 09:13:48 -0500
Received: from eggs.gnu.org ([208.118.235.92]:33699)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <zefram@HIDDEN>) id 1abqUF-0006Tv-6H
 for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 09:13:47 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abqU9-0004V3-4R
 for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 09:13:42 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:33349)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abqU9-0004Uz-1U
 for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 09:13:41 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52903)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abqU7-000444-TH
 for bug-guile@HIDDEN; Fri, 04 Mar 2016 09:13:40 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abqU6-0004Ue-TO
 for bug-guile@HIDDEN; Fri, 04 Mar 2016 09:13:39 -0500
Received: from river6.fysh.org ([2001:41d0:d:20da::2]:51582
 helo=river.fysh.org) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abqU6-0004UR-Mf
 for bug-guile@HIDDEN; Fri, 04 Mar 2016 09:13:38 -0500
Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian))
 id 1abqU2-0007fz-Vg; Fri, 04 Mar 2016 14:13:34 +0000
Date: Fri, 4 Mar 2016 14:13:34 +0000
From: Zefram <zefram@HIDDEN>
To: bug-guile@HIDDEN
Subject: GUILE_INSTALL_LOCALE produces unavoidable noise
Message-ID: <20160304141334.GC7946@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

GUILE_INSTALL_LOCALE=1 breaks some of the robustness of non-locale-using
programs, marring their stderr output if the environment's locale settings
are faulty.

Suppose you have a program written in Guile Scheme that doesn't use any
locale facilities.  To be portable to the GUILE_INSTALL_LOCALE=1 situation
(which the documentation threatens will become the default in Guile 2.2),
it must be prepared to start up with some locale already selected, and
reconfigure from there as required.  Being a conscientious programmer,
you are of course willing to add the (setlocale LC_ALL "C") and whatever
other invocations are required to recover the non-locale state.  But then
this situation arises:

$ LANG=wibble GUILE_INSTALL_LOCALE=1 guile-2.0 -c '(setlocale LC_ALL "C") (write "hi") (newline)'
guile: warning: failed to install locale
"hi"

The warning shown goes to the program's stderr.  It does not come from
the program's setlocale call, which is succeeding and would signal a
perfectly ordinary (catchable) exception if it failed.  The warning comes
from the implicit setlocale call triggered by GUILE_INSTALL_LOCALE=1,
before the program gains control.  As far as I can see, there is no way
for the program to prevent the failing setlocale attempt or to muffle
the warning.  Or even to detect that this has happened.

Guile should not be saying anything on the program's stderr.  This is
damaging the program's visible behaviour, and making it impossible to
effectively port non-locale programs to new Guile versions.

If Guile must attempt this implicit setlocale and continue to run the
program if it fails, then it needs to keep quiet about the failure.
This is no disadvantage to a program that actually wants to use the
environmental locale, because the program is free to call (setlocale
LC_ALL "") itself and handle its failure in whatever manner it finds
appropriate.  Indeed, any such program predating Guile 2.0 must already
be performing that call itself, because the implicit setlocale didn't
occur then.  The same for any program portable to pre-2.0 Guiles.  And on
Guile 2.0+ such a program still really needs to perform the call itself,
because it can't predict how GUILE_INSTALL_LOCALE will be set in the
environment, so still can't rely on the implicit setlocale happening.

However, if it is deemed to be essential that Guile attempt the implicit
setlocale and gripe about its failure, then the message should not
precede or otherwise mix with the actual program run.  The message should
be emitted *instead of* running the program, declaring the absolute
incompatibility of the Guile framework with this environmental condition.

-zefram




Acknowledgement sent to Zefram <zefram@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#22905; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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