delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/02/14/05:21:12

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=sQ7Y5dyYajgMeOEW2LsIuOHtUYCTYVCKIIXiPqbsX7KqcJCV+0YMa
Z/e3xjmNqtfuTtbOdIzYAco+HQzAYAEXRJpa8+55pU5rUjZ3hTR13HZI+viDInbX
asNn4j8/OcXutXuA484+FVeYGvCQwEpF7nRpYaa5KJDUf6H7JDTwAI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=ONYutjbmLcL9ICV4q0DRIQS6Fds=; b=YS8XbrRDmVj4wTsmLisd/3Jfs/Nn
/ewkC1zJndCnDOALhS8sQlYrI7yVJRE5Dd5znsi+JF25DtNRhpC2J6ExWIjvJsTK
LXVuJM7I4vjmCWoDrRPaygekBXGW5JZQmzpagqI/HX0AXI7zukaRzDDmXk+9Qm+z
RIq1gAgv6csR4MQ=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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
Date: Fri, 14 Feb 2014 11:20:44 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: New passwd/group handling in Cygwin - test results and observations
Message-ID: <20140214102044.GX2246@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20140213143849 DOT GH2246 AT calimero DOT vinschen DOT de> <1717869165 DOT 20140214021113 AT mtu-net DOT ru>
MIME-Version: 1.0
In-Reply-To: <1717869165.20140214021113@mtu-net.ru>
User-Agent: Mutt/1.5.21 (2010-09-15)

--3wyj3Xt2kUWLNC5K
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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

-----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--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019