NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/58609: sh(1) ignores interactive locale changes
The following reply was made to PR bin/58609; it has been noted by GNATS.
From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/58609: sh(1) ignores interactive locale changes
Date: Sat, 17 Aug 2024 03:06:32 +0700
Date: Fri, 16 Aug 2024 17:30:01 +0000 (UTC)
From: campbell+netbsd=40mumble.net
Message-ID: <20240816173001.A3B3B1A9244=40mollari.NetBSD.org>
=7C If you start sh(1) with LC_CTYPE=3DC, when you enter UTF-8 input,
=7C sh(1) will ignore it, as one might expect.
That makes no sense to me at all ... sh(1) really knows close to nothing
about locales (though it should know a little more than it does) and does=
nothing (except some pattern matching) differently at all based upon what=
the locale is set to. Characters are simply sequences of bytes, sh does=
n't
care what they represent, if you echo one of them (however many bytes the=
re
are) sh's echo will simply write them out as entered.
Please try again after turning line editing off (set +VE) - if that makes=
a difference, then it is libedit you're having an issue with. sh should
not be =22ignoring=22 whatever that means, anything input, except '=5C0'.=
The issue with libedit not seeing changes to environment variables made
while the shell is running I do understand, that one isn't all that easy
to fix in general, as libedit() just used getenv() to see what they're se=
t
to, and sh consumes that environment when it starts, then largely simply
ignores it - variables are set in its internal data structs.
I guess I could have sh provide its own getenv() function (overriding the=
one in libc) which I assume libedit might then call - but I am not sure=
=5C
how safe that is. Builtins are compiled in an environment where getenv(=
)
has been turned into a macro which calls a different sh function, so they=
don't have that issue, but that cannot be done with libedit.
I will see what might be possible there.
kre
Home |
Main Index |
Thread Index |
Old Index