From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31829 invoked by alias); 14 Feb 2014 10:20:48 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 31816 invoked by uid 89); 14 Feb 2014 10:20:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Feb 2014 10:20:47 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id F0CCC52082E; Fri, 14 Feb 2014 11:20:44 +0100 (CET) Date: Fri, 14 Feb 2014 10:42:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: New passwd/group handling in Cygwin - test results and observations Message-ID: <20140214102044.GX2246@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20140213143849.GH2246@calimero.vinschen.de> <1717869165.20140214021113@mtu-net.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3wyj3Xt2kUWLNC5K" Content-Disposition: inline In-Reply-To: <1717869165.20140214021113@mtu-net.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-02/txt/msg00352.txt.bz2 --3wyj3Xt2kUWLNC5K Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 3522 On Feb 14 02:11, Andrey Repin wrote: > Greetings, Corinna Vinschen! >=20 > > This week I applied the first incarnation of the new passwd/group > > handling code to the Cygwin repository and after fixing a crash which > > manifested in Denis Excoffier's network, I think we're at a point > > which allows to push this forward. >=20 > Oookaaaay... What to say about it?... > First impression is "oh my god, did I bought a new rig?" >=20 > $ uname -a > CYGWIN_NT-5.1 daemon2 1.7.29s(0.271/5/3) 20140213 14:06:26 i686 Cygwin >=20 > mintty startup is almost instant. Same with diff in native console. > I have no idea, what you did, I don't even have a good explanation of why= it > happened. My /etc/passwd is about 1.5kb, half that - /etc/group. >=20 > I only dumped new cygwin1.dll into place and not changed anything else. > I'm going to run unattended tests just to prove I'm not dreaming. >=20 > HOWEVER, here's a first bug. Actually, it was a long standing issue, that > I've been discarding as nonessential, but since you are here already, can= we > have a bit of attention? >=20 > The issue can be observed when you have a user or group name containing > characters outside basic ASCII character set. Even western diacritics will > suffice. >=20 > Add somewhere in your startup files an equivalent of the following block: > (I have it in private .profile) >=20 > ---->8-------->8-------->8-------->8-------->8-------->8-------->8---- > case "$TERM" in > xterm*) > LANG=3Dru_RU.UTF-8 > ;; > *) > LANG=3Dru_RU.CP866 > ;; > esac >=20 > export PATH HISTCONTROL LANG > ----8<--------8<--------8<--------8<--------8<--------8<--------8<---- >=20 > restart your shell, and try to ls -l a directory, where you have files ow= ned > by abovementioned user/group. >=20 > Try it in mintty(the encoding will be UTF-8 and names will show up readab= le) > and in native console (with appropriate single-byte encoding, the names w= ill > still be printed in unicode, means, raw byte sequences will be dumped to > terminal). > I though it could be affected by the fact I'm changing LANG on the fly, b= ut > starting bash in a console that initially have correct LANG=3D variable d= oesn't > change observed results. Yes, this is a problem, and I'm not sure how to fix it, if at all. The problem is hopefully obvious. We have to initialize things in some order. For instance, to read /etc/fstab.d/$USER, we need the username. And since the Cygwin username can be different from the Windows username (I guess I should have never added this functionality in the first place), we have to read the user's passwd before we read the fstabs. Same for the initialization of $LANG and friends. That occurs pretty late in the process initialization. You know that Windows uses UTF-16 under the hood, so a lot of stuff gets read and converted to UTF-8 before we even care for the environment. And if you set the codeset in the application only, all the relevant information has already been read long ago, of course. But this is a problem not different from Linux. If you have a username with non-ASCII chars, it will use *some* encoding in the passwd DB, usually UTF-8 these days. If you then change the codeset in your application, you will still get your username in UTF-8. It won't be changed on the fly, just because your application calls setlocale. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --3wyj3Xt2kUWLNC5K Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJS/e38AAoJEPU2Bp2uRE+gqMYP/3ImHGpo4VYHjYMUV1a4K+aK vnKWJJXGps+ByizuSdcI5yx4f4rhFHDKl4j/CK1UX8kT1bM8uHlNV00YFd+7w7GM 1ZfMGynkvTcsbtwJfi25V0sWibi4xToID50kFLm+3BkgXI/cYQMatQcdfgHgIX5C ivYFdhRvNf8ZkZX+2ZE2ObUSoBwlUDhWmZTWZbaWo2BPHRDrDWofs8RzFfl9nO4D w+0Z6ohUnDeU2j5NdgiohlmTLNFLw5jQQf/tV/+/tIg3Org2DGA/J1DKehjT3VV0 8NuYjuYF8rw7WCPSDmBANUUbNCxCgBohYusJ3+brpf+P6qqOXOpNLQ/kYiyqs31X zC2CLg273PLYDlLonrcmW30fGvphOiNMAzgmUwYhgpdbqbuQYoGhxN5csMN256yu DrG3Lua0YHszqIkS7VNaZ5ayKtsfG8ctPH8EPxyi/zZ/8DeujdQfgw8+2P3VQHBK Aw+0n/7HI6B06/ND0PLBkfircQDO8321LQk2dXR+nxzAyYNtN0C+Liyn0Xyr5b9D z+cAtN6QYyK8KWWLsVVxJG+Pz/3N1l772tOM+DFJnuFSDp1XzKTlP1Xk3Tw10c/Z iGyMdyDsAPt/9tJ4wHMYT71EajWPdUjKjtpFzRDv/ysB7862vJxr8URr7urE8oVL B0tc0vAucecVrbMXbIyp =Lz4b -----END PGP SIGNATURE----- --3wyj3Xt2kUWLNC5K--