X-Loop: help-debbugs@HIDDEN Subject: bug#22910: read-only setlocale has side effect Resent-From: Zefram <zefram@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-guile@HIDDEN Resent-Date: Fri, 04 Mar 2016 16:50:01 +0000 Resent-Message-ID: <handler.22910.B.145711015315214 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 22910 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 22910 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-guile@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.145711015315214 (code B ref -1); Fri, 04 Mar 2016 16:50:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Mar 2016 16:49:13 +0000 Received: from localhost ([127.0.0.1]:33974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1absuf-0003xK-0b for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 11:49:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37441) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <zefram@HIDDEN>) id 1absud-0003x9-RO for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 11:49:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <zefram@HIDDEN>) id 1absuY-0006am-3t for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 11:49:06 -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]:48463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <zefram@HIDDEN>) id 1absuY-0006af-1E for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 11:49:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <zefram@HIDDEN>) id 1absuX-0007Dr-2U for bug-guile@HIDDEN; Fri, 04 Mar 2016 11:49:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <zefram@HIDDEN>) id 1absuW-0006aC-An for bug-guile@HIDDEN; Fri, 04 Mar 2016 11:49:04 -0500 Received: from river6.fysh.org ([2001:41d0:d:20da::2]:54450 helo=river.fysh.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <zefram@HIDDEN>) id 1absuW-0006a1-51 for bug-guile@HIDDEN; Fri, 04 Mar 2016 11:49:04 -0500 Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1absuR-0004eV-CA; Fri, 04 Mar 2016 16:48:59 +0000 Date: Fri, 4 Mar 2016 16:48:59 +0000 From: Zefram <zefram@HIDDEN> Message-ID: <20160304164859.GE7946@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-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 (-----) A call to setlocale with no second argument is documented to be a read-only operation, querying the current locale configuration. In fact it has a side effect of setting the encoding on primordial ports: $ guile-2.0 -c '(write (port-encoding (current-input-port))) (newline) (setlocale LC_TIME) (write (port-encoding (current-input-port))) (newline)' #f "ANSI_X3.4-1968" Observe that this occurs even if the locale reading operation is for a category unrelated to character encoding. The actual decoding behaviour of read-char is altered in accordance with the reported encoding. Non-primordial ports opened before or after the setlocale call are not affected. -zefram
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Zefram <zefram@HIDDEN> Subject: bug#22910: Acknowledgement (read-only setlocale has side effect) Message-ID: <handler.22910.B.145711015315214.ack <at> debbugs.gnu.org> References: <20160304164859.GE7946@HIDDEN> X-Gnu-PR-Message: ack 22910 X-Gnu-PR-Package: guile Reply-To: 22910 <at> debbugs.gnu.org Date: Fri, 04 Mar 2016 16:50:01 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-guile@HIDDEN If you wish to submit further information on this problem, please send it to 22910 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 22910: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D22910 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#22910: read-only setlocale has side effect Resent-From: Zefram <zefram@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-guile@HIDDEN Resent-Date: Fri, 04 Mar 2016 19:56:02 +0000 Resent-Message-ID: <handler.22910.B22910.14571213061931 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 22910 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 22910 <at> debbugs.gnu.org Received: via spool by 22910-submit <at> debbugs.gnu.org id=B22910.14571213061931 (code B ref 22910); Fri, 04 Mar 2016 19:56:02 +0000 Received: (at 22910) by debbugs.gnu.org; 4 Mar 2016 19:55:06 +0000 Received: from localhost ([127.0.0.1]:34083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1abvoX-0000V5-T3 for submit <at> debbugs.gnu.org; Fri, 04 Mar 2016 14:55:06 -0500 Received: from river.fysh.org ([87.98.248.19]:48810 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <zefram@HIDDEN>) id 1abvoW-0000Uw-Um for 22910 <at> debbugs.gnu.org; Fri, 04 Mar 2016 14:55:05 -0500 Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1abvoS-0004EY-2y; Fri, 04 Mar 2016 19:55:00 +0000 Date: Fri, 4 Mar 2016 19:55:00 +0000 From: Zefram <zefram@HIDDEN> Message-ID: <20160304195500.GA14310@HIDDEN> References: <20160304164859.GE7946@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160304164859.GE7946@HIDDEN> X-Spam-Score: -0.0 (/) 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.0 (/) Additional information: setlocale's side effect on primordial ports happens even if the port's encoding has been individually set using set-port-encoding!. This means that to maintain a specific encoding on these ports (other than the locale's nominal encoding, which is likely to not be binary compatible) it is necessary to set the encoding repeatedly, before any I/O operation after setlocale might have been called. Since the read-only mode of setlocale has this effect, and arbitrary library code might feel entitled to call setlocale for read purposes without documenting that it does so, this really amounts to setting the encoding before every I/O operation. -zefram
X-Loop: help-debbugs@HIDDEN Subject: bug#22910: read-only setlocale has side effect Resent-From: Andy Wingo <wingo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-guile@HIDDEN Resent-Date: Sun, 07 Aug 2016 22:00:02 +0000 Resent-Message-ID: <handler.22910.B22910.147060714611415 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 22910 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Zefram <zefram@HIDDEN> Cc: 22910 <at> debbugs.gnu.org Received: via spool by 22910-submit <at> debbugs.gnu.org id=B22910.147060714611415 (code B ref 22910); Sun, 07 Aug 2016 22:00:02 +0000 Received: (at 22910) by debbugs.gnu.org; 7 Aug 2016 21:59:06 +0000 Received: from localhost ([127.0.0.1]:59303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1bWW66-0002y3-Io for submit <at> debbugs.gnu.org; Sun, 07 Aug 2016 17:59:06 -0400 Received: from pb-sasl2.pobox.com ([64.147.108.67]:56068 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <wingo@HIDDEN>) id 1bWW65-0002xw-9C for 22910 <at> debbugs.gnu.org; Sun, 07 Aug 2016 17:59:05 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 13DF030B70; Sun, 7 Aug 2016 17:59:05 -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=fSsaBbxwaZwsztUwbboVq6aUPg0=; b=Nht2YP 3VXc1rTs9WBM2OHTXN9F3fo+psBMP0ncJSQKK/8xC1RJmT49qYdCkQI2/Vro8fmB eBglpmHr/4a7q4oQlMaE9nhkdxltsSI2qsW/aybBbiM+FpP4+YeFSvPzofWEVVU+ r2MSfS/B4Reu/WM6PApaTkgMReWEcr07SjUwU= 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=lc8LUg3JiNWFKDsA8b5ob9fYW91gn24o lovlG4e+1ysrVSltCJNox3anOaSSBiu8bc9XLSXSiLB+0uhJxbyuDgXqo6VrR4GW BDN6vEP4GOovo8ZzZXUBndiShcJPGTwACXJu3RBIbUVC16Eg3axNpaqdV1LPBp6l nzxgrY+ST4w= Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 0DB6230B6F; Sun, 7 Aug 2016 17:59:05 -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 328D830B6B; Sun, 7 Aug 2016 17:59:04 -0400 (EDT) From: Andy Wingo <wingo@HIDDEN> References: <20160304164859.GE7946@HIDDEN> Date: Sun, 07 Aug 2016 23:58:57 +0200 In-Reply-To: <20160304164859.GE7946@HIDDEN> (zefram@HIDDEN's message of "Fri, 4 Mar 2016 16:48:59 +0000") Message-ID: <874m6wnsv2.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: 2805EE3C-5CEA-11E6-9055-28A6F1301B6D-02397024!pb-sasl2.pobox.com X-Spam-Score: -0.4 (/) 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 17:48, Zefram <zefram@HIDDEN> writes: > A call to setlocale with no second argument is documented to be > a read-only operation, querying the current locale configuration. > In fact it has a side effect of setting the encoding on primordial ports: This sounds like a bug indeed :/ Andy
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.