Mail Archives: cygwin/2014/02/14/05:21:12
--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 -