From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#22905: GUILE_INSTALL_LOCALE produces unavoidable noise Date: Tue, 9 Aug 2016 20:26:30 +0100 Message-ID: <20160809192630.GJ24721@fysh.org> References: <20160304141334.GC7946@fysh.org> <878tw8nswc.fsf@pobox.com> <20160807230013.GE24721@fysh.org> <87vazbm2vz.fsf@pobox.com> <20160808210229.GH24721@fysh.org> <87ziollu3d.fsf@pobox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1470770845 27261 195.159.176.226 (9 Aug 2016 19:27:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 9 Aug 2016 19:27:25 +0000 (UTC) Cc: 22905@debbugs.gnu.org To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Aug 09 21:27:21 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXCgK-0006z3-3D for guile-bugs@m.gmane.org; Tue, 09 Aug 2016 21:27:20 +0200 Original-Received: from localhost ([::1]:37715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXCgG-0001qC-Vs for guile-bugs@m.gmane.org; Tue, 09 Aug 2016 15:27:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXCg8-0001o3-33 for bug-guile@gnu.org; Tue, 09 Aug 2016 15:27:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXCg2-00005Y-07 for bug-guile@gnu.org; Tue, 09 Aug 2016 15:27:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXCg1-00005U-TW for bug-guile@gnu.org; Tue, 09 Aug 2016 15:27:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bXCg1-00071f-KZ for bug-guile@gnu.org; Tue, 09 Aug 2016 15:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 09 Aug 2016 19:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22905 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 22905-submit@debbugs.gnu.org id=B22905.147077079626973 (code B ref 22905); Tue, 09 Aug 2016 19:27:01 +0000 Original-Received: (at 22905) by debbugs.gnu.org; 9 Aug 2016 19:26:36 +0000 Original-Received: from localhost ([127.0.0.1]:33382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXCfc-00070z-4h for submit@debbugs.gnu.org; Tue, 09 Aug 2016 15:26:36 -0400 Original-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 ) id 1bXCfb-00070r-6B for 22905@debbugs.gnu.org; Tue, 09 Aug 2016 15:26:35 -0400 Original-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 Content-Disposition: inline In-Reply-To: <87ziollu3d.fsf@pobox.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8374 Archived-At: 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