From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#20822: environment mangled by locale Date: Sat, 25 Jun 2016 21:10:48 -0400 Message-ID: <87wplcpxev.fsf@netris.org> References: <20150616041736.GA2718@fysh.org> <87eg7njfhk.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466903548 16392 80.91.229.3 (26 Jun 2016 01:12:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Jun 2016 01:12:28 +0000 (UTC) Cc: 20822@debbugs.gnu.org, Zefram , ludo@gnu.org To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Jun 26 03:12:17 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bGycR-0006Yk-J3 for guile-bugs@m.gmane.org; Sun, 26 Jun 2016 03:12:15 +0200 Original-Received: from localhost ([::1]:52036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGycN-0001Ik-Dg for guile-bugs@m.gmane.org; Sat, 25 Jun 2016 21:12:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGycI-0001IP-13 for bug-guile@gnu.org; Sat, 25 Jun 2016 21:12:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGycE-0002F3-NE for bug-guile@gnu.org; Sat, 25 Jun 2016 21:12:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGycE-0002Es-KI for bug-guile@gnu.org; Sat, 25 Jun 2016 21:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bGycE-0002JB-C2 for bug-guile@gnu.org; Sat, 25 Jun 2016 21:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 26 Jun 2016 01:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20822 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 20822-submit@debbugs.gnu.org id=B20822.14669034678813 (code B ref 20822); Sun, 26 Jun 2016 01:12:02 +0000 Original-Received: (at 20822) by debbugs.gnu.org; 26 Jun 2016 01:11:07 +0000 Original-Received: from localhost ([127.0.0.1]:55863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGybL-0002I4-LT for submit@debbugs.gnu.org; Sat, 25 Jun 2016 21:11:07 -0400 Original-Received: from world.peace.net ([50.252.239.5]:58669) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGybK-0002HZ-Ai for 20822@debbugs.gnu.org; Sat, 25 Jun 2016 21:11:06 -0400 Original-Received: from pool-71-174-35-80.bstnma.east.verizon.net ([71.174.35.80] helo=jojen) by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bGybD-0001Ko-RP; Sat, 25 Jun 2016 21:10:59 -0400 In-Reply-To: <87eg7njfhk.fsf@pobox.com> (Andy Wingo's message of "Fri, 24 Jun 2016 07:57:43 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) 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:8254 Archived-At: Andy Wingo writes: > On Tue 16 Jun 2015 06:17, Zefram writes: > >> When guile-2.0 is asked to read environment variables, via getenv, >> it always decodes the underlying octet string according to the current >> locale's nominal character encoding. This is a problem, because the >> environment variable's value is not necessarily encoded that way, and >> may not even be an encoding of a character string at all. The decoding >> is lossy, where the octet string isn't consistent with the character >> encoding, so the original octet string cannot be recovered from the >> mangled form. I don't see any Scheme interface that retrieves the >> environment without locale decoding. > > Options: > > Add optional "encoding" arg to scm_getenv; encoding is a string > > Add alternate getenv interface that returns a bytevector > > We'll have to do the same for setenv too, I think. > > I think I would go with adding an encoding argument to getenv. WDYT > Mark and Ludovic? I just don't see how this could be used sanely in actual practice. These things are conceptually strings, and by convention they are supposed to encoded in the locale encoding. If that convention is violated, I don't see what a program could do about it. Can someone show me a realistic example of how this would be used in practice? Mark