GNU bug report logs -
#22910
read-only setlocale has side effect
Previous Next
To reply to this bug, email your comments to 22910 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#22910
; Package
guile
.
(Fri, 04 Mar 2016 16:50:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Zefram <zefram <at> fysh.org>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Fri, 04 Mar 2016 16:50:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-guile <at> gnu.org
:
bug#22910
; Package
guile
.
(Fri, 04 Mar 2016 19:56:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 22910 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-guile <at> gnu.org
:
bug#22910
; Package
guile
.
(Sun, 07 Aug 2016 22:00:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 22910 <at> debbugs.gnu.org (full text, mbox):
On Fri 04 Mar 2016 17:48, Zefram <zefram <at> fysh.org> 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
This bug report was last modified 8 years and 311 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.