bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rl_filename_rewrite_hook called on wrong filename


From: Chet Ramey
Subject: Re: rl_filename_rewrite_hook called on wrong filename
Date: Wed, 4 Oct 2023 09:49:15 -0400
User-agent: Mozilla Thunderbird

On 9/26/23 2:02 PM, Grisha Levit wrote:

On Tue, Sep 26, 2023, 10:24 Chet Ramey <chet.ramey@case.edu <mailto:chet.ramey@case.edu>> wrote:
 >
 > On 9/25/23 7:02 PM, Karl O. Pinc wrote:
 > > On Mon, 25 Sep 2023 18:35:53 +0200
 > > "Stefan H. Holek" <stefan@epy.co.at <mailto:stefan@epy.co.at>> wrote:
 > >
 > >> I am however not sure supporting different character sets is still
 > >> useful in 2023. Everything is UTF-8 these days, and your code is fine
 > >> if NFD/NFC is the only problem we have to solve.
 > >
 > > I am not following the details here but I've noticed some
 > > cloud providers provision C.UTF-8 by default.  This may
 > > not be relevant, but is certainly ASCII-like so I thought
 > > you might want to know.
 >
 > Right now, this code is only active on macOS, which doesn't yet support
 > C.UTF-8 (at least as of Ventura).

I think the issue Stefan brings to light is that, while the filename rewrite
hook installed by Bash is a noop other than on macOS, Readline will now apply
any existing rewrite hook to the completion word, which existing hooks (if
such exist) are likely not designed to deal with.

Sure, in theory. I've never seen such a hook in the wild. Bash is really
the only application that uses it.

E.g., if one already had a rewrite hook to convert UTF-8 file system names
for matching (in as much as that is possible) against ISO-8859-1 terminal
text, applying that same hook now to terminal input as well will produce
garbage results.

I guess it depends on what you're converting them to. But again, this is
mostly hypothetical.

Not sure if this is kind of hook is actually part of something people are
still building against new Readline versions but I would feel bad breaking
backwards compatibility needlessly so here's a patch to split up the hook
that gets applied to the filename portion of the input from the hook that
gets applied to directory entries read from the file system, in case that
seems reasonable to you.

I suppose this is reasonable at this stage; this isn't a released feature yet.
Thanks.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]