GNU bug report logs - #22910
read-only setlocale has side effect

Previous Next

Package: guile;

Reported by: Zefram <zefram <at> fysh.org>

Date: Fri, 4 Mar 2016 16:50:01 UTC

Severity: normal

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zefram <zefram <at> fysh.org>
To: bug-guile <at> gnu.org
Subject: read-only setlocale has side effect
Date: Fri, 4 Mar 2016 16:48:59 +0000
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




This bug report was last modified 8 years and 312 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.