Received: (at 22910) by debbugs.gnu.org; 7 Aug 2016 21:59:06 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 17:59:06 2016 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> To: Zefram <zefram@HIDDEN> Subject: Re: bug#22910: read-only setlocale has side effect 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-Debbugs-Envelope-To: 22910 Cc: 22910 <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 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
bug-guile@HIDDEN
:bug#22910
; Package guile
.
Full text available.Received: (at 22910) by debbugs.gnu.org; 4 Mar 2016 19:55:06 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 14:55:06 2016 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> To: 22910 <at> debbugs.gnu.org Subject: Re: bug#22910: read-only setlocale has side effect 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-Debbugs-Envelope-To: 22910 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
bug-guile@HIDDEN
:bug#22910
; Package guile
.
Full text available.Received: (at submit) by debbugs.gnu.org; 4 Mar 2016 16:49:13 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 11:49:13 2016 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> To: bug-guile@HIDDEN Subject: read-only setlocale has side effect 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-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 (-----) 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
Zefram <zefram@HIDDEN>
:bug-guile@HIDDEN
.
Full text available.bug-guile@HIDDEN
:bug#22910
; Package guile
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.