public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Change the timing of set_locale() call again. Date: Mon, 17 Aug 2020 09:16:11 +0000 (GMT) [thread overview] Message-ID: <20200817091611.9F5C13858D37@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=70d02aaca6ca4aa8990c673b2b0d2220ae813ee4 commit 70d02aaca6ca4aa8990c673b2b0d2220ae813ee4 Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> Date: Sat Aug 15 12:23:52 2020 +0900 Cygwin: pty: Change the timing of set_locale() call again. - After commit 095972ce5b1d319915501a7e381802914bed790c, charset conversion in mintty is broken if charset is set to other than UTF-8. This seems to be caused because mintty does not set locale yet at fork() call. This patch changes the timing of set_locale() call again to avoid this issue. Diff: --- winsup/cygwin/fhandler_tty.cc | 10 ++++++---- winsup/cygwin/spawn.cc | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 40b79bfbb..6294e2c20 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -2852,6 +2852,9 @@ get_langinfo (char *locale_out, char *charset_out) void fhandler_pty_slave::setup_locale (void) { + if (get_ttyp ()->term_code_page != 0) + return; + char locale[ENCODING_LEN + 1] = "C"; char charset[ENCODING_LEN + 1] = "ASCII"; LCID lcid = get_langinfo (locale, charset); @@ -2983,10 +2986,6 @@ fhandler_pty_slave::fixup_after_fork (HANDLE parent) // fork_fixup (parent, inuse, "inuse"); // fhandler_pty_common::fixup_after_fork (parent); report_tty_counts (this, "inherited", ""); - - /* Set locale */ - if (get_ttyp ()->term_code_page == 0) - setup_locale (); } void @@ -3024,6 +3023,9 @@ fhandler_pty_slave::fixup_after_exec () } } + /* Set locale */ + setup_locale (); + /* Hook Console API */ if (get_pseudo_console ()) { diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index e70ceb86d..af177c0f1 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -628,6 +628,18 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, } } + if (!iscygwin ()) + { + cfd.rewind (); + while (cfd.next () >= 0) + if (cfd->get_major () == DEV_PTYS_MAJOR) + { + fhandler_pty_slave *ptys = + (fhandler_pty_slave *)(fhandler_base *) cfd; + ptys->setup_locale (); + } + } + /* Set up needed handles for stdio */ si.dwFlags = STARTF_USESTDHANDLES; si.hStdInput = handle ((in__stdin < 0 ? 0 : in__stdin), false,
reply other threads:[~2020-08-17 9:16 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200817091611.9F5C13858D37@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).